mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 17:43:48 +01:00
Merge pull request #3431 from Undeemiss/sing-connect-backdoor
Allowed ns.singularity.connect to connect to backdoored servers directly
This commit is contained in:
commit
96d76a84ba
@ -580,6 +580,7 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
|||||||
throw _ctx.helper.makeRuntimeErrorMsg(`Invalid hostname: '${hostname}'`);
|
throw _ctx.helper.makeRuntimeErrorMsg(`Invalid hostname: '${hostname}'`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Home case
|
||||||
if (hostname === "home") {
|
if (hostname === "home") {
|
||||||
player.getCurrentServer().isConnectedTo = false;
|
player.getCurrentServer().isConnectedTo = false;
|
||||||
player.currentServer = player.getHomeComputer().hostname;
|
player.currentServer = player.getHomeComputer().hostname;
|
||||||
@ -588,6 +589,7 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Adjacent server case
|
||||||
const server = player.getCurrentServer();
|
const server = player.getCurrentServer();
|
||||||
for (let i = 0; i < server.serversOnNetwork.length; i++) {
|
for (let i = 0; i < server.serversOnNetwork.length; i++) {
|
||||||
const other = getServerOnNetwork(server, i);
|
const other = getServerOnNetwork(server, i);
|
||||||
@ -601,6 +603,17 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Backdoor case
|
||||||
|
const other = GetServer(hostname);
|
||||||
|
if (other !== null && other instanceof Server && other.backdoorInstalled) {
|
||||||
|
player.getCurrentServer().isConnectedTo = false;
|
||||||
|
player.currentServer = target.hostname;
|
||||||
|
player.getCurrentServer().isConnectedTo = true;
|
||||||
|
Terminal.setcwd("/");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Failure case
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
manualHack: (_ctx: NetscriptContext) =>
|
manualHack: (_ctx: NetscriptContext) =>
|
||||||
|
Loading…
Reference in New Issue
Block a user