Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mapToFile.script
- servers = ["home"];
- clear("nmap.txt");
- for (i = 0; i < servers.length; ++i) {
- hostname = servers[i];
- //if(!hostname.includes('pserv')){
- write("nmap.txt", hostname
- + "," + getServerRam(hostname)[0]
- + "," + getServerNumPortsRequired(hostname)
- + "," + getServerRequiredHackingLevel(hostname)
- + "," + getServerMaxMoney(hostname)
- + "," + getServerMinSecurityLevel(hostname)
- + "," + getServerGrowth(hostname)
- + "\r\n");
- newScan = scan(hostname);
- for (j = 0; j < newScan.length; j++) {
- if (servers.indexOf(newScan[j]) == -1) {
- servers.push(newScan[j]);
- }
- }
- //}
- }
- tprint("Network mapped.");
- ===========================================================================================
- autoHack.script
- function getPortBusters(){
- busterCount = 0;
- portBusters = ['BruteSSH.exe', 'FTPCrack.exe', 'relaySMTP.exe', 'HTTPWorm.exe', 'SQLInject.exe'];
- for(i = 0; i < portBusters.length; i++) {
- if (fileExists(portBusters[i], "home")) {
- print(portBusters[i] + " exists");
- ++busterCount;
- }
- else
- print(portBusters[i] + " missing");
- }
- return busterCount;
- }
- rows = read("nmap.txt").split("\r\n");
- scriptRam = Math.ceil(getScriptRam("hit_it_and_quit_it.script", "home") * 50);
- numBusters = 0;
- while (true){
- if(numBusters < 5){
- numBusters = getPortBusters();
- }
- if(!fileExists("autoHackedFlag.script", "home")){
- prompt('autoHackedFlag.script not found on server please create it, autoHack.script will exit.');
- exit();
- }
- myHackLevel = getHackingLevel();
- for (i = 0; i < rows.length; ++i) {
- serverData = rows[i].split(',');
- if (serverData.length < 7) break; //Ignore last blank row
- svName = serverData[0];
- svPortsNeeded = serverData[2];
- svHackLevel = serverData[3];
- if(svName.includes('home') || svName.includes('pserv')) continue;
- print("Testing " + svName);
- if ( ! (hasRootAccess(svName))
- && (numBusters >= svPortsNeeded)
- && (myHackLevel >= svHackLevel) ) {
- if (numBusters > 0) brutessh(svName);
- if (numBusters > 1) ftpcrack(svName);
- if (numBusters > 2) relaysmtp(svName);
- if (numBusters > 3) httpworm(svName);
- if (numBusters > 4) sqlinject(svName);
- nuke(svName);
- tprint("Server hacked: " + svName);
- }
- if (hasRootAccess(svName)) {
- if(fileExists("autoHackedFlag.script", svName)){
- print("File autoHackedFlag.script found: " + svName);
- rows.splice(i, 1);
- break;
- }
- //Run AutoHack Script
- if(isRunning("hit_it_and_quit_it.script", "home")){
- print("AutoHack script currently running: " + svName);
- break;
- } else {
- serverRam = getServerRam("home");
- serverRamAvail = Math.floor(serverRam[0] - serverRam[1]);
- if(scriptRam < serverRamAvail){
- exec("hit_it_and_quit_it.script", "home", 50, svName);
- print("AutoHack script started for: " + svName);
- break;
- }
- else{
- print("Currently not enough ram available to run AutoHack, waiting till next cycle. Required: " + scriptRam + "mb Available: " +serverRamAvail+ "mb");
- break;
- }
- }
- } else {
- print("Requirments not met to hack: " + svName);
- }
- print("Done Testing " + svName);
- }
- }
- tprint("-------------Auto Hacking Complete-------------");
- ===========================================================================================
- hit_it_and_quit_it.script
- target = args[0];
- gssl = getServerSecurityLevel;
- gsbsl = getServerBaseSecurityLevel;
- w = weaken;
- h = hack;
- a = [target,target,target,target,target,target,target,target,target];
- securityThresh = Math.max(1, Math.round(gsbsl(target) / 3));
- while(true) {
- if (gssl(target) > securityThresh) {
- print('Security threshold of '+ securityThresh +' wanted.');
- //If the server's security level is above our threshold, weaken it
- a.forEach(w);
- w(target);
- } else {
- //Otherwise, hack it
- result = h(target);
- if(result){
- scp("autoHackedFlag.script", target);
- break;
- }
- }
- }
- ===========================================================================================
- autoHackedFlag.script
- //This is just FLAG to show the servers has been autoHacked
- ===========================================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement