mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-19 12:45:45 +01:00
Merge pull request #72 from danielyxie/dev
FIxed field work buff. Added AutoLink and ServerProfiler programs. PR…
This commit is contained in:
commit
502f6cf53f
@ -293,3 +293,13 @@ tr:focus {
|
||||
#character-overview-options-button {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* Scan analyze links from AutoLink */
|
||||
.scan-analyze-link {
|
||||
cursor:pointer;
|
||||
color:#FFFFFF;
|
||||
text-decoration:underline;
|
||||
}
|
||||
.scan-analyze-link:hover {
|
||||
text-decoration:none;
|
||||
}
|
||||
|
30
index.html
30
index.html
@ -405,44 +405,52 @@
|
||||
<div id="create-program-container">
|
||||
<p id="create-program-page-text">
|
||||
This page displays any programs that you are able to create. Writing the code for a program takes time, which
|
||||
can vary based on how complex the program is. Once you start working on a program you must see it all the way
|
||||
through. If you cancel before the program is complete you will lose all your progress and have to start all over
|
||||
if you want to code it again.
|
||||
can vary based on how complex the program is. If you are working on creating on a program you can cancel
|
||||
at any time. Your progress will be saved and you can continue later.
|
||||
</p>
|
||||
|
||||
<ul id="create-program-list">
|
||||
<a class="create-program-a-link-button tooltip" id="create-program-nuke" href="#">
|
||||
<a class="create-program-a-link-button tooltip" id="create-program-nuke">
|
||||
NUKE.exe
|
||||
<span class="tooltiptext"> This virus is used to gain root access to a machine if enough ports are opened. </span>
|
||||
</a>
|
||||
<a class="create-program-a-link-button tooltip" id="create-program-brutessh" href="#">
|
||||
<a class="create-program-a-link-button tooltip" id="create-program-brutessh">
|
||||
BruteSSH.exe
|
||||
<span class="tooltiptext"> This program executes a brute force attack that opens SSH ports </span>
|
||||
</a>
|
||||
<a class="create-program-a-link-button tooltip" id="create-program-ftpcrack" href="#">
|
||||
<a class="create-program-a-link-button tooltip" id="create-program-ftpcrack">
|
||||
FTPCrack.exe
|
||||
<span class="tooltiptext"> This program cracks open FTP ports</span>
|
||||
</a>
|
||||
<a class="create-program-a-link-button tooltip" id="create-program-relaysmtp" href="#">
|
||||
<a class="create-program-a-link-button tooltip" id="create-program-relaysmtp">
|
||||
relaySMTP.exe
|
||||
<span class="tooltiptext"> This program opens SMTP ports by redirecting data </span>
|
||||
</a>
|
||||
<a class="create-program-a-link-button tooltip" id="create-program-httpworm" href="#">
|
||||
<a class="create-program-a-link-button tooltip" id="create-program-httpworm">
|
||||
HTTPWorm.exe
|
||||
<span class="tooltiptext"> This virus opens up HTTP ports </span>
|
||||
</a>
|
||||
<a class="create-program-a-link-button tooltip" id="create-program-sqlinject" href="#">
|
||||
<a class="create-program-a-link-button tooltip" id="create-program-sqlinject">
|
||||
SQLInject.exe
|
||||
<span class="tooltiptext"> This virus opens SQL ports</span>
|
||||
</a>
|
||||
<a class="create-program-a-link-button tooltip" id="create-program-deepscanv1" href="#">
|
||||
<a class="create-program-a-link-button tooltip" id="create-program-deepscanv1">
|
||||
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="#">
|
||||
<a class="create-program-a-link-button tooltip" id="create-program-deepscanv2">
|
||||
DeepscanV2.exe
|
||||
<span class="tooltiptext"> This program allows you to use the scan-analyze command with a depth up to 10</span>
|
||||
</a>
|
||||
<a class="create-program-a-link-button tooltip" id="create-program-serverprofiler">
|
||||
ServerProfiler.exe
|
||||
<span class="tooltiptext">This program is used to display hacking and Netscript-related information about servers</span>
|
||||
</a>
|
||||
|
||||
<a class="create-program-a-link-button tooltip" id="create-program-autolink">
|
||||
AutoLink.exe
|
||||
<span class="tooltiptext">This program allows you to directly connect to other servers through the 'scan-analyze' command</span>
|
||||
</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
CONSTANTS = {
|
||||
Version: "0.22.0",
|
||||
Version: "0.22.1",
|
||||
|
||||
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
|
||||
//and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
|
||||
@ -655,6 +655,11 @@ CONSTANTS = {
|
||||
"RAM Upgrades on your home computer",
|
||||
|
||||
Changelog:
|
||||
"v0.22.1<br>" +
|
||||
"-You no longer lose progress on creating programs when cancelling your work. Your progress will be saved and you will pick up " +
|
||||
"where you left off when you start working on it again<br>" +
|
||||
"-Added two new programs: AutoLink.exe and ServerProfiler.exe<br>" +
|
||||
"-Fixed bug with Faction Field work reputation gain<br><br>" +
|
||||
"v0.22.0 - Major rebalancing, optimization, and favor system<br>" +
|
||||
"-Significantly nerfed most augmentations<br>" +
|
||||
"-Almost every server with a required hacking level of 200 or more now has slightly randomized server parameters. This means that after every Augmentation " +
|
||||
@ -673,7 +678,7 @@ CONSTANTS = {
|
||||
"-Added getServerBaseSecurityLevel() Netscript function<br>" +
|
||||
"-New favor system for companies and factions. Earning reputation at a company/faction will give you favor for that entity when you " +
|
||||
"reset after installing an Augmentation. This favor persists through the rest of the game. The more favor you have, the faster you will earn " +
|
||||
"reputation with that faction<br>" +
|
||||
"reputation with that faction/company<br>" +
|
||||
"-You can no longer donate to a faction for reputation until you have 150 favor with that faction<br>" +
|
||||
"-Added unalias Terminal command<br>" +
|
||||
"-Changed requirements for endgame Factions<br><br>" +
|
||||
@ -829,6 +834,11 @@ CONSTANTS = {
|
||||
"-You can now see what an Augmentation does and its price even while its locked<br><br>",
|
||||
|
||||
LatestUpdate:
|
||||
"v0.22.1<br>" +
|
||||
"-You no longer lose progress on creating programs when cancelling your work. Your progress will be saved and you will pick up " +
|
||||
"where you left off when you start working on it again<br>" +
|
||||
"-Added two new programs: AutoLink.exe and ServerProfiler.exe<br>" +
|
||||
"-Fixed bug with Faction Field work reputation gain<br><br>" +
|
||||
"v0.22.0 - Major rebalancing, optimization, and favor system<br>" +
|
||||
"-Significantly nerfed most augmentations<br>" +
|
||||
"-Almost every server with a required hacking level of 200 or more now has slightly randomized server parameters. This means that after every Augmentation " +
|
||||
@ -847,7 +857,7 @@ CONSTANTS = {
|
||||
"-Added getServerBaseSecurityLevel() Netscript function<br>" +
|
||||
"-New favor system for companies and factions. Earning reputation at a company/faction will give you favor for that entity when you " +
|
||||
"reset after installing an Augmentation. This favor persists through the rest of the game. The more favor you have, the faster you will earn " +
|
||||
"reputation with that faction<br>" +
|
||||
"reputation with that faction/company<br>" +
|
||||
"-You can no longer donate to a faction for reputation until you have 150 favor with that faction<br>" +
|
||||
"-Added unalias Terminal command<br>" +
|
||||
"-Changed requirements for endgame Factions<br>",
|
||||
|
@ -8,20 +8,24 @@ Programs = {
|
||||
SQLInjectProgram: "SQLInject.exe",
|
||||
DeepscanV1: "DeepscanV1.exe",
|
||||
DeepscanV2: "DeepscanV2.exe",
|
||||
ServerProfiler: "ServerProfiler.exe",
|
||||
AutoLink: "AutoLink.exe",
|
||||
Flight: "fl1ght.exe",
|
||||
}
|
||||
|
||||
//TODO Right now the times needed to complete work are hard-coded...
|
||||
//maybe later make this dependent on hacking level or something
|
||||
function displayCreateProgramContent() {
|
||||
var nukeALink = document.getElementById("create-program-nuke");
|
||||
var bruteSshALink = document.getElementById("create-program-brutessh");
|
||||
var ftpCrackALink = document.getElementById("create-program-ftpcrack");
|
||||
var relaySmtpALink = document.getElementById("create-program-relaysmtp");
|
||||
var httpWormALink = document.getElementById("create-program-httpworm");
|
||||
var sqlInjectALink = document.getElementById("create-program-sqlinject");
|
||||
var deepscanv1ALink = document.getElementById("create-program-deepscanv1");
|
||||
var deepscanv2ALink = document.getElementById("create-program-deepscanv2");
|
||||
var nukeALink = document.getElementById("create-program-nuke");
|
||||
var bruteSshALink = document.getElementById("create-program-brutessh");
|
||||
var ftpCrackALink = document.getElementById("create-program-ftpcrack");
|
||||
var relaySmtpALink = document.getElementById("create-program-relaysmtp");
|
||||
var httpWormALink = document.getElementById("create-program-httpworm");
|
||||
var sqlInjectALink = document.getElementById("create-program-sqlinject");
|
||||
var deepscanv1ALink = document.getElementById("create-program-deepscanv1");
|
||||
var deepscanv2ALink = document.getElementById("create-program-deepscanv2");
|
||||
var servProfilerALink = document.getElementById("create-program-serverprofiler");
|
||||
var autolinkALink = document.getElementById("create-program-autolink");
|
||||
|
||||
nukeALink.style.display = "none";
|
||||
bruteSshALink.style.display = "none";
|
||||
@ -31,6 +35,8 @@ function displayCreateProgramContent() {
|
||||
sqlInjectALink.style.display = "none";
|
||||
deepscanv1ALink.style.display = "none";
|
||||
deepscanv2ALink.style.display = "none";
|
||||
servProfilerALink.style.display = "none";
|
||||
autolinkALink.style.display = "none";
|
||||
|
||||
//NUKE.exe (in case you delete it lol)
|
||||
if (Player.getHomeComputer().programs.indexOf(Programs.NukeProgram) == -1) {
|
||||
@ -68,55 +74,116 @@ function displayCreateProgramContent() {
|
||||
if (!Player.hasProgram(Programs.DeepscanV2) && Player.hacking_skill >= 400) {
|
||||
deepscanv2ALink.style.display = "inline-block";
|
||||
}
|
||||
//Server profiler
|
||||
if (!Player.hasProgram(Programs.ServerProfiler) && Player.hacking_skill >= 75) {
|
||||
servProfilerALink.style.display = "inline-block";
|
||||
}
|
||||
//Auto Link
|
||||
if (!Player.hasProgram(Programs.AutoLink) && Player.hacking_skill >= 25) {
|
||||
autolinkALink.style.display = "inline-block";
|
||||
}
|
||||
}
|
||||
|
||||
//Returns the number of programs that are currently available to be created
|
||||
function getNumAvailableCreateProgram() {
|
||||
var count = 0;
|
||||
|
||||
//PortHack.exe (in case you delete it lol)
|
||||
if (Player.getHomeComputer().programs.indexOf(Programs.NukeProgram) == -1) {
|
||||
++count;
|
||||
}
|
||||
|
||||
//BruteSSH
|
||||
if (Player.getHomeComputer().programs.indexOf(Programs.BruteSSHProgram) == -1 &&
|
||||
Player.hacking_skill >= 50) {
|
||||
++count;
|
||||
}
|
||||
|
||||
//FTPCrack
|
||||
if (Player.getHomeComputer().programs.indexOf(Programs.FTPCrackProgram) == -1 &&
|
||||
Player.hacking_skill >= 100) {
|
||||
++count;
|
||||
}
|
||||
|
||||
//relaySMTP
|
||||
if (Player.getHomeComputer().programs.indexOf(Programs.RelaySMTPProgram) == -1 &&
|
||||
Player.hacking_skill >= 250) {
|
||||
++count;
|
||||
}
|
||||
|
||||
//HTTPWorm
|
||||
if (Player.getHomeComputer().programs.indexOf(Programs.HTTPWormProgram) == -1 &&
|
||||
Player.hacking_skill >= 500) {
|
||||
++count;
|
||||
}
|
||||
|
||||
//SQLInject
|
||||
if (Player.getHomeComputer().programs.indexOf(Programs.SQLInjectProgram) == -1 &&
|
||||
Player.hacking_skill >= 750) {
|
||||
++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;
|
||||
}
|
||||
|
||||
//Server profiler
|
||||
if (!Player.hasProgram(Programs.ServerProfiler) && Player.hacking_skill >= 75) {
|
||||
++count;
|
||||
}
|
||||
//Auto link
|
||||
if (!Player.hasProgram(Programs.AutoLink) && Player.hacking_skill >= 25) {
|
||||
++count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
function initCreateProgramButtons() {
|
||||
var nukeALink = document.getElementById("create-program-nuke");
|
||||
var bruteSshALink = document.getElementById("create-program-brutessh");
|
||||
var ftpCrackALink = document.getElementById("create-program-ftpcrack");
|
||||
var relaySmtpALink = document.getElementById("create-program-relaysmtp");
|
||||
var httpWormALink = document.getElementById("create-program-httpworm");
|
||||
var sqlInjectALink = document.getElementById("create-program-sqlinject");
|
||||
var deepscanv1ALink = document.getElementById("create-program-deepscanv1");
|
||||
var deepscanv2ALink = document.getElementById("create-program-deepscanv2");
|
||||
var servProfilerALink = document.getElementById("create-program-serverprofiler");
|
||||
var autolinkALink = document.getElementById("create-program-autolink");
|
||||
|
||||
nukeALink.addEventListener("click", function() {
|
||||
Player.startCreateProgramWork(Programs.NukeProgram, CONSTANTS.MillisecondsPerFiveMinutes, 1);
|
||||
return false;
|
||||
});
|
||||
bruteSshALink.addEventListener("click", function() {
|
||||
Player.startCreateProgramWork(Programs.BruteSSHProgram, CONSTANTS.MillisecondsPerFiveMinutes * 2, 50);
|
||||
return false;
|
||||
});
|
||||
ftpCrackALink.addEventListener("click", function() {
|
||||
Player.startCreateProgramWork(Programs.FTPCrackProgram, CONSTANTS.MillisecondsPerHalfHour, 100);
|
||||
return false;
|
||||
});
|
||||
relaySmtpALink.addEventListener("click", function() {
|
||||
Player.startCreateProgramWork(Programs.RelaySMTPProgram, CONSTANTS.MillisecondsPer2Hours, 250);
|
||||
return false;
|
||||
});
|
||||
httpWormALink.addEventListener("click", function() {
|
||||
Player.startCreateProgramWork(Programs.HTTPWormProgram, CONSTANTS.MillisecondsPer4Hours, 500);
|
||||
return false;
|
||||
});
|
||||
sqlInjectALink.addEventListener("click", function() {
|
||||
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;
|
||||
});
|
||||
servProfilerALink.addEventListener("click", function() {
|
||||
Player.startCreateProgramWork(Programs.ServerProfiler, CONSTANTS.MillisecondsPerHalfHour, 75);
|
||||
return false;
|
||||
});
|
||||
autolinkALink.addEventListener("click", function() {
|
||||
Player.startCreateProgramWork(Programs.AutoLink, CONSTANTS.MillisecondsPerQuarterHour, 25);
|
||||
return false;
|
||||
});
|
||||
}
|
@ -680,7 +680,7 @@ PlayerObject.prototype.startFactionFieldWork = function(faction) {
|
||||
this.workChaExpGainRate = .1 * this.charisma_exp_mult;
|
||||
this.workRepGainRate = this.getFactionFieldWorkRepGain();
|
||||
|
||||
this.factionWorkType = CONSTANTS.factionWorkField;
|
||||
this.factionWorkType = CONSTANTS.FactionWorkField;
|
||||
this.currentWorkFactionDescription = "carrying out field missions"
|
||||
|
||||
this.startFactionWork(faction);
|
||||
@ -855,7 +855,20 @@ PlayerObject.prototype.startCreateProgramWork = function(programName, time, reqL
|
||||
var timeMultiplier = (CONSTANTS.MaxSkillLevel - (this.hacking_skill - reqLevel)) / CONSTANTS.MaxSkillLevel;
|
||||
if (timeMultiplier > 1) {timeMultiplier = 1;}
|
||||
if (timeMultiplier < 0.01) {timeMultiplier = 0.01;}
|
||||
|
||||
this.timeNeededToCompleteWork = timeMultiplier * time;
|
||||
//Check for incomplete program
|
||||
for (var i = 0; i < Player.getHomeComputer().programs.length; ++i) {
|
||||
var programFile = Player.getHomeComputer().programs[i];
|
||||
if (programFile.startsWith(programName) && programFile.endsWith("%-INC")) {
|
||||
var res = programFile.split("-");
|
||||
if (res.length != 3) {break;}
|
||||
var percComplete = Number(res[1].slice(0, -1));
|
||||
if (isNaN(percComplete) || percComplete <= 0 || percComplete >= 100) {break;}
|
||||
this.timeWorked = percComplete / 100 * this.timeNeededToCompleteWork;
|
||||
Player.getHomeComputer().programs.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
this.createProgramName = programName;
|
||||
|
||||
@ -882,7 +895,7 @@ PlayerObject.prototype.createProgramWork = function(numCycles) {
|
||||
txt.innerHTML = "You are currently working on coding " + programName + ".<br><br> " +
|
||||
"You have been working for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "<br><br>" +
|
||||
"The program is " + (this.timeWorked / this.timeNeededToCompleteWork * 100).toFixed(2) + "% complete. <br>" +
|
||||
"If you cancel, you will lose all of your progress.";
|
||||
"If you cancel, your work will be saved and you can come back to complete the program later.";
|
||||
}
|
||||
|
||||
PlayerObject.prototype.finishCreateProgramWork = function(cancelled, programName) {
|
||||
@ -891,6 +904,10 @@ PlayerObject.prototype.finishCreateProgramWork = function(cancelled, programName
|
||||
"The new program can be found on your home computer.");
|
||||
|
||||
Player.getHomeComputer().programs.push(programName);
|
||||
} else {
|
||||
var perc = Math.floor(this.timeWorked / this.timeNeededToCompleteWork * 100).toString();
|
||||
var incompleteName = programName + "-" + perc + "%-INC";
|
||||
Player.getHomeComputer().programs.push(incompleteName);
|
||||
}
|
||||
|
||||
var mainMenu = document.getElementById("mainmenu-container");
|
||||
|
@ -83,7 +83,8 @@ loadGame = function(saveObj) {
|
||||
try {
|
||||
var ver = JSON.parse(saveObj.VersionSave, Reviver);
|
||||
if (ver != CONSTANTS.Version) {
|
||||
if (CONSTANTS.Version == "0.21.0" || CONSTANTS.Version == "0.22.0") {
|
||||
if (CONSTANTS.Version == "0.21.0" || CONSTANTS.Version == "0.22.0" ||
|
||||
CONSTANTS.Version == "0.22.1") {
|
||||
dialogBoxCreate("All scripts automatically killed for the sake of compatibility " +
|
||||
"with new version. If the game is still broken, try the following: " +
|
||||
"Options -> Soft Reset -> Save Game -> Reload page. If that STILL " +
|
||||
@ -155,7 +156,8 @@ loadImportedGame = function(saveObj, saveString) {
|
||||
}
|
||||
|
||||
if (ver != CONSTANTS.Version) {
|
||||
if (CONSTANTS.Version == "0.21.0") {
|
||||
if (CONSTANTS.Version == "0.21.0" || CONSTANTS.Version == "0.22.0" ||
|
||||
CONSTANTS.Version == "0.22.1") {
|
||||
console.log("here");
|
||||
//This is the big update that might break games. Kill all running scripts
|
||||
for (var ip in tempAllServers) {
|
||||
|
@ -150,6 +150,7 @@ Script.prototype.updateRamUsage = function() {
|
||||
var getHackingLevelCount = numOccurrences(codeCopy, "getHackingLevel(");
|
||||
var getServerMoneyAvailableCount = numOccurrences(codeCopy, "getServerMoneyAvailable(");
|
||||
var getServerSecurityCount = numOccurrences(codeCopy, "getServerSecurityLevel(");
|
||||
var getServerBaseSecurityCount = numOccurrences(codeCopy, "getServerBaseSecurityLevel(");
|
||||
var getServerReqdHackingCount = numOccurrences(codeCopy, "getServerRequiredHackingLevel(");
|
||||
var fileExistsCount = numOccurrences(codeCopy, "fileExists(");
|
||||
var isRunningCount = numOccurrences(codeCopy, "isRunning(");
|
||||
@ -181,6 +182,7 @@ Script.prototype.updateRamUsage = function() {
|
||||
(getHackingLevelCount * CONSTANTS.ScriptGetHackingLevelRamCost) +
|
||||
(getServerMoneyAvailableCount * CONSTANTS.ScriptGetServerMoneyRamCost) +
|
||||
(getServerSecurityCount * CONSTANTS.ScriptGetServerSecurityRamCost) +
|
||||
(getServerBaseSecurityCount * CONSTANTS.ScriptGetServerSecurityRamCost) +
|
||||
(getServerReqdHackingCount * CONSTANTS.ScriptGetServerReqdHackRamCost) +
|
||||
(fileExistsCount * CONSTANTS.ScriptFileExistsRamCost) +
|
||||
(isRunningCount * CONSTANTS.ScriptIsRunningRamCost) +
|
||||
|
@ -1,8 +1,13 @@
|
||||
//Terminal
|
||||
|
||||
/* Write text to terminal */
|
||||
var post = function(input) {
|
||||
$("#terminal-input").before('<tr class="posted"><td style="color: var(--my-font-color); background-color: var(--my-background-color);">' + input.replace( / /g, " " ) + '</td></tr>');
|
||||
var post = function(input, replace=true) {
|
||||
if (replace) {
|
||||
$("#terminal-input").before('<tr class="posted"><td style="color: var(--my-font-color); background-color: var(--my-background-color);">' + input.replace( / /g, " " ) + '</td></tr>');
|
||||
} else {
|
||||
$("#terminal-input").before('<tr class="posted"><td style="color: var(--my-font-color); background-color: var(--my-background-color);">' + input + '</td></tr>');
|
||||
}
|
||||
|
||||
updateTerminalScroll();
|
||||
}
|
||||
|
||||
@ -669,13 +674,7 @@ var Terminal = {
|
||||
|
||||
for (var i = 0; i < Player.getCurrentServer().serversOnNetwork.length; i++) {
|
||||
if (Player.getCurrentServer().getServerOnNetwork(i).ip == ip || Player.getCurrentServer().getServerOnNetwork(i).hostname == ip) {
|
||||
Player.getCurrentServer().isConnectedTo = false;
|
||||
Player.currentServer = Player.getCurrentServer().getServerOnNetwork(i).ip;
|
||||
Player.getCurrentServer().isConnectedTo = true;
|
||||
post("Connected to " + ip);
|
||||
if (Player.getCurrentServer().hostname == "darkweb") {
|
||||
checkIfConnectedToDarkweb(); //Posts a 'help' message if connecting to dark web
|
||||
}
|
||||
Terminal.connectToServer(ip);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1060,6 +1059,22 @@ var Terminal = {
|
||||
}
|
||||
},
|
||||
|
||||
connectToServer: function(ip) {
|
||||
console.log("Connect to server called");
|
||||
var serv = getServer(ip);
|
||||
if (serv == null) {
|
||||
post("Invalid server. Connection failed.");
|
||||
return;
|
||||
}
|
||||
Player.getCurrentServer().isConnectedTo = false;
|
||||
Player.currentServer = serv.ip;
|
||||
Player.getCurrentServer().isConnectedTo = true;
|
||||
post("Connected to " + serv.hostname);
|
||||
if (Player.getCurrentServer().hostname == "darkweb") {
|
||||
checkIfConnectedToDarkweb(); //Posts a 'help' message if connecting to dark web
|
||||
}
|
||||
},
|
||||
|
||||
executeListCommand: function(commandArray) {
|
||||
if (commandArray.length != 1) {
|
||||
post("Incorrect usage of ls command. Usage: ls"); return;
|
||||
@ -1146,7 +1161,12 @@ var Terminal = {
|
||||
}
|
||||
if (d == 0) {continue;} //Don't print current server
|
||||
var titleDashes = Array((d-1) * 4 + 1).join("-");
|
||||
post("<strong>" + titleDashes + ">" + s.hostname + "</strong>");
|
||||
if (Player.hasProgram(Programs.AutoLink)) {
|
||||
post("<strong>" + titleDashes + "> <a class='scan-analyze-link'>" + s.hostname + "</a></strong>", false);
|
||||
} else {
|
||||
post("<strong>" + titleDashes + ">" + s.hostname + "</strong>");
|
||||
}
|
||||
|
||||
var dashes = titleDashes + "--";
|
||||
//var dashes = Array(d * 2 + 1).join("-");
|
||||
var c = "NO";
|
||||
@ -1156,6 +1176,17 @@ var Terminal = {
|
||||
post(dashes + "RAM: " + s.maxRam);
|
||||
post(" ");
|
||||
}
|
||||
|
||||
var links = document.getElementsByClassName("scan-analyze-link");
|
||||
for (var i = 0; i < links.length; ++i) {
|
||||
(function() {
|
||||
var hostname = links[i].innerHTML.toString();
|
||||
links[i].onclick = function() {
|
||||
Terminal.connectToServer(hostname);
|
||||
}
|
||||
}());//Immediate invocation
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
executeFreeCommand: function(commandArray) {
|
||||
@ -1172,18 +1203,27 @@ var Terminal = {
|
||||
runProgram: function(programName) {
|
||||
//Check if you have the program on your computer. If you do, execute it, otherwise
|
||||
//display an error message
|
||||
for (var i = 0; i < Player.getHomeComputer().programs.length; i++) {
|
||||
if (Player.getHomeComputer().programs[i] == programName) {
|
||||
Terminal.executeProgram(programName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
var splitArgs = programName.split(" ");
|
||||
var name = " ";
|
||||
if (splitArgs.length > 1) {
|
||||
name = splitArgs[0];
|
||||
} else {
|
||||
name = programName;
|
||||
}
|
||||
if (Player.hasProgram(name)) {
|
||||
Terminal.executeProgram(programName);
|
||||
return;
|
||||
}
|
||||
post("ERROR: No such executable on home computer (Only programs that exist on your home computer can be run)");
|
||||
},
|
||||
|
||||
//Contains the implementations of all possible programs
|
||||
executeProgram: function(programName) {
|
||||
var s = Player.getCurrentServer();
|
||||
var splitArgs = programName.split(" ");
|
||||
if (splitArgs.length > 1) {
|
||||
programName = splitArgs[0];
|
||||
}
|
||||
switch (programName) {
|
||||
case Programs.NukeProgram:
|
||||
if (s.hasAdminRights) {
|
||||
@ -1242,9 +1282,27 @@ var Terminal = {
|
||||
post("Opened SQL Port (1433)!");
|
||||
++s.openPortCount;
|
||||
}
|
||||
break;
|
||||
case Programs.ServerProfiler:
|
||||
if (splitArgs.length != 2) {
|
||||
post("Must pass a server hostname or IP as an argument for ServerProfiler.exe");
|
||||
return;
|
||||
}
|
||||
var serv = getServer(splitArgs[1]);
|
||||
if (serv == null) {
|
||||
post("Invalid server IP/hostname");
|
||||
return;
|
||||
}
|
||||
post(serv.hostname + ":");
|
||||
post("Server base security level: " + serv.baseDifficulty);
|
||||
post("Server current security level: " + serv.hackDifficulty);
|
||||
post("Server growth rate: " + serv.serverGrowth);
|
||||
post("Netscript hack() execution time: " + formatNumber(scriptCalculateHackingTime(serv), 1) + "s");
|
||||
post("Netscript grow() execution time: " + formatNumber(scriptCalculateGrowTime(serv)/1000, 1) + "s");
|
||||
post("Netscript weaken() execution time: " + formatNumber(scriptCalculateWeakenTime(serv)/1000, 1) + "s");
|
||||
break;
|
||||
default:
|
||||
post("Executable not found");
|
||||
post("Invalid executable. Cannot be run");
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
@ -938,47 +938,7 @@ var Engine = {
|
||||
});
|
||||
|
||||
//Create Program buttons
|
||||
var nukeALink = document.getElementById("create-program-nuke");
|
||||
var bruteSshALink = document.getElementById("create-program-brutessh");
|
||||
var ftpCrackALink = document.getElementById("create-program-ftpcrack");
|
||||
var relaySmtpALink = document.getElementById("create-program-relaysmtp");
|
||||
var httpWormALink = document.getElementById("create-program-httpworm");
|
||||
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() {
|
||||
Player.startCreateProgramWork(Programs.NukeProgram, CONSTANTS.MillisecondsPerFiveMinutes, 1);
|
||||
return false;
|
||||
});
|
||||
bruteSshALink.addEventListener("click", function() {
|
||||
Player.startCreateProgramWork(Programs.BruteSSHProgram, CONSTANTS.MillisecondsPerFiveMinutes * 2, 50);
|
||||
return false;
|
||||
});
|
||||
ftpCrackALink.addEventListener("click", function() {
|
||||
Player.startCreateProgramWork(Programs.FTPCrackProgram, CONSTANTS.MillisecondsPerHalfHour, 100);
|
||||
return false;
|
||||
});
|
||||
relaySmtpALink.addEventListener("click", function() {
|
||||
Player.startCreateProgramWork(Programs.RelaySMTPProgram, CONSTANTS.MillisecondsPer2Hours, 250);
|
||||
return false;
|
||||
});
|
||||
httpWormALink.addEventListener("click", function() {
|
||||
Player.startCreateProgramWork(Programs.HTTPWormProgram, CONSTANTS.MillisecondsPer4Hours, 500);
|
||||
return false;
|
||||
});
|
||||
sqlInjectALink.addEventListener("click", function() {
|
||||
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;
|
||||
});
|
||||
initCreateProgramButtons();
|
||||
|
||||
//Message at the top of terminal
|
||||
postNetburnerText();
|
||||
|
Loading…
Reference in New Issue
Block a user