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.
This commit is contained in:
David Walker
2026-02-10 08:10:33 -08:00
committed by GitHub
parent bab6280735
commit ed727d6e74

View File

@@ -20,23 +20,20 @@ export const capturePackets = (server: DarknetServer) => {
const vulnerability = server.modelId === ModelIds.packetSniffer ? 8 : 1; const vulnerability = server.modelId === ModelIds.packetSniffer ? 8 : 1;
const passwordInclusionChance = BASE_PASSWORD_INCLUSION_RATE * vulnerability * DIFFICULTY_MODIFIER ** difficulty; const passwordInclusionChance = BASE_PASSWORD_INCLUSION_RATE * vulnerability * DIFFICULTY_MODIFIER ** difficulty;
let captureServer: DarknetServer | null = null;
if (Math.random() < passwordInclusionChance) { if (Math.random() < passwordInclusionChance) {
const intro = Math.floor(Math.random() * 124); captureServer = server;
return `${getRandomData(server, intro)}${server.password}${getRandomData( // eslint-disable-next-line no-dupe-else-if
server, } else if (Math.random() < passwordInclusionChance) {
124 - intro - server.password.length,
)}`;
}
if (Math.random() < passwordInclusionChance) {
const connectedServerName = server.serversOnNetwork[Math.floor(Math.random() * server.serversOnNetwork.length)]; const connectedServerName = server.serversOnNetwork[Math.floor(Math.random() * server.serversOnNetwork.length)];
const connectedServer = getDarknetServer(connectedServerName); captureServer = getDarknetServer(connectedServerName);
if (connectedServer) { }
const intro = Math.floor(Math.random() * 124); if (captureServer) {
return `${getRandomData(server, intro)} ${connectedServerName}:${connectedServer.password} ${getRandomData( const intro = Math.floor(Math.random() * 124);
server, return `${getRandomData(server, intro)} ${captureServer.hostname}:${captureServer.password} ${getRandomData(
124 - intro - connectedServer.password.length - connectedServerName.length, server,
)}`; 124 - intro - captureServer.password.length - captureServer.hostname.length,
} )}`;
} }
return `${getRandomData(server, 124)}`; return `${getRandomData(server, 124)}`;