Free AutoLock script

LaserBeam

Member
Sep 17, 2023
4
1
11
This is an auto lock script, it has physical and remote hacking protection and will automaticlly lock the computer when left unattended.

Installation
login into your maxnet account.
create a file then copy the code below and save it, file create AutoLock.msc then file open AutoLock.msc
now lets compile the code, mnscript compile AutoLock.msc AutoLock , to execute the code, enter mnscript exec AutoLock.mscx
a new application will appear on your desktop, enter gui to exit terminal, left click on the application to run it, grant admin rights.

change string ownerid to your own steamid.
change string walletid to your own VentzCoin wallet id or leave empty.


C#:
using Application;
using Console;
using Event;
using Firewall;
using Math;
using Net;
using Peripheral;
using Player;
using String;
using System;
using VentzCoin;

Application.CreateDesktopIcon("https://i.ibb.co/DK4YCRz/lock.png");

Application.RequestAdminPrivilege();

string ownerid = "";
string userid = System.GetUserSteamID();
string walletid = "";

function OnPlayerStartedUsing(Player ply) {
if (userid != ownerid) {
Console.WriteLine("System lockdown. Intruder: "..ply);
System.Lock();
}
}
Event.AddListener("PlayerStartedUsing", "using", "OnPlayerStartedUsing");

function OnPlayerStoppedUsing(Player ply) {
System.Lock();
}
Event.AddListener("PlayerStoppedUsing", "using", "OnPlayerStoppedUsing");

function OnVCMinerStarted(VCMiner miner){
Console.WriteLine("A VCMiner was started!");
miner.SetWallet(walletid);
}
Event.AddListener("VCMinerStarted", "vcminer_stopped", "OnVCMinerStarted");

function OnVCMinerWalletChanged(VCMiner miner, string newWallet, bool isWalletValid){
Console.WriteLine("A VCMiner wallet changed to "..walletid);
miner.SetWallet(walletid);
}
Event.AddListener("VCMinerWalletChanged", "vcminer_stopped", "OnVCMinerWalletChanged");

// Firewall:
string chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 -_";

function<string> getRandomString(number len, string charList)
{
string pass;
while(String.Length(pass) <= len)
{
pass = pass .. String.CharAt(charList, Math.RandomRange(1, String.Length(charList)));
}
return pass;
}

string randomPass = getRandomString(Math.RandomRange(10,15), chars);
System.RunCommand("router settings admin_password "..randomPass);
System.RunCommand("router login "..randomPass);
System.RunCommand("router settings hide_terminals true");
System.RunCommand("router settings firewall_enabled true");
System.RunCommand("firewall enable");
System.RunCommand("router firewall block MN_PROTOCOL_REMOTE");
System.RunCommand("router firewall block MN_PROTOCOL_REMOTE_ATTEMPT");
System.RunCommand("router firewall block MN_PROTOCOL_MESSAGE");
System.RunCommand("router firewall block MN_PROTOCOL_MANAGER_SCAN");
System.RunCommand("router firewall block MN_PROTOCOL_REMOTE_COMMAND");

function OnNetworkMessageReceived(number protocol, NTM message){
string sourceAddress = message.GetSourceAddress();

Console.WriteLine("Firewall: remote connection attempt detected from " .. sourceAddress .. ":" .. protocol);

if (protocol == 120 || protocol == 122 || protocol == 130) {
Firewall.Block(sourceAddress);
}

}
Event.AddListener("IncomingNTM", "NTM", "OnNetworkMessageReceived");

while(true) {

if (System.HasPeripheral("unlocker")) {
System.RunCommand("cls");
Console.WriteLine("Critical unauthorized access.");
System.Lock();
}

Event.Process();
}
 
Last edited:
function OnNetworkMessageReceived(number protocol, NTM message){ string sourceAddress = message.GetSourceAddress(); Console.WriteLine("Firewall: ".. sourceAddress .. " attempted to open remote connection."); Firewall.Block(sourceAddress); } Event.AddListener("IncomingNTM", "NTM", "OnNetworkMessageReceived");

This part of the code won't work as you intend, it'll block all incoming traffic on the firewall. You'll want to have the code listen for the remote connection protocol only.
 
  • Like
Reactions: LaserBeam