Removed time for Program netscript ocmmands (nuke, brutessh, etc)

This commit is contained in:
Daniel Xie 2017-06-05 01:24:30 -05:00
parent bb24c017f1
commit 71999ea2eb
2 changed files with 52 additions and 61 deletions

@ -488,6 +488,11 @@ CONSTANTS = {
"RAM Upgrades on your home computer", "RAM Upgrades on your home computer",
Changelog: Changelog:
"v0.20.0<br>" +
"Refactor Netscript Interpreter code. Operations in Netscript should now run significantly faster (Every operation " +
"such as a variable assignment, a function call, a binary operator, getting a variable's value, etc. used to take up to several seconds, " +
"now each one should only take 750 milliseconds). <br> " +
""
"v0.19.7<br>" + "v0.19.7<br>" +
"-Added changelog to Options menu<br>" + "-Added changelog to Options menu<br>" +
"-Bug fix with autocompletion (wasn't working properly for capitalized filenames/programs<br><br>" + "-Bug fix with autocompletion (wasn't working properly for capitalized filenames/programs<br><br>" +

@ -252,90 +252,76 @@ function netscriptRunNukeProgram(exp, workerScript, server) {
if (server.openPortCount < server.numOpenPortsRequired) { if (server.openPortCount < server.numOpenPortsRequired) {
return Promise.reject(makeRuntimeRejectMsg(workerScript, "Not enough ports opened to use NUKE.exe virus")); return Promise.reject(makeRuntimeRejectMsg(workerScript, "Not enough ports opened to use NUKE.exe virus"));
} }
if (server.hasAdminRights) {
workerScript.scriptRef.log("Running NUKE.exe on server " + server.hostname + " in 5 seconds"); workerScript.scriptRef.log("Already have root access to " + server.hostname);
setTimeout(function() { } else {
if (server.hasAdminRights) { server.hasAdminRights = true;
workerScript.scriptRef.log("Already have root access to " + server.hostname); workerScript.scriptRef.log("Executed NUKE.exe virus on " + server.hostname + " to gain root access");
} else { }
server.hasAdminRights = true; return Promise.resolve(true);
workerScript.scriptRef.log("Executed NUKE.exe virus on " + server.hostname + " to gain root access");
}
return Promise.resolve(true);
}, 5 * 1000);
} }
function netscriptRunBrutesshProgram(exp, workerScript, server) { function netscriptRunBrutesshProgram(exp, workerScript, server) {
var env = workerScript.env; var env = workerScript.env;
if (env.stopFlag) {return Promise.reject(workerScript);} if (env.stopFlag) {return Promise.reject(workerScript);}
setTimeout(function() { if (!server.sshPortOpen) {
if (!server.sshPortOpen) { workerScript.scriptRef.log("Executed BruteSSH.exe virus on " + server.hostname + " to open SSH port (22)");
workerScript.scriptRef.log("Executed BruteSSH.exe virus on " + server.hostname + " to open SSH port (22)"); server.sshPortOpen = true;
server.sshPortOpen = true; ++server.openPortCount;
++server.openPortCount; } else {
} else { workerScript.scriptRef.log("SSH Port (22) already opened on " + server.hostname);
workerScript.scriptRef.log("SSH Port (22) already opened on " + server.hostname); }
} return Promise.resolve(true);
return Promise.resolve(true);
}, 10 * 1000);
} }
function netscriptRunFtpcrackProgram(exp, workerScript, server) { function netscriptRunFtpcrackProgram(exp, workerScript, server) {
var env = workerScript.env; var env = workerScript.env;
if (env.stopFlag) {return Promise.reject(workerScript);} if (env.stopFlag) {return Promise.reject(workerScript);}
setTimeout(function() { if (!server.ftpPortOpen) {
if (!server.ftpPortOpen) { workerScript.scriptRef.log("Executed FTPCrack.exe virus on " + server.hostname + " to open FTP port (21)");
workerScript.scriptRef.log("Executed FTPCrack.exe virus on " + server.hostname + " to open FTP port (21)"); server.ftpPortOpen = true;
server.ftpPortOpen = true; ++server.openPortCount;
++server.openPortCount; } else {
} else { workerScript.scriptRef.log("FTP Port (21) already opened on " + server.hostname);
workerScript.scriptRef.log("FTP Port (21) already opened on " + server.hostname); }
} return Promise.resolve(true);
return Promise.resolve(true);
}, 15 * 1000);
} }
function netscriptRunRelaysmtpProgram(exp, workerScript, server) { function netscriptRunRelaysmtpProgram(exp, workerScript, server) {
var env = workerScript.env; var env = workerScript.env;
if (env.stopFlag) {return Promise.reject(workerScript);} if (env.stopFlag) {return Promise.reject(workerScript);}
setTimeout(function() { if (!server.smtpPortOpen) {
if (!server.smtpPortOpen) { workerScript.scriptRef.log("Executed relaySMTP.exe virus on " + server.hostname + " to open SMTP port (25)");
workerScript.scriptRef.log("Executed relaySMTP.exe virus on " + server.hostname + " to open SMTP port (25)"); server.smtpPortOpen = true;
server.smtpPortOpen = true; ++server.openPortCount;
++server.openPortCount; } else {
} else { workerScript.scriptRef.log("SMTP Port (25) already opened on " + server.hostname);
workerScript.scriptRef.log("SMTP Port (25) already opened on " + server.hostname); }
} return Promise.resolve(true);
return Promise.resolve(true);
}, 20 * 1000);
} }
function netscriptRunHttpwormProgram(exp, workerScript, server) { function netscriptRunHttpwormProgram(exp, workerScript, server) {
var env = workerScript.env; var env = workerScript.env;
if (env.stopFlag) {return Promise.reject(workerScript);} if (env.stopFlag) {return Promise.reject(workerScript);}
setTimeout(function() { if (!server.httpPortOpen) {
if (!server.httpPortOpen) { workerScript.scriptRef.log("Executed HTTPWorm.exe virus on " + server.hostname + " to open HTTP port (25)");
workerScript.scriptRef.log("Executed HTTPWorm.exe virus on " + server.hostname + " to open HTTP port (25)"); server.httpPortOpen = true;
server.httpPortOpen = true; ++server.openPortCount;
++server.openPortCount; } else {
} else { workerScript.scriptRef.log("HTTP Port (80) already opened on " + server.hostname);
workerScript.scriptRef.log("HTTP Port (80) already opened on " + server.hostname); }
} return Promise.resolve(true);
return Promise.resolve(true);
}, 25 * 1000);
} }
function netscriptRunSqlinjectProgram(exp, workerScript, server) { function netscriptRunSqlinjectProgram(exp, workerScript, server) {
var env = workerScript.env; var env = workerScript.env;
if (env.stopFlag) {return Promise.reject(workerScript);} if (env.stopFlag) {return Promise.reject(workerScript);}
setTimeout(function() { if (!server.sqlPortOpen) {
if (!server.sqlPortOpen) { workerScript.scriptRef.log("Executed SQLInject.exe virus on " + server.hostname + " to open SQL port (1433)");
workerScript.scriptRef.log("Executed SQLInject.exe virus on " + server.hostname + " to open SQL port (1433)"); server.sqlPortOpen = true;
server.sqlPortOpen = true; ++server.openPortCount;
++server.openPortCount; } else {
} else { workerScript.scriptRef.log("SQL Port (1433) already opened on " + server.hostname);
workerScript.scriptRef.log("SQL Port (1433) already opened on " + server.hostname); }
} return Promise.resolve(true);
return Promise.resolve(true);
}, 30 * 1000);
} }