From ed727d6e74454a17e34c8cbd3bf66a7975586552 Mon Sep 17 00:00:00 2001 From: David Walker Date: Tue, 10 Feb 2026 08:10:33 -0800 Subject: [PATCH] DARKNET: Buff packet sniffing slightly (#2485) Refactor the sniff code so that successful sniffs for the current server are tagged server_name:password, not just those for adjacent servers. --- src/DarkNet/models/packetSniffing.ts | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/DarkNet/models/packetSniffing.ts b/src/DarkNet/models/packetSniffing.ts index fa516eda0..3f40ec04e 100644 --- a/src/DarkNet/models/packetSniffing.ts +++ b/src/DarkNet/models/packetSniffing.ts @@ -20,23 +20,20 @@ export const capturePackets = (server: DarknetServer) => { const vulnerability = server.modelId === ModelIds.packetSniffer ? 8 : 1; const passwordInclusionChance = BASE_PASSWORD_INCLUSION_RATE * vulnerability * DIFFICULTY_MODIFIER ** difficulty; + let captureServer: DarknetServer | null = null; if (Math.random() < passwordInclusionChance) { - const intro = Math.floor(Math.random() * 124); - return `${getRandomData(server, intro)}${server.password}${getRandomData( - server, - 124 - intro - server.password.length, - )}`; - } - if (Math.random() < passwordInclusionChance) { + captureServer = server; + // eslint-disable-next-line no-dupe-else-if + } else if (Math.random() < passwordInclusionChance) { const connectedServerName = server.serversOnNetwork[Math.floor(Math.random() * server.serversOnNetwork.length)]; - const connectedServer = getDarknetServer(connectedServerName); - if (connectedServer) { - const intro = Math.floor(Math.random() * 124); - return `${getRandomData(server, intro)} ${connectedServerName}:${connectedServer.password} ${getRandomData( - server, - 124 - intro - connectedServer.password.length - connectedServerName.length, - )}`; - } + captureServer = getDarknetServer(connectedServerName); + } + if (captureServer) { + const intro = Math.floor(Math.random() * 124); + return `${getRandomData(server, intro)} ${captureServer.hostname}:${captureServer.password} ${getRandomData( + server, + 124 - intro - captureServer.password.length - captureServer.hostname.length, + )}`; } return `${getRandomData(server, 124)}`;