mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-16 06:18:42 +02:00
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:
@@ -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)}`;
|
||||
|
||||
Reference in New Issue
Block a user