Added functionality to create Deepscan programs. Untested

This commit is contained in:
Daniel Xie 2017-05-24 16:35:24 -05:00
parent 0fcde41a87
commit 84eb295527
4 changed files with 83 additions and 31 deletions

@ -430,6 +430,16 @@
SQLInject.exe SQLInject.exe
<span class="tooltiptext"> This virus opens SQL ports</span> <span class="tooltiptext"> This virus opens SQL ports</span>
</a> </a>
<a class="create-program-a-link-button tooltip" id="create-program-deepscanv1" href="#">
DeepscanV1.exe
<span class="tooltiptext"> This program allows you to use the scan-analyze command with a depth up to 5</span>
</a>
<a class="create-program-a-link-button tooltip" id="create-program-deepscanv2" href="#">
DeepscanV2.exe
<span class="tooltiptext"> This program allows you to use the scan-analyze command with a depth up to 10</span>
</a>
</ul> </ul>
</div> </div>

@ -1,11 +1,13 @@
/* Create programs */ /* Create programs */
Programs = { Programs = {
NukeProgram: "NUKE.exe", NukeProgram: "NUKE.exe",
BruteSSHProgram: "BruteSSH.exe", BruteSSHProgram: "BruteSSH.exe",
FTPCrackProgram: "FTPCrack.exe", FTPCrackProgram: "FTPCrack.exe",
RelaySMTPProgram: "relaySMTP.exe", RelaySMTPProgram: "relaySMTP.exe",
HTTPWormProgram: "HTTPWorm.exe", HTTPWormProgram: "HTTPWorm.exe",
SQLInjectProgram: "SQLInject.exe", SQLInjectProgram: "SQLInject.exe",
DeepscanV1: "DeepscanV1.exe",
DeepscanV2: "DeepscanV2.exe",
} }
//TODO Right now the times needed to complete work are hard-coded... //TODO Right now the times needed to complete work are hard-coded...
@ -17,6 +19,8 @@ function displayCreateProgramContent() {
var relaySmtpALink = document.getElementById("create-program-relaysmtp"); var relaySmtpALink = document.getElementById("create-program-relaysmtp");
var httpWormALink = document.getElementById("create-program-httpworm"); var httpWormALink = document.getElementById("create-program-httpworm");
var sqlInjectALink = document.getElementById("create-program-sqlinject"); var sqlInjectALink = document.getElementById("create-program-sqlinject");
var deepscanv1ALink = document.getElementById("create-program-deepscanv1");
var deepscanv2ALink = document.getElementById("create-program-deepscanv2");
nukeALink.style.display = "none"; nukeALink.style.display = "none";
bruteSshALink.style.display = "none"; bruteSshALink.style.display = "none";
@ -24,6 +28,8 @@ function displayCreateProgramContent() {
relaySmtpALink.style.display = "none"; relaySmtpALink.style.display = "none";
httpWormALink.style.display = "none"; httpWormALink.style.display = "none";
sqlInjectALink.style.display = "none"; sqlInjectALink.style.display = "none";
deepscanv1ALink.style.display = "none";
deepscanv2ALink.style.display = "none";
//NUKE.exe (in case you delete it lol) //NUKE.exe (in case you delete it lol)
if (Player.getHomeComputer().programs.indexOf(Programs.NukeProgram) == -1) { if (Player.getHomeComputer().programs.indexOf(Programs.NukeProgram) == -1) {
@ -59,6 +65,15 @@ function displayCreateProgramContent() {
Player.hacking_skill >= 750) { Player.hacking_skill >= 750) {
sqlInjectALink.style.display = "inline-block"; sqlInjectALink.style.display = "inline-block";
} }
//Deepscan V1 and V2
if (!Player.hasProgram(Programs.DeepscanV1) && Player.hacking_skill >= 75) {
deepscanv1ALink.style.display = "inline-block";
}
if (!Player.hasProgram(Programs.DeepscanV2) && Player.hacking_skill >= 400) {
deepscanv2ALink.style.display = "inline-block";
}
} }
//Returns the number of programs that are currently available to be created //Returns the number of programs that are currently available to be created
@ -99,5 +114,15 @@ function getNumAvailableCreateProgram() {
Player.hacking_skill >= 750) { Player.hacking_skill >= 750) {
++count; ++count;
} }
//Deepscan V1 and V2
if (!Player.hasProgram(Programs.DeepscanV1) && Player.hacking_skill >= 75) {
++count;
}
if (!Player.hasProgram(Programs.DeepscanV2) && Player.hacking_skill >= 400) {
++count;
}
return count; return count;
} }

@ -728,8 +728,19 @@ var Terminal = {
Terminal.executeScanAnalyzeCommand(1); Terminal.executeScanAnalyzeCommand(1);
} else if (commandArray.length == 2) { } else if (commandArray.length == 2) {
var depth = Number(commandArray[1]); var depth = Number(commandArray[1]);
if (isNaN(depth)) { if (isNaN(depth) || depth < 0) {
post("Incorrect usage of scan-analyze command. depth argument must be numeric"); post("Incorrect usage of scan-analyze command. depth argument must be positive numeric");
return;
}
if (depth > 3 && !Player.hasProgram(Programs.DeepscanV1) &&
!Player.hasProgram(Programs.DeepscanV2)) {
post("You cannot scan-analyze with that high of a depth. Maximum depth is 3");
return;
} else if (depth > 5 && !Player.hasProgram(Programs.DeepscanV2)) {
post("You cannot scan-analyze with that high of a depth. Maximum depth is 5");
return;
} else if (depth > 10) {
post("You cannot scan-analyze with that high of a depth. Maximum depth is 10");
return; return;
} }
Terminal.executeScanAnalyzeCommand(depth); Terminal.executeScanAnalyzeCommand(depth);
@ -844,6 +855,9 @@ var Terminal = {
//We'll use the AllServersToMoneyMap as a visited() array //We'll use the AllServersToMoneyMap as a visited() array
//TODO Later refactor this to a generic name //TODO Later refactor this to a generic name
//TODO Using array as stack for now, can make more efficient //TODO Using array as stack for now, can make more efficient
post("~~~~~~~~~~ Beginning scan-analyze ~~~~~~~~~~");
post(" ");
post(" ");
var visited = new AllServersToMoneyMap(); var visited = new AllServersToMoneyMap();
var stack = []; var stack = [];
var depthQueue = [0]; var depthQueue = [0];
@ -862,31 +876,17 @@ var Terminal = {
depthQueue.push(d+1); depthQueue.push(d+1);
} }
if (d == 0) {continue;} //Don't print current server if (d == 0) {continue;} //Don't print current server
var titleNumDashes = Array((d-1) * 2 + 1).join("-"); var titleDashes = Array((d-1) * 4 + 1).join("-");
post("<strong>" + titleNumDashes + s.hostname + "</strong>"); post("<strong>" + titleDashes + ">" + s.hostname + "</strong>");
var numDashes = Array(d * 2 + 1).join("-"); var dashes = titleDashes + "--";
var c = "N"; //var dashes = Array(d * 2 + 1).join("-");
if (s.hasAdminRights) {c = "Y";} var c = "NO";
post(numDashes + "Root Access: " + c); if (s.hasAdminRights) {c = "YES";}
post(numDashes + "Required hacking skill: " + s.requiredHackingSkill); post(dashes + "Root Access: " + c + ", Required hacking skill: " + s.requiredHackingSkill);
post(numDashes + "Number of open ports required to NUKE: " + s.numOpenPortsRequired); post(dashes + "Number of open ports required to NUKE: " + s.numOpenPortsRequired);
post(numDashes + "RAM: " + s.maxRam); post(dashes + "RAM: " + s.maxRam);
}
/*
var currServ = Player.getCurrentServer();
for (var i = 0; i < currServ.serversOnNetwork.length; ++i) {
var serv = currServ.getServerOnNetwork(i);
if (serv == null) {continue;}
post("<strong>" + serv.hostname + "</strong>");
var c = "N";
if (serv.hasAdminRights) {c = "Y";}
post("--Root Access: " + c);
post("--Required hacking skill: " + serv.requiredHackingSkill);
post("--Number of open ports required to NUKE: " + serv.numOpenPortsRequired);
post("--RAM: " + serv.maxRam);
post(" "); post(" ");
} }
*/
}, },
executeFreeCommand: function(commandArray) { executeFreeCommand: function(commandArray) {

@ -1005,23 +1005,40 @@ var Engine = {
var relaySmtpALink = document.getElementById("create-program-relaysmtp"); var relaySmtpALink = document.getElementById("create-program-relaysmtp");
var httpWormALink = document.getElementById("create-program-httpworm"); var httpWormALink = document.getElementById("create-program-httpworm");
var sqlInjectALink = document.getElementById("create-program-sqlinject"); var sqlInjectALink = document.getElementById("create-program-sqlinject");
var deepscanv1ALink = document.getElementById("create-program-deepscanv1");
var deepscanv2ALink = document.getElementById("create-program-deepscanv2");
nukeALink.addEventListener("click", function() { nukeALink.addEventListener("click", function() {
Player.startCreateProgramWork(Programs.NukeProgram, CONSTANTS.MillisecondsPerFiveMinutes, 1); Player.startCreateProgramWork(Programs.NukeProgram, CONSTANTS.MillisecondsPerFiveMinutes, 1);
return false;
}); });
bruteSshALink.addEventListener("click", function() { bruteSshALink.addEventListener("click", function() {
Player.startCreateProgramWork(Programs.BruteSSHProgram, CONSTANTS.MillisecondsPerFiveMinutes * 2, 50); Player.startCreateProgramWork(Programs.BruteSSHProgram, CONSTANTS.MillisecondsPerFiveMinutes * 2, 50);
return false;
}); });
ftpCrackALink.addEventListener("click", function() { ftpCrackALink.addEventListener("click", function() {
Player.startCreateProgramWork(Programs.FTPCrackProgram, CONSTANTS.MillisecondsPerHalfHour, 100); Player.startCreateProgramWork(Programs.FTPCrackProgram, CONSTANTS.MillisecondsPerHalfHour, 100);
return false;
}); });
relaySmtpALink.addEventListener("click", function() { relaySmtpALink.addEventListener("click", function() {
Player.startCreateProgramWork(Programs.RelaySMTPProgram. CONSTANTS.MillisecondsPer2Hours, 250); Player.startCreateProgramWork(Programs.RelaySMTPProgram. CONSTANTS.MillisecondsPer2Hours, 250);
return false;
}); });
httpWormALink.addEventListener("click", function() { httpWormALink.addEventListener("click", function() {
Player.startCreateProgramWork(Programs.HTTPWormProgram, CONSTANTS.MillisecondsPer4Hours, 500); Player.startCreateProgramWork(Programs.HTTPWormProgram, CONSTANTS.MillisecondsPer4Hours, 500);
return false;
}); });
sqlInjectALink.addEventListener("click", function() { sqlInjectALink.addEventListener("click", function() {
Player.startCreateProgramWork(Programs.SQLInjectProgram, CONSTANTS.MillisecondsPer8Hours, 750); Player.startCreateProgramWork(Programs.SQLInjectProgram, CONSTANTS.MillisecondsPer8Hours, 750);
return false;
});
deepscanv1ALink.addEventListener("click", function() {
Player.startCreateProgramWork(Programs.DeepscanV1, CONSTANTS.MillisecondsPerQuarterHour, 75);
return false;
});
deepscanv2ALink.addEventListener("click", function() {
Player.startCreateProgramWork(Programs.DeepscanV2, CONSTANTS.MillisecondsPer2Hours, 400);
return false;
}); });
//Message at the top of terminal //Message at the top of terminal