diff --git a/src/Terminal/HelpText.ts b/src/Terminal/HelpText.ts index 678e817bd..ad56946aa 100644 --- a/src/Terminal/HelpText.ts +++ b/src/Terminal/HelpText.ts @@ -191,8 +191,8 @@ export const HelpTexts: IMap = { "Usage: connect [hostname]", " ", "Connect to a remote server. The hostname of the remote server must be given as the argument ", - "to this command. Note that only servers that are immediately adjacent to the current server in the network can be connected to. To ", - "see which servers can be connected to, use the 'scan' command.", + "to this command. Note that only servers that are immediately adjacent to the current server in the network and the ones that have", + "a backdoor installed can be connected to. To see which servers can be connected to, use the 'scan' command.", " ", ], cp: ["Usage: cp [src] [dst]", " ", "Copy a file on this server. To copy a file to another server use scp.", " "], diff --git a/src/Terminal/determineAllPossibilitiesForTabCompletion.ts b/src/Terminal/determineAllPossibilitiesForTabCompletion.ts index 85b5f0754..e7a926d33 100644 --- a/src/Terminal/determineAllPossibilitiesForTabCompletion.ts +++ b/src/Terminal/determineAllPossibilitiesForTabCompletion.ts @@ -4,7 +4,8 @@ import { getSubdirectories } from "./DirectoryServerHelpers"; import { Aliases, GlobalAliases, substituteAliases } from "../Alias"; import { DarkWebItems } from "../DarkWeb/DarkWebItems"; import { IPlayer } from "../PersonObjects/IPlayer"; -import { GetServer, GetAllServers } from "../Server/AllServers"; +import { GetAllServers } from "../Server/AllServers"; +import { Server } from "../Server/Server"; import { ParseCommand, ParseCommands } from "./Parser"; import { HelpTexts } from "./HelpText"; import { isScriptFilename } from "../Script/isScriptFilename"; @@ -238,16 +239,14 @@ export async function determineAllPossibilitiesForTabCompletion( } if (isCommand("connect")) { - // All network connections - for (let i = 0; i < currServ.serversOnNetwork.length; ++i) { - const serv = GetServer(currServ.serversOnNetwork[i]); - if (serv == null) { - continue; - } - allPos.push(serv.hostname); - } + // All directly connected and backdoored servers are reachable - return allPos; + return GetAllServers() + .filter( + (server) => + currServ.serversOnNetwork.includes(server.hostname) || (server instanceof Server && server.backdoorInstalled), + ) + .map((server) => server.hostname); } if (isCommand("nano") || isCommand("vim")) {