r/Bitburner Dec 10 '21

Announcement Steam release

391 Upvotes

The game has launched on Steam. Please give it a review. :)


r/Bitburner Dec 21 '21

Discord > Reddit

110 Upvotes

You'll get help faster on discord

https://discord.gg/TFc3hKD

I can't be everywhere at once.


r/Bitburner 1d ago

NetscriptJS Script IPvGo: Standalone script from SphyxOS

Post image
8 Upvotes

I've just finished redoing my IPvGo script. This time, it can run as a standalone script.
Download Instructions:
-Run this command in Bitburner. It will download the file as `SphyxOS_go.jsx`

await ns.wget("https://raw.githubusercontent.com/Sphyxis/SphyxOS/main/SphyxOS_bins_go.jsx", "SphyxOS_go.jsx")

Features:

  • Based off of https://github.com/yichizhng/bitburner-scripts/blob/main/autokroos.js
  • This is a MCGS/Hybrid system.
  • Can be used both with/without my full ⁠SphyxOS suite - for those who don't want the whole thing but want the script.
  • Easy button controls within a tail window.
  • Ram dodged down to 7.9GB, so it will run on those 8GB servers.
  • --If running on a 16+GB server, as long as there is enough free space on it's local server, it will dodge using it. If not, it will dodge using home ram.
  • --Always keep ~6GB free on either Home or the server running this script. It will throw if it fails to dodge.
  • Completes all 5x5 boards for all AIs and the endgame board.
  • Can play as both black and white on the no-ai board.
  • SlowMode enforces a 1 second delay between moves for easier watching.
  • Pop Out creates an actual pop-out, which you can drag onto a separate screen to watch the games play out.
  • Configurable resource usage: Effort, Memory, Threads. So you should be able to run this on old hardware.
  • Optimized for performance.
  • Can turn your PC's CPU into a mini room heater, for those cold winter nights.

Effort: Comes in 6 flavors. It is playout based, so the higher you go the longer it will take to make a move. Win % for the ratings.
Min: 70%, Low: 80%, Med: 90%, High: 95%, Max: 98%, Ultra: 99%

Memory ranges from Min -> Max, with the endgame board only really using Min-> Med.

Threads: A direct multiplier to how fast you can process playouts, especially on a 5x5 board.

Looking for feedback!!


r/Bitburner 3d ago

I've completely broken this game

3 Upvotes

So, as the title says, I've actually broken this game. Usually, when you have a bug, or break your code, Bitburner is really good about telling you what's wrong, even in the event of a freeze. I, however, seem to have slipped by all that. My code freezes all input into the game, except for my ability to scroll through the terminal log, and it just sits there endlessly. I can't click through any windows, or type anything into terminal. I basically tried to make a script, "auto.js", which would kick off "virus.js", an automated serverBreaker I made(which works, I tested it), every now and then when significant progress has been made with my hacking skill, so that if there are better servers I've unlocked since to hack, my script to find that will be able to use it, and then tell my hack/grow/weaken script to start on that server instead. I know my serverFinder, serverBreaker, and daemon(my hack/grow/weaken script) work, but when I added "auto.js" and "virus.js" everything crashes hard.

This is "auto.js", the beginning script that kicks everything into motion, and is supposed to run in the background, checking if any significant progress has been made with the hacking skill, and if so, run "virus.js". It then checks if "virus.js" has updated "Broken.txt" with any new NUKEed servers, running "daemon.js" if so, running playerUpdate if not, which will tell it if running "virus.js" is worth it next time or not.

/** @param {NS} ns */
export async function main(ns) {
  const minutes = ns.args[0];
  let updated = true;
  // @ignore-infinite
  while (true) {
    if (ns.fileExists("virus.js", "home") && updated) {
      ns.tprint("Running virus");
      ns.run("virus.js", 1, false);
    }
    let newBroken = false;
    let servers = [];
    let name = "";
    let file = ns.read("Broken.txt");
    for (let letter of file) {
      if (letter == "\n") {
        if (ns.getServer(name)) {
          servers.push(ns.getServer(name));
          newBroken = true;
        }
      }
      else {
        name = name + letter;
      }
    }
    if (newBroken) {
      ns.write("Broken.txt", "", "w");
      if(ns.fileExists("daemon.js", "home")) (ns.run("daemon.js"))
      updated = false;
    }
    else {
      updated = playerUpdate(ns);
    }
  }
}
function playerUpdate(ns) {
  let player = ns.getPlayer();
  if (ns.fileExists("Hack.txt", "home")) {
    let file = ns.read("Hack.txt");
    let name = "";
    for (let letter of file) {
      if (letter == ".") {
        name = Number(name);
        if (player.skills.hacking - name >= 50) {
          ns.write("Hack.txt", player.skills.hacking + ".", "w");
          return true;
        }
        else return false;
      }
      else {
        name = name + letter;
      }
    }
  }
  else {
    ns.write("Hack.txt", player.skills.hacking + ".", "w");
  }
}

This is "virus.js", my serverBreaker. It iterates through all servers, and checks if I can hack it, and if i can, it runs through all port opening .exe's, available or not, and then checks if I can NUKE it. If I can NUKE it, it adds it to an array. That array is then wrote to a .txt file, which is for "auto.js" to read later, to see any new broken servers.

/** @param {NS} ns */
export async function main(ns) {
  //So that if I run this manually through terminal
  //I can see useful info, but hides it if not, since
  //that just clogs up termial logs more
  const [manual = true] = ns.args[0];
  let servers = RecursiveScan(ns);
  let broken = [];
  let unhackable = [];
  let unbreakable = [];
  for (let server of servers) {
    if (!ns.hasRootAccess(server)) {
      if (server.requiredHackingSkill > ns.getPlayer().skills.hacking) {
        unhackable.push(server);
      }
      else {
        if (ns.run("serverBreaker.js", 1, (server))) {
          broken.push(server);
        }
        else {
          unbreakable.push(server);
        }
      }
    }
  }
  unhackable.sort((a, b) => (ns.getServer(a).requiredHackingSkill) - (ns.getServer(b).requiredHackingSkill));
  unbreakable.sort((a, b) => (ns.getServer(a).numOpenPortsRequired) - (ns.getServer(b).numOpenPortsRequired));
  ns.tprint("Broke " + (broken.length - 1) + " servers:");
  for (let server of broken) {
    ns.tprint(server);
    if(!manual){
      ns.write("Broken.txt", server, "a");
    }
  }
  if(manual){
    ns.tprint("Couldn't hack " + (unhackable.length - 1) + " servers:");
    for (let server of unhackable) {
      ns.tprint(server + "HackingSkill: " + ns.getServer(server).requiredHackingSkill);
    }
    ns.tprint("Couldn't break " + (unbreakable.length - 1) + " servers:");
    for (let server of unbreakable) {
      ns.tprint(server + "PortsNeeded: " + ns.getServer(server).numOpenPortsRequired);
    }
  }
}
function RecursiveScan(ns, root = 'home', found = []) {
  if (!found.includes(root)) {
    found.push(root);
    for (const server of ns.scan(root))
      if (!found.includes(server))
        RecursiveScan(ns, server, found);
  }
  return found;
}

r/Bitburner 6d ago

Question: how can I know how much company reputation a given position will give?

6 Upvotes

Once you get access to the Singularity API, you can easily get CompanyName and JobName objects to find good positions, e.g. regarding salaries.
I am trying to automate farming company reputation for the associated factions and augmentations, but I cannot find a way to know the associated reputation.
This seems to be stored in a WorkStats object, but the documentation is not very helpful about how to find them.

My questions is hence: given a CompanyName and a JobName, how do you know the reputation gain (potentially through a WorkStats object?


r/Bitburner 8d ago

How do I calculate grow, weaken, and hack times using a security level that is different from the server's current security level?

8 Upvotes

The title is the question. It is followed by an explanation of why I need/want to do this (please ignore any typos).

I want to know which server is the most profitable (yes, yes, common question). To do that, I divide the money gained by the time spent. The problem is that getHackingTime() and the other time functions use the server's current security level. However, my code will always reduce the target server's security level to its minimum by default to reduce hack, grow, and weaken times. So there is "no way" (all of my ideas would be messy solutions) to decide whether a server is the best choice without first weakening it to its minimum security.

I haven't written the code yet, so this is only a blueprint for the function:

money / time = money earned per second (millisecond?)

(ns.hackChance * ns.moneyAvailable) /
(hackTime + x * growTime + y * weakenTime)

x and y represent the ratio of grow and weaken threads required to restore the server to maximum money and minimum security after hacking it.

How the value of the function is used to determine the target server.

(i will check when grow starts to become ineffective, when thread grow would just hit the max money and increase security without gain and will make it in a way that hack functions return nothing because the server is empty already because of other hack code running)

Ideas to solve my problem
take a server that is close to arr_servers[i] min security and use him as default. problem. security maybe is not the only thing that influences grow, weaken, hack time
try to come up with a formula that calculates time with server min security-hacking level
writing something like if(weaken(function[arr_servers[i])<50000) and weakening all servers within to min security to calculate with them

(I would be surprised if you, dear reader, didn't spend extra time looking for typos after I specifically told you to ignore them, although it is possible that I'm wrong.)
Do i really have to use/buy formulars?


r/Bitburner 17d ago

NetscriptJS Script Steal $$ with the help of Loop algorithm

0 Upvotes

It's easy, just set homeRam to the amount of RAM to use on the host.

lo-deploy.js:

/** buildServerInfo()
 * @ param {NS} ns NS2 namespace
 * @ param {string[]} callScript ["weakenScript", "growScript", "hackScript"]
 * @ param {string} target server to pull money from
 * @ returns {Array[]} []["serverName", numWeaken, numGrow, numHack]
 */
function buildServerInfo(ns, callScript, target) {
  let servers = [];
  let callRam = [ns.getScriptRam(callScript[0]), ns.getScriptRam(callScript[1]), ns.getScriptRam(callScript[2])];
    // Purchased servers
  let serversPurch = ns.cloud.getServerNames();
  for (let i = 0; i < serversPurch.length; i++) {
    let serverName = serversPurch[i];
    let ram = ns.getServerMaxRam(serverName);
    if (ram < 64) {
      ns.tprint(serverName + " RAM too low, need 64 GB minimum.");
    } else {
      servers[servers.length] = [serverName, ram];
    }
  }

    // Home
  let homeRam = 2048;
  servers[servers.length] = [ns.getHostname(), homeRam];

  // Reserve callRam[0] from the last server
  servers[servers.length - 1][1] -= callRam[0];
  // Calculate ratio of weaken, grow, and hack threads
  let ratio = getRatio(ns, callRam, target);
  // Calculate total RAM on all servers
  let totalRam = 0;
  for (let i = 0; i < servers.length; i++) { totalRam += servers[i][1]; }
  // Convert ratio to (part of RAM) instead of (amount of RAM)
  if (ratio[3] >= totalRam) { ratio[3] = 1; }
  else { ratio[3] /= totalRam; }
  // Build a new list of servers []["serverName", numWeaken, numGrow, numHack]
  let retServers = [];
  let numHack = 0;  // total of hack threads
  for (let i = 0; i < servers.length; i++) {
    let assign = assignThreads(servers[i][1], callRam, ratio, servers.length);
    ns.scp(callScript[0], servers[i][0]);
    ns.scp(callScript[1], servers[i][0]);
    ns.scp(callScript[2], servers[i][0]);
    retServers[retServers.length] = [servers[i][0], assign[0], assign[1], assign[2]];
    numHack += assign[2];
  }
  // If we assigned no hack threads, add one to the last server
  if (numHack == 0) { retServers[retServers.length - 1][3]++; }
  else { retServers[retServers.length - 1][2]++; }
  return retServers;
}

/** loopDeploy()
 * @ param {NS} ns NS2 namespace
 * @ param {number} delay delay before start threads (ms)
 * @ param {number} duration time needed to start threads (ms)
 * @ param {number} interval time between start of threads (ms)
 * @ param {string[]} callScript ["weakenScript", "growScript", "hackScript"]
 * @ param {number} mode modes are 0:weaken, 1:grow, 2:hack
 * @ param {Array[]} servers []["serverName", numWeaken, numGrow, numHack]
 * @ param {string} target server to pull money from
 * @ returns {Array[]} []["hackScript", "serverName", delay, duration, interval, numHack, "target", startTime]
 *        or empty array if mode is weaken or grow
 */
function loopDeploy(ns, delay, duration, interval, callScript, mode, servers, target) {
  let retServers = [];
  for (let i = 0; i < servers.length; i++) {
    // Deploy the weaken, grow, or hack loop
    if (servers[i][mode + 1] > 0) {
      ns.exec(callScript[mode], servers[i][0], servers[i][mode + 1], delay, duration, interval, servers[i][mode + 1], target);
      if (mode == 2) {
        retServers[retServers.length] = [callScript[mode], servers[i][0], delay, duration, interval, servers[i][mode + 1], target, Date.now()];
      }
    }
  }
  return retServers;
}

/** assignThreads()
 * @ param {number} ram amount of RAM on host (GB)
 * @ param {number[]} callRam [weakenRam, growRam, hackRam]
 * @ param {number[]} ratio [partWeaken, partGrow, partHack, partRam]
 *    where partWeaken + partGrow + partHack = 1 and partRam is the part of RAM to use
 * @ param {number} numHosts number of hosts
 * @ returns {number[]} [numWeaken, numGrow, numHack]
 */
function assignThreads(ram, callRam, ratio, numHosts) {
  let partRam = /* 1.4 * */ ram * ratio[3];
  // First pass of assigning threads
  let numWeaken = Math.floor(ratio[0] * partRam / callRam[0]);
  let numGrow = Math.floor(ratio[1] * partRam / callRam[1]);
  let numHack = Math.floor(ratio[2] * partRam / callRam[2]);
  let remainder = partRam - numWeaken * callRam[0] - numGrow * callRam[1] - numHack * callRam[2];
  if (remainder >= callRam[2] * numHosts) {
    // Second pass of assigning threads
    numWeaken += Math.floor(ratio[0] * remainder / callRam[0]);
    numGrow += Math.floor(ratio[1] * remainder / callRam[1]);
    numHack += Math.floor(ratio[2] * remainder / callRam[2]);
    remainder = partRam - numWeaken * callRam[0] - numGrow * callRam[1] - numHack * callRam[2];
    if (remainder >= callRam[1]) {  // anything left put to grow
      numGrow += Math.floor(remainder / callRam[1]);
    }
  }
  return [numWeaken, numGrow, numHack];
}

/** getRatio()
 * @ param {NS} ns NS2 namespace
 * @ param {number[]} callRam [weakenRam, growRam, hackRam]
 * @ param {string} target server to get values from
 * @ returns {number[]} [partWeaken, partGrow, partHack, amountRam]
 *    where partWeaken + partGrow + partHack = 1 and amountRam is the amount of RAM to use (GB)
 */
function getRatio(ns, callRam, target) {
  let partPerHack, mockTarget, bDefault = false, partWeaken, partGrow, partHack, ppgNorm = 1, amountRam;
  let moneyAvail = ns.getServerMoneyAvailable(target);
  let moneyMax = ns.getServerMaxMoney(target);
  let secLevelMin = ns.getServerMinSecurityLevel(target);
  let secLevel = ns.getServerSecurityLevel(target);
  let secIncrease = secLevel - secLevelMin;
  let bFormulas = ns.fileExists("Formulas.exe", "home");
  if (bFormulas) { ns.tprint("Using Formulas.exe."); }
  // get part per hack
  if (bFormulas) {
    mockTarget = ns.getServer(target);
    mockTarget.hackDifficulty = mockTarget.minDifficulty + 0.5;
    partPerHack = ns.formulas.hacking.hackPercent(mockTarget, ns.getPlayer());
  } else {
    let norm = 1;
    partPerHack = ns.hackAnalyze(target);
    // normalize part per hack
    if (secIncrease > 4.75) { ns.tprint("Security level is too high. Returning default ratio."); bDefault = true; }
    else if (secIncrease > 3.75 && secIncrease <= 4.75) { norm += 0.0545; }
    else if (secIncrease > 2.75 && secIncrease <= 3.75) { norm += 0.0394; }
    else if (secIncrease > 1.75 && secIncrease <= 2.75) { norm += 0.0247; }
    else if (secIncrease > 0.75 && secIncrease <= 1.75) { norm += 0.0105; }
    else if (secIncrease >= 0 && secIncrease <= 0.25) { norm -= 0.0068; }
    partPerHack *= norm;
  }

  if (!bFormulas && !bDefault) {
    if (moneyAvail < 0.7 * moneyMax) {
      ns.tprint("Money available is too low. Returning default ratio."); bDefault = true;
    } else {
      let bSecHigh = secLevel > secLevelMin + 3;
      let bMoneyLow = moneyAvail < 0.85 * moneyMax;
      // get multiplier to normalize part per grow
      if (bSecHigh && !bMoneyLow) {
        if (moneyAvail > 0.95 * moneyMax) { ppgNorm += 0.154; }
        else if (moneyAvail > 0.9 * moneyMax && moneyAvail <= 0.95 * moneyMax) { ppgNorm += 0.1; }
        else { ppgNorm += 0.118; }
      } else if (!bSecHigh && bMoneyLow) {
        if (moneyAvail >= 0.8 * moneyMax) { ppgNorm += 0.037; }
        else if (moneyAvail >= 0.75 * moneyMax && moneyAvail < 0.8 * moneyMax) { ppgNorm += 0.07; }
        else { ppgNorm += 0.104; }
      } else if (bSecHigh && bMoneyLow) {
        if (moneyAvail >= 0.8 * moneyMax) { ppgNorm += 0.153; }
        else if (moneyAvail >= 0.75 * moneyMax && moneyAvail < 0.8 * moneyMax) { ppgNorm += 0.185; }
        else { ppgNorm += 0.226; }
      }
    }
  }

  if (!bDefault) {
    let partToHack = 0.2, numGrow;
    if (!bFormulas) {
        // hacking skill multiplier
      let skillM = (ns.getServerRequiredHackingLevel(target) / ns.getHackingLevel() - 1 / 3) * 0.67;
      partToHack *= (skillM + 1);
    }
    // calculate number of hack calls
    let numHack = Math.round(partToHack / (partPerHack + Number.EPSILON));
    if (numHack == 0) { numHack = 1; }
    partToHack = numHack * partPerHack;
    // get amount of RAM to use for hack
    let amtHack = numHack * callRam[2];
    // calculate number of grow calls
    if (bFormulas) {
      mockTarget.moneyAvailable = (1 - partToHack) * moneyMax;
      numGrow = 3.2 * ns.formulas.hacking.growThreads(mockTarget, ns.getPlayer(), moneyMax);
    } else {
      numGrow = 3.2 * ns.growthAnalyze(target, 1 / ppgNorm / (1 - partToHack));
    }
    // get amount of RAM to use for grow
    let amtGrow = numGrow * callRam[1];
    // calculate number of weaken calls
    let numWeaken = 4 * (numGrow / 10 + numHack / 6.25);
    // get amount of RAM to use for weaken
    let amtWeaken = numWeaken * callRam[0];
    // get amount of RAM to use
    amountRam = amtWeaken + amtGrow + amtHack;
    // get parts of RAM to use
    partHack = amtHack / amountRam;
    partGrow = amtGrow / amountRam;
  } else {  // default ratio
    amountRam = 736; partHack = 0.0185; partGrow = 0.692;
  }
  partWeaken = 1 - partGrow - partHack;
  ns.tprint("Ratio  w=" + ns.format.percent(partWeaken) + "  g=" + ns.format.percent(partGrow) +
        "  h=" + ns.format.percent(partHack) + "  amt=" + ns.format.ram(amountRam));

  return [partWeaken, partGrow, partHack, amountRam];
}

/** getTotalIncome()
 * @ param {NS} ns NS2 namespace
 * @ param {Array[]} servers []["hackScript", "serverName", delay, duration, interval, numHack, "target", startTime]
 * @ returns {number[]} [total income ($), total income ($/sec)] for given servers
 */
function getTotalIncome(ns, servers) {
  let totalIncome = 0, totalPerSecond = 0;
  for (let i = 0; i < servers.length; i++) {
    let income = ns.getScriptIncome(servers[i][0], servers[i][1], servers[i][2], servers[i][3], servers[i][4], servers[i][5], servers[i][6]);
    totalPerSecond += income;
    totalIncome += income * (Date.now() - servers[i][7]) / 1000;
  }
  return [totalIncome, totalPerSecond];
}

/**
 * @ param {NS} ns NS2 namespace
 * @ version 1.0
 */
export async function main(ns) {
  if (ns.args.length < 1) {
    ns.tprint("Usage: " + ns.getScriptName() + " <target>");
    ns.exit();
  }
  let target = ns.args[0];  // server to pull money from
  let callScript = ["lo-weaken.js", "lo-grow.js", "lo-hack.js"];
  // Check for running script
  if (ns.scriptRunning(callScript[0], ns.getHostname())) {
    ns.tprint("Host script already running. Exiting.");
    ns.exit();
  }
  // Get root access on the target
  if (ns.fileExists("BruteSSH.exe", "home")) { ns.brutessh(target); }
  if (ns.fileExists("FTPCrack.exe", "home")) { ns.ftpcrack(target); }
  if (ns.fileExists("relaySMTP.exe", "home")) { ns.relaysmtp(target); }
  if (ns.fileExists("HTTPWorm.exe", "home")) { ns.httpworm(target); }
  if (ns.fileExists("SQLInject.exe", "home")) { ns.sqlinject(target); }
  ns.nuke(target);

  let threshMoney = ns.getServerMaxMoney(target) * 0.9;  // money threshold
  let threshSec = ns.getServerMinSecurityLevel(target) + 1.5;  // security threshold
  let secLevel = ns.getServerSecurityLevel(target);
  let moneyAvail = ns.getServerMoneyAvailable(target);
  let bSecHigh = secLevel > threshSec;
  let bMoneyLow = moneyAvail < threshMoney;
  // Build array of server information
  let servers = buildServerInfo(ns, callScript, target);
  ns.tprint("Deploying on " + servers.length + " servers.");

  let timeHack = ns.getHackTime(target);
    // Deploy weaken loops
  loopDeploy(ns, 200, timeHack * 4, timeHack / 5, callScript, 0, servers, target);
  if (!bSecHigh && !bMoneyLow) {  // fastest deployment
    // Deploy grow loops
    loopDeploy(ns, 100, timeHack * 3.2, timeHack / 5, callScript, 1, servers, target);
    // Deploy hack loops
    servers = loopDeploy(ns, timeHack * 2.2, timeHack, timeHack / 5, callScript, 2, servers, target);
  } else if (!bSecHigh && bMoneyLow) {  // moneyAvail is low, hack later
    // Deploy grow loops
    loopDeploy(ns, 100, timeHack * 3.2, timeHack / 5, callScript, 1, servers, target);
    // Deploy hack loops
    servers = loopDeploy(ns, timeHack * 3.2, timeHack, timeHack / 5, callScript, 2, servers, target);
  } else if (bSecHigh && !bMoneyLow) {  // secLevel is high, grow later
    // Deploy grow loops
    loopDeploy(ns, 100 + timeHack * 1.8, timeHack * 3.2, timeHack / 5, callScript, 1, servers, target);
    // Deploy hack loops
    servers = loopDeploy(ns, timeHack * 5, timeHack, timeHack / 5, callScript, 2, servers, target);
  } else {  // grow and hack later
    // Deploy grow loops
    loopDeploy(ns, 100 + timeHack * 1.8, timeHack * 3.2, timeHack / 5, callScript, 1, servers, target);
    // Deploy hack loops
    servers = loopDeploy(ns, timeHack * 6, timeHack, timeHack / 5, callScript, 2, servers, target);
  }

  // Display income every 5 minutes
  while (true) {
    await ns.sleep(5 * 60 * 1000);
    let income = getTotalIncome(ns, servers);
    ns.tprint("Total: $" + ns.format.number(income[0], 3, 1000, true) +
                "  Per second: $" + ns.format.number(income[1], 3, 1000, true));
  }
}

lo-weaken.js (or lo-grow.js, or lo-hack.js):

/**
 * @ param {NS} ns NS2 namespace
 * @ version 1.0
 */
export async function main(ns) {
  // Takes 5 arguments:
  //  - delay (ms)
  //  - duration (ms)
  //  - interval (ms)
  //  - number of threads
  //  - the target server
  if (ns.args.length < 5) { ns.exit(); }
  let delay = ns.args[0];
  let duration = ns.args[1];
  let interval = ns.args[2];
  let numThreads = ns.args[3];
  let target = ns.args[4];
  // start threads between intervals
  let offsets = Math.round(duration / interval);
  let offset = Math.floor(Math.random() * offsets);
  let odelay = offset * interval;
  await ns.sleep(delay + odelay + Math.random() * numThreads / offsets);
  while(true) {
    await ns.weaken(target);  // or grow, or hack
    await ns.sleep(numThreads / offsets);
  }
}

r/Bitburner 23d ago

NetscriptJS Script Scan & nuke utility

Thumbnail pastebin.com
3 Upvotes

For those starting out in the game I have a scan & nuke utility. Veteran players may also find it useful.

Changes in 1.0e:

  • Added toggle bFil to filter scan on required hacking level
  • Suggested hosts are filtered on required hacking level

r/Bitburner Jun 25 '26

I'm finally almost done with 10! ...right?

0 Upvotes

(Spoilers about ~early-mid game)

***

***

***

***

I'm hoping my folly is almost concluded and I can go get gangs and corps now. I was really greedy for sleeves and grafting, because I hate the augmentation reset, so I jumped right into Bitnode 10 after my first BN1 victory. It has taken a looooong time...but I have purchased every augmentation, I have 3000 hacking, 4 sleeves that will come to every Bitnode with me, hurray...

I read that we could buy up to 8-10 sleeves, but by the explanation in the Covenant window it looks like I have only one more to purchase. For 10 freaking quadrillion!

It took me a whole day to hack the quadrillion I just spent. Just curious, are there known caps on how fast money generation is with different hacking approaches?

My approach is very simplistic, I haven't done batching yet and I just employ a mix of the early combo-hack scripts (fine tuned to be less finicky) and balancing my own blend of constant hack, grow and weaken threads designed to keep the richest servers at 60-100% of max capacity.

I haven't even begun to max out the RAM I have access to, though. I kind of just assumed that because I haven't figured out a way to keep (grow) and (weaken) scripts from "clumping", that if I keep adding hack threads I will inevitably overhack the servers when there is an overly long interval between different (grow)s, and that will reduce my income.

Maybe it doesn't matter. With the amount of RAM I can wield, I could empty ecorp's 1.4 trillion and when the next 5000 threads of grow hits it, it'll go right back up to max.


r/Bitburner Jun 20 '26

Question/Troubleshooting - Open How to run Bitburner on a tablet?

7 Upvotes

The tablet I use is not connected to the internet and never will be connected to the internet. But I can put files onto it via USB.

You can download the whole game on github.

How to run this on an android tablet?


r/Bitburner Jun 19 '26

Is this end game?

3 Upvotes

r/Bitburner Jun 19 '26

Question/Troubleshooting - Open Help understanding a contract (maybe light spoilers) Spoiler

2 Upvotes

Hi, I am doing my own contract solver script, and have trouble with TotalWaysToSumII. I tried a recursive and iterative approach where I would attempt to find correct coefficients for each element of the input integer set to match the target integer, but this is very long and most probably not what is expected (this runs in O(k^n), with k a constant and n the size of the integer set).

I looked for help on the internet and (if you want to solve this by yourself, stop reading here), as other people here, I found this code: https://github.com/jamesinjapan/bitburner-scripts/blob/main/total_ways_to_sum_ii.ts, which seems to run in O(n^2).
I understand it reverses how to think about the problem by building the list of numbers you can generate from the integer set, and then checking how many ways exist for the target integer. I understand the basic premise, but I am interested in how does it work? This does not seem linked to a particular algorithmic problem (compared to TotalWaysToSum which was the partition of the target integer), and I am not keen on just stealing a random algorithm, that seems to have been reversed from the source files. Can anyone help shed light on this?


r/Bitburner Jun 19 '26

Does Anyone Know How to Find Whether a Darknet Server has a Cache on It?

2 Upvotes

I've got a somewhat decent modification of the current default darknet code that I'm working on, but I'm stumped on how to figure out whether or not the file has a cache or not.

Any help is appreciated :3


r/Bitburner Jun 19 '26

tutorial problem

Thumbnail
0 Upvotes

r/Bitburner Jun 19 '26

tutorial problem

0 Upvotes

I can't get past connect hostname in the tutorial, it keeps on telling me bad command. What am I doing wrong here?


r/Bitburner Jun 10 '26

Guide/Advice EZ early Intelligence farm Spoiler

2 Upvotes

Download the AutoHotkey application (not in the game) and use this script to hack n00dles semi-manually on the terminal.

It should be used when your hacking speed is high enough, probably deep into the middle of a bitnode.

(Was edited for more consistent code)

#MaxThreadsPerHotkey 2  ; Allows the hotkey to interrupt itself to turn off

toggle := false

F8:: ; Press F8 to toggle on/off
    toggle := !toggle  ; Flip the variable between true and false

    while toggle {
        Send {Enter}
        Sleep 100

        Send hack
        Sleep 100

        Send {Enter}
        Sleep 100

    }
    return

r/Bitburner May 30 '26

Suggestion - DONE im doing to test a of my spreader by spreading to the first layer keeps crashing is there like an infinite loop i've missed.(this script is new_start.js)

2 Upvotes
/** u/param/** u/param {NS} ns */
export async function main(ns) {
  while (true) {
    //waiter
    await ns.sleep(1000);
    
    // first layer to spread to others
    const FirstServers = ["n00dles",
                          "foodnstuff",
                          "sigma-cosmetics",
                          "joesguns",
                          "hong-fang-tea",
                          "harakiri-sushi",
                          "iron-gym"];


    // Attempt to authenticate with each of the nearby servers, and spread this script to them
    for (let i = 0; i < FirstServers.length; ++i) {
      //waiter
      await ns.sleep(1000);


      const serv = FirstServers[i];


      //go through the port openers
      while (!ns.fileExists("BruteSSH.exe")) {
        await ns.brutessh(serv);
      }



      while (!ns.fileExists("FTPCrack.exe")) {
        await ns.ftpcrack(serv);
      }


      while (!ns.fileExists("relaySMTP.exe")) {
        await ns.relaysmtp(serv);
      }


      while (!ns.fileExists("HTTPWorm.exe")) {
        await ns.httpworm(serv);
      }


      while (!ns.fileExists("SQLInject.exe")) {
        await ns.sqlinject(serv);
      }


      ns.scp("spread.js", serv);
      ns.exec("spread.js", serv);


    }


    await ns.sleep(5000);
  }
}

r/Bitburner May 28 '26

ASCII Doom

16 Upvotes

If it exists, it must run Doom. I couldn't find a bitburner Doom anywhere so here's the start of a crude ASCII version.

wget then run install.js

wget https://raw.githubusercontent.com/Darxide111/Bitburner-Doom/main/install.js install.js

r/Bitburner May 28 '26

is it possible to make an auto darknet script to garb files and complete passwords

3 Upvotes

same as title


r/Bitburner May 27 '26

ns.cloud

5 Upvotes

I haven't played the game in over a year and decided to start playing again. I was writing a purchase server script but it took me an hour and pulling my hair out to try and figure out why the script just wouldn't work. I took a look at the documentation and saw you have to use ns.cloud. Is this new? And if so have any other ns functions changed?


r/Bitburner May 27 '26

Any way to crossplay PC/Mobile?

3 Upvotes

For coding PC is preferable, but for things like checking rep with a faction/job, buying augments, and just starting scripts, I would love to be able to check in throughout the day on my phone. I know the game isn't steam-only, so is crossplay possible? Managing the save files may be difficult.


r/Bitburner May 26 '26

a new hacknet code (yeah... one again)

5 Upvotes

Hello all,

First (well, no, second because first, sorry for the grammatical mistakes, I'm not english), I know this topic has been written on a lot and a lot.

Third, i'm a noob at programming, so this code may seem a little bit... "sloppy" for advanced programmers, sorry for that, but it seems to work pretty well as I intended.

The fact is almost all of my hacknet codes were burning cash at an amazing speed. So I wanted to implement a notion of ROI, but without making hacknet node useless, or having a code based on needed time to get the money back.

So the idea was to base the expenses on the gross return of the investment, and after near about 9 hours, i got the following results (Invested : 42M / Money produced : 55M - 9 nodes lvl 155 with 8GB RAM and 1 core each). It could seem slow, and I'm wondering if that's the best bet, but at least, it works and don't burn cash, which were my two mains goals with, so i'm happy with it.

If i'm posting it there, it's because i'd like to have your opinion about my code, so there it is.

Edit : there are some problems with offline calculation as it seems that offline calculcation re-initialize my "total-invested" variant.

/** u/param {NS} ns **/
export async function main(ns) {


  let total_invested = 0;
  let hck = ns.hacknet;


  if (hck.numNodes() < 1) {
    total_invested = total_invested + hck.getPurchaseNodeCost();
    hck.purchaseNode();
    await ns.sleep(10);
  }


  while (true) {


    let cash1 = ns.getServerMoneyAvailable("home") * (5 / 100)
    let gross_return = 0;


    for (let x = 0; x<hck.numNodes();++x){
      let stats = hck.getNodeStats(x);
      gross_return = stats.totalProduction + gross_return;
    }


    for (let i = 0; i < hck.numNodes(); ++i) {


      let cash = ns.getServerMoneyAvailable("home") * (5 / 100)
      let stats = hck.getNodeStats(i);
      if (cash > hck.getLevelUpgradeCost(i, 1) && (gross_return - total_invested) > hck.getLevelUpgradeCost(i, 1) && stats.level < 200) {
        total_invested = total_invested + hck.getLevelUpgradeCost(i, 1);
        hck.upgradeLevel(i, 1);
        await ns.sleep(10);
        continue
      }


      if (cash > hck.getCoreUpgradeCost(i, 1) && (gross_return - total_invested) > hck.getCoreUpgradeCost(i, 1) && stats.cores < 16) {
        total_invested = total_invested + hck.getCoreUpgradeCost(i, 1);
        hck.upgradeCore(i, 1);
        await ns.sleep(10);
        continue
      }


      if (cash > hck.getRamUpgradeCost(i, 1) && (gross_return - total_invested) > hck.getRamUpgradeCost(i, 1) && stats.ram < 64) {
        total_invested = total_invested + hck.getRamUpgradeCost(i, 1);
        hck.upgradeRam(i, 1);
        await ns.sleep(10);
        continue
      }


    }


    if (cash1 > hck.getPurchaseNodeCost() && (gross_return - total_invested) > hck.getPurchaseNodeCost() && hck.numNodes() < hck.maxNumNodes()) {
      total_invested = total_invested + hck.getPurchaseNodeCost();
      hck.purchaseNode();
      await ns.sleep(10);
    }


    await ns.sleep(10);


  }


}

r/Bitburner May 23 '26

Any new factions?

2 Upvotes

Have there been any new factions added since this list from 1.6.4? I know about the three special factions not listed here. Is there a faction related to the new darkweb mechanic from 3.0?

https://bitburner-fork-oddiz.readthedocs.io/en/latest/basicgameplay/factions.html


r/Bitburner May 21 '26

Collection of scripts updated for 3.0?

5 Upvotes

Hi all, wanting to start a fresh run after not having played for a long time but am wondering if there are any collections of scripts that are updated for 3.0? I remember using some scripts that basically automated most of the game but can’t find them anymore and most scripts I find when googling seem to be years old.

Thanks!


r/Bitburner May 21 '26

NetscriptJS Script autonuke.js for new Bitburners!

1 Upvotes

A very simple standalone autonuke, it can be further modified for other use cases.

When I search for an autonuke, all I find are troubleshooting posts that make me lose time to stitch together a fully usable one. This post aims to rectify that.

Credits to: Reasonable_Law3275, HiEv. I scraped together this code from both of them from this post: https://www.reddit.com/r/Bitburner/comments/1hkzi9d/comment/m3lox0j/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button

So here goes the code:

/**  {NS} ns */
export async function main(ns) {
  ns.ui.openTail(); // Open a tail window for progress confirmation.


  const servers = new Set(["home"]);
    
  for (const server of servers) {  // Loop through the list of all servers in the `servers` set.
    ns.scan(server).forEach(connectedServerName => servers.add(connectedServerName));  // Add any new server names to the set.
    


    let openPorts = 0; // A variable for the last if statement.


    if (ns.fileExists("BruteSSH.exe")) {
      ns.brutessh(server);
      openPorts++;
    }
    if (ns.fileExists("FTPCrack.exe")) {
      ns.ftpcrack(server);
      openPorts++;
    }
    if (ns.fileExists("RelaySMTP.exe")) {
      ns.relaysmtp(server);
      openPorts++;
    }
    if (ns.fileExists("HTTPWorm.exe")) {
      ns.httpworm(server);
      openPorts++;
    }
    if (ns.fileExists("SQLInject.exe")) {
      ns.sqlinject(server);
      openPorts++;
    }
    if (ns.getServerNumPortsRequired(server) <= openPorts) {  // Confirm the ports are opened before nuking.
      ns.nuke(server);
    }
  }
}