analyze and ServerProfiler.exe handle hacknet servers better.

This commit is contained in:
Olivier Gagnon 2021-05-03 02:20:31 -04:00
parent 136d769d55
commit d422028737

@ -575,47 +575,26 @@ let Terminal = {
let currServ = Player.getCurrentServer(); let currServ = Player.getCurrentServer();
const isHacknet = currServ instanceof HacknetServer; const isHacknet = currServ instanceof HacknetServer;
post(currServ.hostname + ": "); post(currServ.hostname + ": ");
post("Organization name: " + currServ.organizationName); const org = currServ.organizationName
var rootAccess = ""; post("Organization name: " + (!isHacknet ? org : "Player"));
if (currServ.hasAdminRights) {rootAccess = "YES";} const admin = currServ.hasAdminRights;
else {rootAccess = "NO";} post("Root Access: " + (!isHacknet ? "YES" : "NO"));
post("Root Access: " + rootAccess); const hackingSkill = currServ.requiredHackingSkill
if (!isHacknet) { post("Required hacking skill: " + currServ.requiredHackingSkill); } post("Required hacking skill: " + (!isHacknet ? hackingSkill : "N/A"));
post("Server security level: " + numeralWrapper.formatServerSecurity(currServ.hackDifficulty)); const security = currServ.hackDifficulty;
post("Chance to hack: " + numeralWrapper.formatPercentage(calculateHackingChance(currServ, Player))); post("Server security level: " + (!isHacknet ? numeralWrapper.formatServerSecurity(security) : "N/A"));
post("Time to hack: " + convertTimeMsToTimeElapsedString(calculateHackingTime(currServ, Player)*1000, true)); const hackingChance = calculateHackingChance(currServ, Player)
postElement(<>Total money available on server: {Money(currServ.moneyAvailable)}</>); post("Chance to hack: " + (!isHacknet ? numeralWrapper.formatPercentage(hackingChance) : "N/A"));
if (!isHacknet) { post("Required number of open ports for NUKE: " + currServ.numOpenPortsRequired); } const hackingTime = calculateHackingTime(currServ, Player)*1000;
post("Time to hack: " + (!isHacknet ? convertTimeMsToTimeElapsedString(hackingTime, true) : "N/A"));
if (currServ.sshPortOpen) { postElement(<>Total money available on server: {!isHacknet ? Money(currServ.moneyAvailable) : "N/A"}</>);
post("SSH port: Open") const numPort = currServ.numOpenPortsRequired;
} else { post("Required number of open ports for NUKE: " + (!isHacknet ? numPort : "N/A"));
post("SSH port: Closed") post("SSH port: "+ (currServ.sshPortOpen ? "Open" : "Closed"))
} post("FTP port: "+ (currServ.ftpPortOpen ? "Open" : "Closed"))
post("SMTP port: "+ (currServ.smtpPortOpen ? "Open" : "Closed"))
if (currServ.ftpPortOpen) { post("HTTP port: "+ (currServ.httpPortOpen ? "Open" : "Closed"))
post("FTP port: Open") post("SQL port: "+ (currServ.sqlPortOpen ? "Open" : "Closed"))
} else {
post("FTP port: Closed")
}
if (currServ.smtpPortOpen) {
post("SMTP port: Open")
} else {
post("SMTP port: Closed")
}
if (currServ.httpPortOpen) {
post("HTTP port: Open")
} else {
post("HTTP port: Closed")
}
if (currServ.sqlPortOpen) {
post("SQL port: Open")
} else {
post("SQL port: Closed")
}
} }
Terminal.analyzeFlag = false; Terminal.analyzeFlag = false;
}, },
@ -2149,6 +2128,12 @@ let Terminal = {
post("Invalid server IP/hostname"); post("Invalid server IP/hostname");
return; return;
} }
if(targetServer instanceof HacknetServer) {
post(`${Programs.ServerProfiler.name} cannot be run on a Hacknet Server.`);
return
}
post(targetServer.hostname + ":"); post(targetServer.hostname + ":");
post("Server base security level: " + targetServer.baseDifficulty); post("Server base security level: " + targetServer.baseDifficulty);
post("Server current security level: " + targetServer.hackDifficulty); post("Server current security level: " + targetServer.hackDifficulty);