Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mapToFile.script
  2.  
  3. servers = ["home"];
  4. clear("nmap.txt");
  5.  
  6. for (i = 0; i < servers.length; ++i) {
  7.     hostname = servers[i];
  8.     //if(!hostname.includes('pserv')){
  9.         write("nmap.txt", hostname
  10.             + "," + getServerRam(hostname)[0]
  11.             + "," + getServerNumPortsRequired(hostname)
  12.             + "," + getServerRequiredHackingLevel(hostname)
  13.             + "," + getServerMaxMoney(hostname)
  14.             + "," + getServerMinSecurityLevel(hostname)
  15.             + "," + getServerGrowth(hostname)
  16.             + "\r\n");
  17.    
  18.         newScan = scan(hostname);
  19.         for (j = 0; j < newScan.length; j++) {
  20.             if (servers.indexOf(newScan[j]) == -1) {
  21.                 servers.push(newScan[j]);
  22.             }
  23.         }
  24.     //}
  25. }
  26.  
  27. tprint("Network mapped.");
  28. ===========================================================================================
  29. autoHack.script
  30.  
  31. function getPortBusters(){
  32.     busterCount = 0;
  33.     portBusters = ['BruteSSH.exe', 'FTPCrack.exe', 'relaySMTP.exe', 'HTTPWorm.exe', 'SQLInject.exe'];
  34.     for(i = 0; i < portBusters.length; i++) {
  35.         if (fileExists(portBusters[i], "home")) {
  36.             print(portBusters[i] + " exists");
  37.             ++busterCount;
  38.         }
  39.         else
  40.             print(portBusters[i] + " missing");
  41.     }
  42.    
  43.     return busterCount;
  44. }
  45.  
  46. rows = read("nmap.txt").split("\r\n");
  47. scriptRam = Math.ceil(getScriptRam("hit_it_and_quit_it.script", "home") * 50);
  48. numBusters = 0;
  49. while (true){
  50.     if(numBusters < 5){
  51.         numBusters = getPortBusters();
  52.     }
  53.    
  54.     if(!fileExists("autoHackedFlag.script", "home")){
  55.         prompt('autoHackedFlag.script not found on server please create it, autoHack.script will exit.');
  56.         exit();
  57.     }
  58.    
  59.     myHackLevel = getHackingLevel();
  60.    
  61.     for (i = 0; i < rows.length; ++i) {
  62.         serverData = rows[i].split(',');
  63.         if (serverData.length < 7) break; //Ignore last blank row
  64.    
  65.         svName = serverData[0];
  66.         svPortsNeeded = serverData[2];
  67.         svHackLevel = serverData[3];
  68.         if(svName.includes('home') || svName.includes('pserv')) continue;
  69.        
  70.         print("Testing " + svName);
  71.    
  72.         if ( ! (hasRootAccess(svName))
  73.             && (numBusters >= svPortsNeeded)
  74.             && (myHackLevel >= svHackLevel) ) {
  75.    
  76.             if (numBusters > 0) brutessh(svName);
  77.             if (numBusters > 1) ftpcrack(svName);
  78.             if (numBusters > 2) relaysmtp(svName);
  79.             if (numBusters > 3) httpworm(svName);
  80.             if (numBusters > 4) sqlinject(svName);
  81.    
  82.             nuke(svName);
  83.             tprint("Server hacked: " + svName);
  84.         }
  85.         if (hasRootAccess(svName)) {
  86.             if(fileExists("autoHackedFlag.script", svName)){
  87.                 print("File autoHackedFlag.script found: " + svName);
  88.                 rows.splice(i, 1);
  89.                 break;
  90.             }
  91.            
  92.             //Run AutoHack Script
  93.             if(isRunning("hit_it_and_quit_it.script", "home")){
  94.                 print("AutoHack script currently running: " + svName);
  95.                 break;
  96.             } else {
  97.                 serverRam = getServerRam("home");
  98.                 serverRamAvail = Math.floor(serverRam[0] - serverRam[1]);
  99.                 if(scriptRam < serverRamAvail){
  100.                     exec("hit_it_and_quit_it.script", "home", 50, svName);
  101.                     print("AutoHack script started for: " + svName);
  102.                     break;
  103.                 }
  104.                 else{
  105.                     print("Currently not enough ram available to run AutoHack, waiting till next cycle. Required: " + scriptRam + "mb Available: " +serverRamAvail+ "mb");
  106.                     break;
  107.                 }
  108.             }
  109.            
  110.         } else {
  111.             print("Requirments not met to hack: " + svName);
  112.         }
  113.         print("Done Testing " + svName);
  114.     }
  115. }
  116. tprint("-------------Auto Hacking Complete-------------");
  117. ===========================================================================================
  118. hit_it_and_quit_it.script
  119.  
  120. target = args[0];
  121. gssl = getServerSecurityLevel;
  122. gsbsl = getServerBaseSecurityLevel;
  123. w = weaken;
  124. h = hack;
  125. a = [target,target,target,target,target,target,target,target,target];
  126. securityThresh = Math.max(1, Math.round(gsbsl(target) / 3));
  127. while(true) {
  128.     if (gssl(target) > securityThresh) {
  129.         print('Security threshold of '+ securityThresh +' wanted.');
  130.         //If the server's security level is above our threshold, weaken it
  131.         a.forEach(w);
  132.         w(target);
  133.     } else {
  134.         //Otherwise, hack it
  135.         result = h(target);
  136.         if(result){
  137.             scp("autoHackedFlag.script", target);
  138.             break;
  139.         }
  140.     }
  141. }
  142. ===========================================================================================
  143. autoHackedFlag.script
  144.  
  145. //This is just FLAG to show the servers has been autoHacked
  146. ===========================================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement