executables: add `--help` flag. hacker.js: change scheduling logic. refactor. kill.js: allow handling more than one server or script at a time. cyclic_weaken.js: add. README.md: update.

[?]
May 12, 2020, 3:53 PM
SXEJJKPIZE6AFCHQ32SROLWQUP733MRJZXNAR7OR37VVSRJIFFJQC

Dependencies

  • [2] 6TF4T3E2 lshw.js: fix function call typo.
  • [3] G7YVCY6H lib_score.js: refactor. add two functions for score correction. remove unneeded arbitrary hard-coded multipliers.
  • [4] ZRPOW4ER hacker.js, lib_time.js: supress error messages. hacker.js: use `getBitNodeMultipliers`. lib_time.js: use `getStats`. README.md: update.
  • [5] 6MBUKAG6 remove unneeded functions and comments. update readme.
  • [6] Y5OWMCQR all: remove unecessary uses of `exec`. refactor. main.js: add RAM reservation logic. lib_ram.js: renamed to lib_ram_server.js. README.js: update.
  • [7] 3NFCZ6IP fixed the ram utilisation logic. added flags to `main.js` that can prevent the execution of helpers.
  • [8] XQDYEN4M hacker.js: change server scoring function.
  • [9] VMXI7PS4 added action cap. improved scoring system. fixed parts of security and cash predictors. made lshw loopable.
  • [10] HLC2L3NJ add "tor.js" and "programs.js". use `minimist` for "main.js" argument parsing.
  • [11] SLSWBNYT added ram utilisation logic to `ram.js` and `servers.js`. split and refactored redundant code into separate library files.
  • [12] 2WOLGB42 README.md: update. kill.js: fix argument parser. lshw.js: add `-p` option. increase information given. main.js: fix error message. set saner defaults. hacker.js: split some functions into "lib_time.js" and "lib_score.js". ram.js: fix.
  • [13] RYYLDBTS minor `README.md` change.
  • [14] BZ6FC2BT add `cp.js`.
  • [15] 4ACCU75N improve and refactor scheduling logic.
  • [16] MKHG4OQB make worker scripts and worker script executor time-aware.
  • [17] P6ZJC2SH hacker.js: normalise factors used in server scoring function.
  • [18] IVSW4A6P lib_score.js: normalised scores against average instead of using arbitrary values.
  • [19] BKG7YVUV main.js, hacker.js, servers.js, ram.js: refactor.
  • [20] AXGQ7FML split and refactor hacking logic to "hacker.js" and argument parsing and script execution logic to "main.js". update "README.md".
  • [21] 2BKHJI2S init
  • [22] FA3U4WUJ more `README.md` changes.
  • [23] NQ22FUSW add more options to `main.js`. update `README.md`.
  • [24] DJDWBCCQ add missing "nop.js". killall.js: rename to kill.js. add `--script` and `--server` options.
  • [25] CJBGAILA add optional `--target` parameter for `main.js`. update `README.md`.
  • [26] RWMZ7DVL split and refactor various logics. update "README.md".
  • [27] 7SRULDRF minor refactoring.
  • [28] HSNSECD5 all: refactor. main.js: fix call to `void_kill_script_named_server_named`.

Change contents

  • replacement in sbin/servers.js at line 65
    [5.318][5.318:432]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_servers_bought.length;
    ++integer_indices_0
    [5.318]
    [5.432]
    let integer_index_server = 0;
    integer_index_server < array_servers_bought.length;
    ++integer_index_server
  • replacement in sbin/servers.js at line 69
    [5.438][5.438:518]()
    float_get_server_ram_total(ns, array_servers_bought[integer_indices_0]) <
    [5.438]
    [5.518]
    float_get_server_ram_total(ns, array_servers_bought[integer_index_server]) <
  • replacement in sbin/servers.js at line 82
    [5.777][5.777:891]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_servers_bought.length;
    ++integer_indices_0
    [5.777]
    [5.891]
    let integer_index_server = 0;
    integer_index_server < array_servers_bought.length;
    ++integer_index_server
  • replacement in sbin/servers.js at line 88
    [5.976][5.976:1024]()
    array_servers_bought[integer_indices_0]
    [5.976]
    [5.1024]
    array_servers_bought[integer_index_server]
  • replacement in sbin/servers.js at line 91
    [5.1091][5.1091:1168]()
    ((string_server_smallest = array_servers_bought[integer_indices_0]),
    [5.1091]
    [5.1168]
    ((string_server_smallest = array_servers_bought[integer_index_server]),
  • replacement in sbin/servers.js at line 105
    [5.1405][5.1405:1519]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_servers_bought.length;
    ++integer_indices_0
    [5.1405]
    [5.1519]
    let integer_index_server = 0;
    integer_index_server < array_servers_bought.length;
    ++integer_index_server
  • replacement in sbin/servers.js at line 111
    [5.1604][5.1604:1652]()
    array_servers_bought[integer_indices_0]
    [5.1604]
    [5.1652]
    array_servers_bought[integer_index_server]
  • replacement in sbin/servers.js at line 114
    [5.1718][5.1718:1794]()
    ((string_server_biggest = array_servers_bought[integer_indices_0]),
    [5.1718]
    [5.1794]
    ((string_server_biggest = array_servers_bought[integer_index_server]),
  • replacement in sbin/programs.js at line 9
    [5.6053][5.6053:6161]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_programs.length;
    ++integer_indices_0
    [5.6053]
    [5.6161]
    let integer_index_program = 0;
    integer_index_program < array_programs.length;
    ++integer_index_program
  • replacement in sbin/programs.js at line 13
    [5.6169][5.11408:11472](),[5.11408][5.11408:11472]()
    const string_program = array_programs[integer_indices_0];
    [5.6169]
    [5.6170]
    const string_program = array_programs[integer_index_program];
  • replacement in sbin/hacker.js at line 2
    [4.42][4.42:107]()
    * add a way to be able to target more than one server at a time.
    [4.42]
    [5.11]
    * add a function that will make and run a new schedule whilst there is already one running such that the newer schedule continues right after the old one finishes which would circumvent the down time that currently occurs after a schedule finishes running.
    * add a function that grinds XP by running cyclic weaken on a server using the remaining ram
    * remove unecessary cloning/copying
    * add a way to be able to target more than one server at a time?
  • replacement in sbin/hacker.js at line 7
    [5.108][5.14881:15441](),[5.14881][5.14881:15441]()
    * Maybe add functionality that allows on-the-fly hot loading of settings from a file.
    * add a job cap thing that prevents running more jobs if the first worker in a cycle finishes. add a thing to worker script that writes to a file (or to `window`) its identifier, when it started and when it finishes. add a padding optimiser that detects when tail collision occurs and increases padding each cycle if it does occur, and decreases it by half of how much it increases everytime no tail collision occurs
    * do we need to Add delay between each script execution?
    [5.108]
    [5.15441]
    * add a job cap thing that prevents running more jobs if the first worker in a cycle finishes. add a thing to worker script that writes to a file (or to `window`) its identifier, when it started, and when it finishes. add a padding optimiser that detects when tail collision occurs and increases padding each cycle if it does occur, and decreases it by half of how much it increases everytime no tail collision occurs
    * add functionality that allows on-the-fly hot loading of settings from a file?
  • edit in sbin/hacker.js at line 10
    [5.6416][5.15445:15454](),[5.15445][5.15445:15454](),[5.15513][5.15513:15542](),[5.15542][5.6417:6487](),[5.6487][5.303:405](),[5.405][5.6487:6562](),[5.6487][5.6487:6562](),[5.6562][5.406:494](),[5.494][5.1094:1157](),[5.6562][5.1094:1157]()
    import {
    float_get_server_ram_free,
    array_get_servers_rooted_sorted_by_ram,
    } from "lib_ram_server.js";
    import {
    float_get_time_hack,
    float_get_time_grow,
    float_get_time_weaken,
    } from "lib_time.js";
    import { boolean_can_server_run_script_threads } from "lib_ram_script.js";
    import {
    float_get_server_score,
    array_get_servers_hackable,
    } from "lib_score.js";
    import { boolean_array_scripts_any_running } from "lib_ps.js";
  • edit in sbin/hacker.js at line 12
    [5.15613]
    [5.6563]
  • edit in sbin/hacker.js at line 28
    [5.16115]
    [5.16115]
  • replacement in sbin/hacker.js at line 30
    [5.16129][5.16129:16173](),[5.16210][5.16210:16266]()
    const object_get_constants = function(ns) {
    const object_get_bitnode_multipliers = function(ns) {
    [5.16128]
    [4.108]
    import {
    float_get_server_ram_total,
    float_get_server_ram_used,
    array_get_servers_useable
    } from "lib_ram_server.js";
    import { array_get_servers_hackable } from "lib_score.js";
    import {
    float_get_time_hack,
    float_get_time_grow,
    float_get_time_weaken,
    } from "lib_time.js";
    import {
    float_get_server_score,
    } from "lib_score.js";
    import { boolean_array_scripts_any_running } from "lib_ps.js";
    // https://stackoverflow.com/a/54157459
    const object_get_clone = function (object_original) {
    const object_serialised_deserialised = JSON.parse(
    JSON.stringify(object_original)
    ),
    object_merged = Object.assign({}, object_original);
    return (
    Object.assign(object_merged, object_serialised_deserialised), object_merged
    );
    };
    const array_get_clone = function (array_original) {
    const array = [];
    for (
    let integer_index_element = 0;
    integer_index_element < array_original.length;
    ++integer_index_element
    ) {
    const element = array_original[integer_index_element];
    switch (typeof element) {
    case "object":
    // fall-through
    case "function":
    array.push(object_get_clone(element));
    break;
    default:
    array.push(element);
    }
    }
    return array;
    };
    const object_get_constants = function (ns) {
    const object_get_bitnode_multipliers = function (ns) {
  • replacement in sbin/botnet.js at line 11
    [5.7157][5.7157:7273]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_servers_unrooted.length;
    ++integer_indices_0
    [5.7157]
    [5.7273]
    let integer_index_server = 0;
    integer_index_server < array_servers_unrooted.length;
    ++integer_index_server
  • replacement in sbin/botnet.js at line 15
    [5.7281][5.56216:56296](),[5.56216][5.56216:56296]()
    const string_server_unrooted = array_servers_unrooted[integer_indices_0];
    [5.7281]
    [5.56296]
    const string_server_unrooted = array_servers_unrooted[integer_index_server];
  • replacement in sbin/botnet.js at line 42
    [5.7606][5.7606:7708]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_exploits.length;
    ++integer_indices_0
    [5.7606]
    [5.7708]
    let integer_index_exploit = 0;
    integer_index_exploit < array_exploits.length;
    ++integer_index_exploit
  • replacement in sbin/botnet.js at line 46
    [5.7714][5.7714:7785]()
    const string_exploit_function = array_exploits[integer_indices_0];
    [5.7714]
    [5.7785]
    const string_exploit_function = array_exploits[integer_index_exploit];
  • replacement in lib/lib_time.js at line 2
    [5.3711288][5.3711288:3711374]()
    const object_get_constants = function(ns) {
    const object_get_stats = function(ns) {
    [5.3711288]
    [5.3711374]
    const object_get_constants = function (ns) {
    const object_get_stats = function (ns) {
  • replacement in lib/lib_time.js at line 33
    [5.3712108][5.3712108:3712210]()
    export const float_get_time_hack = function(ns, string_server_target, float_server_target_security) {
    [5.3712108]
    [5.3712210]
    export const float_get_time_hack = function (ns, string_server_target, float_server_target_security) {
  • replacement in lib/lib_time.js at line 54
    [5.3713056][5.3713056:3713158]()
    export const float_get_time_grow = function(ns, string_server_target, float_server_target_security) {
    [5.3713056]
    [5.3713158]
    export const float_get_time_grow = function (ns, string_server_target, float_server_target_security) {
  • replacement in lib/lib_time.js at line 61
    [5.3713475][5.3713475:3713579]()
    export const float_get_time_weaken = function(ns, string_server_target, float_server_target_security) {
    [5.3713475]
    [5.3713579]
    export const float_get_time_weaken = function (ns, string_server_target, float_server_target_security) {
  • replacement in lib/lib_servers.js at line 8
    [5.2775][5.2775:2876]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_servers.length;
    ++integer_indices_0
    [5.2775]
    [5.2876]
    let integer_index_server = 0;
    integer_index_server < array_servers.length;
    ++integer_index_server
  • replacement in lib/lib_servers.js at line 12
    [5.2882][5.3714093:3714167](),[5.3714093][5.3714093:3714167]()
    const array_scan_results = ns.scan(array_servers[integer_indices_0]);
    [5.2882]
    [5.2883]
    const array_scan_results = ns.scan(array_servers[integer_index_server]);
  • replacement in lib/lib_servers.js at line 14
    [5.2893][5.2893:3005]()
    let integer_indices_1 = 0;
    integer_indices_1 < array_scan_results.length;
    ++integer_indices_1
    [5.2893]
    [5.3005]
    let integer_index_scan_result = 0;
    integer_index_scan_result < array_scan_results.length;
    ++integer_index_scan_result
  • replacement in lib/lib_servers.js at line 18
    [5.3011][5.3011:3088](),[5.3088][5.3714354:3714421](),[5.3714354][5.3714354:3714421]()
    -1 === array_servers.indexOf(array_scan_results[integer_indices_1]) &&
    array_servers.push(array_scan_results[integer_indices_1]);
    [5.3011]
    [5.3714435]
    -1 === array_servers.indexOf(array_scan_results[integer_index_scan_result]) &&
    array_servers.push(array_scan_results[integer_index_scan_result]);
  • edit in lib/lib_score.js at line 3
    [5.3715641][5.3715641:3716372]()
    // return array of rooted servers that have required hacking levels <= current hacking level, growth rates > 0 and max cash > 0
    export const array_get_servers_hackable = function (ns) {
    const array_servers_rooted = array_get_servers_rooted(ns);
    let array_servers_hackable = [];
    for (
    let integer_indices_0 = 0;
    integer_indices_0 < array_servers_rooted.length;
    ++integer_indices_0
    ) {
    const string_server = array_servers_rooted[integer_indices_0];
    ns.getHackingLevel() > ns.getServerRequiredHackingLevel(string_server) &&
    ns.getServerMaxMoney(string_server) > 0 &&
    ns.getServerGrowth(string_server) > 0 &&
    array_servers_hackable.push(string_server);
    }
    return array_servers_hackable;
    };
  • replacement in lib/lib_score.js at line 7
    [5.3716454][5.3716454:3716555]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_numbers.length;
    ++integer_indices_0
    [5.3716454]
    [5.3716555]
    let integer_index_number = 0;
    integer_index_number < array_numbers.length;
    ++integer_index_number
  • replacement in lib/lib_score.js at line 11
    [5.3716559][5.3716559:3716612]()
    float_total += array_numbers[integer_indices_0];
    [5.3716559]
    [5.3716612]
    float_total += array_numbers[integer_index_number];
  • replacement in lib/lib_score.js at line 22
    [3.1844][3.1844:1957]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_numbers.length;
    ++integer_indices_0
    [3.1844]
    [3.1957]
    let integer_index_number = 0;
    integer_index_number < array_numbers.length;
    ++integer_index_number
  • replacement in lib/lib_score.js at line 27
    [3.2016][3.2016:2073]()
    array_numbers[integer_indices_0] - float_mean,
    [3.2016]
    [3.2073]
    array_numbers[integer_index_number] - float_mean,
  • replacement in lib/lib_score.js at line 59
    [5.3716780][5.3716780:3716881]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_servers.length;
    ++integer_indices_0
    [5.3716780]
    [5.3716881]
    let integer_index_server = 0;
    integer_index_server < array_servers.length;
    ++integer_index_server
  • replacement in lib/lib_score.js at line 63
    [5.3716885][3.2979:3070]()
    array_servers_trait.push(float_get_trait_score(ns, array_servers[integer_indices_0]));
    [5.3716885]
    [5.3716969]
    array_servers_trait.push(float_get_trait_score(ns, array_servers[integer_index_server]));
  • edit in lib/lib_score.js at line 81
    [5.3717891]
    [3.3347]
    // return array of rooted servers that have required hacking levels <= current hacking level, growth rates > 0 and max cash > 0
    export const array_get_servers_hackable = function (ns) {
    const array_servers_rooted = array_get_servers_rooted(ns);
    let array_servers_hackable = [];
    for (
    let integer_index_server = 0;
    integer_index_server < array_servers_rooted.length;
    ++integer_index_server
    ) {
    const string_server = array_servers_rooted[integer_index_server];
    ns.getHackingLevel() > ns.getServerRequiredHackingLevel(string_server) &&
    ns.getServerMaxMoney(string_server) > 0 &&
    ns.getServerGrowth(string_server) > 0 &&
    array_servers_hackable.push(string_server);
    }
    return array_servers_hackable;
    };
  • replacement in lib/lib_root.js at line 12
    [5.3234][5.3234:3335]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_servers.length;
    ++integer_indices_0
    [5.3234]
    [5.3335]
    let integer_index_server = 0;
    integer_index_server < array_servers.length;
    ++integer_index_server
  • replacement in lib/lib_root.js at line 16
    [5.3339][5.3339:3397](),[5.3397][5.3719308:3719375](),[5.3719308][5.3719308:3719375]()
    ns.hasRootAccess(array_servers[integer_indices_0]) &&
    array_servers_rooted.push(array_servers[integer_indices_0]);
    [5.3339]
    [5.3719385]
    ns.hasRootAccess(array_servers[integer_index_server]) &&
    array_servers_rooted.push(array_servers[integer_index_server]);
  • replacement in lib/lib_root.js at line 26
    [5.3544][5.3544:3645]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_servers.length;
    ++integer_indices_0
    [5.3544]
    [5.3645]
    let integer_index_server = 0;
    integer_index_server < array_servers.length;
    ++integer_index_server
  • replacement in lib/lib_root.js at line 30
    [5.3649][5.3649:3707](),[5.3707][5.3719784:3719853](),[5.3719784][5.3719784:3719853]()
    ns.hasRootAccess(array_servers[integer_indices_0]) ||
    array_servers_unrooted.push(array_servers[integer_indices_0]);
    [5.3649]
    [5.3719863]
    ns.hasRootAccess(array_servers[integer_index_server]) ||
    array_servers_unrooted.push(array_servers[integer_index_server]);
  • replacement in lib/lib_ram_server.js at line 8
    [5.3720060][5.3720060:3720178]()
    export const float_get_server_ram_total = function(ns, string_server) {
    return (ns.getServerRam(string_server))[0];
    [5.3720060]
    [5.3720178]
    export const float_get_server_ram_total = function (ns, string_server) {
    return ns.getServerRam(string_server)[0];
  • replacement in lib/lib_ram_server.js at line 13
    [5.3720218][5.3720218:3720328]()
    const float_get_server_ram_used = function(ns, string_server) {
    return (ns.getServerRam(string_server))[1];
    [5.3720218]
    [5.3720328]
    export const float_get_server_ram_used = function (ns, string_server) {
    return ns.getServerRam(string_server)[1];
  • replacement in lib/lib_ram_server.js at line 30
    [5.3720783][5.3720783:3720891]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_servers_rooted.length;
    ++integer_indices_0
    [5.3720783]
    [5.3720891]
    let integer_index_server_rooted = 0;
    integer_index_server_rooted < array_servers_rooted.length;
    ++integer_index_server_rooted
  • replacement in lib/lib_ram_server.js at line 36
    [5.3720964][5.3720964:3721010]()
    array_servers_rooted[integer_indices_0]
    [5.3720964]
    [5.3721010]
    array_servers_rooted[integer_index_server_rooted]
  • edit in lib/lib_ram_server.js at line 63
    [5.3722311]
    [5.3722311]
    };
    // returns an array of rooted servers that have ram > 0
    export const array_get_servers_useable = function (ns) {
    const array_servers_rooted = array_get_servers_rooted(ns);
    let array_servers_useable = [];
    for (
    let integer_index_server_rooted = 0;
    integer_index_server_rooted < array_servers_rooted.length;
    ++integer_index_server_rooted
    ) {
    const string_server_rooted =
    array_servers_rooted[integer_index_server_rooted];
    float_get_server_ram_total(ns, string_server_rooted) > 0 &&
    array_servers_useable.push(string_server_rooted);
    }
    return array_servers_useable;
  • replacement in lib/lib_ps.js at line 7
    [5.3724811][5.3724811:3724912]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_servers.length;
    ++integer_indices_0
    [5.3724811]
    [5.3724912]
    let integer_index_server = 0;
    integer_index_server < array_servers.length;
    ++integer_index_server
  • replacement in lib/lib_ps.js at line 11
    [5.3724918][5.3724918:3724978]()
    const string_server = array_servers[integer_indices_0],
    [5.3724918]
    [5.3724978]
    const string_server = array_servers[integer_index_server],
  • replacement in lib/lib_ps.js at line 15
    [5.3725084][5.3725084:3725205]()
    let integer_indices_1 = 0;
    integer_indices_1 < array_scripts_running.length;
    ++integer_indices_1
    [5.3725084]
    [5.3725205]
    let integer_index_script = 0;
    integer_index_script < array_scripts_running.length;
    ++integer_index_script
  • replacement in lib/lib_ps.js at line 19
    [5.3725215][5.3725215:3725287]()
    const object_script = array_scripts_running[integer_indices_1],
    [5.3725215]
    [5.3725287]
    const object_script = array_scripts_running[integer_index_script],
  • replacement in lib/lib_ps.js at line 30
    [5.3725602][5.3725602:3725703]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_scripts.length;
    ++integer_indices_0
    [5.3725602]
    [5.3725703]
    let integer_index_script = 0;
    integer_index_script < array_scripts.length;
    ++integer_index_script
  • replacement in lib/lib_ps.js at line 34
    [5.3725707][5.3725707:3725780]()
    return boolean_script_running(ns, array_scripts[integer_indices_0]);
    [5.3725707]
    [5.3725780]
    return boolean_script_running(ns, array_scripts[integer_index_script]);
  • replacement in lib/lib_ls.js at line 11
    [5.3825][5.3825:3934]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_files_in_server.length;
    ++integer_indices_0
    [5.3825]
    [5.3934]
    let integer_index_file = 0;
    integer_index_file < array_files_in_server.length;
    ++integer_index_file
  • replacement in lib/lib_ls.js at line 15
    [5.3940][5.3733984:3734050](),[5.3733984][5.3733984:3734050]()
    const string_file = array_files_in_server[integer_indices_0];
    [5.3940]
    [5.3941]
    const string_file = array_files_in_server[integer_index_file];
  • edit in bin/main.js at line 2
    [5.2502][5.2584:2639](),[5.2584][5.2584:2639](),[5.2639][5.1607:1625](),[5.1607][5.1607:1625]()
    * figure out a better way for this to run "hacker.js"
    * add --help flag
  • edit in bin/main.js at line 3
    [5.1787][5.1787:1927]()
    * Maybe make a cache script that saves runtime constants like max money of servers to a cache file to potentially reduce RAM usage further.
  • edit in bin/main.js at line 4
    [5.1652]
    [5.1652]
    * use the same server choosing logic used in hacker.js for picking which server to run helper scripts on
    * figure out a better way for this to run "hacker.js"
    * Maybe make a cache script that saves runtime constants like max money of servers to a cache file to potentially reduce RAM usage further.
  • edit in bin/main.js at line 15
    [5.9848][5.9848:9990](),[5.9990][5.3462:3514](),[5.3514][5.9990:10048](),[5.9990][5.9990:10048](),[5.10048][5.1874:1875](),[5.1874][5.1874:1875](),[5.2084][5.2084:2486](),[5.2486][5.10049:10384](),[5.10384][5.2061:2150](),[5.2150][5.2879:2959](),[5.10451][5.2879:2959](),[5.2879][5.2879:2959](),[5.2959][5.1792:1887](),[5.1887][5.2151:2181](),[5.2181][3.4620:4751](),[5.1953][5.3144:3468](),[5.2215][5.3144:3468](),[3.4751][5.3144:3468](),[5.3144][5.3144:3468](),[5.3468][5.1954:2039](),[5.2039][5.3527:3572](),[5.3527][5.3527:3572](),[5.3572][5.10452:10485](),[5.10485][5.5003:5090](),[5.5003][5.5003:5090](),[5.5090][5.10486:10561](),[5.10561][5.5164:5238](),[5.5164][5.5164:5238](),[5.5238][5.10562:10698](),[5.10698][5.5340:5410](),[5.5340][5.5340:5410](),[5.5410][5.10699:10741](),[5.10741][5.5451:5526](),[5.5451][5.5451:5526](),[5.5526][5.10742:11036](),[5.11036][5.5703:5776](),[5.5703][5.5703:5776](),[5.5776][5.11037:11086](),[5.11086][5.5823:5840](),[5.5823][5.5823:5840](),[5.5840][5.11087:11137](),[5.11137][5.5892:6016](),[5.5892][5.5892:6016](),[5.6016][5.11138:12495](),[5.12495][5.7245:7251](),[5.7245][5.7245:7251](),[5.7255][5.7255:7490](),[5.7490][5.12496:12653](),[5.12685][5.12685:12805](),[5.12805][5.7747:8432](),[5.7747][5.7747:8432](),[5.8432][5.12806:13062](),[5.13062][5.8665:8728](),[5.8665][5.8665:8728](),[5.8728][5.13063:13327](),[5.13327][5.8979:9052](),[5.8979][5.8979:9052](),[5.9052][5.13328:13461](),[5.13461][5.9161:9244](),[5.9161][5.9161:9244](),[5.9244][5.13462:13828](),[5.14613][5.14613:14617](),[5.14630][5.14630:16094](),[5.16142][5.16142:16729](),[5.16729][5.9611:9615](),[5.9611][5.9611:9615](),[5.9615][5.16730:18171]()
    import { boolean_can_server_run_script_threads } from "lib_ram_script.js";
    import { void_kill_script_named_server_named } from "lib_kill.js";
    import { boolean_script_running } from "lib_ps.js";
    import { object_parse_arguments } from "lib_minimist.js";
    // main
    export const main = async function(ns) {
    // variables
    // helper scripts
    const object_helpers = object_get_constants().object_helpers;
    // threads of "nop.js" required to reserve enough RAM to run "hacker.js"
    const integer_threads_nop = integer_get_threads_nop(ns, object_helpers.string_hacker, ns.getScriptName());
    // if this server doesn't have enough RAM to run "hacker.js", eject
    if (
    !boolean_can_server_run_script_threads(
    ns,
    float_get_server_ram_free(ns, ns.getHostname()),
    object_helpers.string_nop,
    integer_threads_nop
    )
    ) {
    const string_message_error = `This server has insufficient RAM to run "${object_helpers.string_nop}" with "${integer_threads_nop}" thread(s).`;
    throw (ns.tprint(`ERROR: ${integer_threads_nop}`), new Error(string_message_error));
    }
    // name of purchased servers
    let string_servers_bought_name = "server";
    // maximum amount of jobs to execute per schedule, used to prevent using up too much IRL RAM
    let integer_job_cap = 1000;
    // duration between each job used to prevent collisions between them to keep them in sequence
    let float_padding_seconds = 0.5;
    // precision of the percentage to steal calculator
    let float_precision = 0.001;
    // the maximum percentage of cash that should be stolen from a server
    let float_steal_cap = 0.9;
    // time period used for checking the time in seconds
    let float_period_check_seconds = 10;
    // target
    let string_server_target = "";
    // ram utilisiation threshold. upgrade ram or buy or replace servers when reached.
    let float_ram_utilisation_threshold = 0.9;
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    let array_helpers = [
    {
    file: object_helpers.string_ram,
    threads: 1,
    args: [float_period_check_seconds, float_ram_utilisation_threshold],
    },
    {
    file: object_helpers.string_servers,
    threads: 1,
    args: [
    float_period_check_seconds,
    string_servers_bought_name,
    float_ram_utilisation_threshold,
    ],
    },
    {
    file: object_helpers.string_tor,
    threads: 1,
    args: [float_period_check_seconds],
    },
    {
    file: object_helpers.string_programs,
    threads: 1,
    args: [
    float_period_check_seconds,
    [
    "BruteSSH.exe",
    "FTPCrack.exe",
    "relaySMTP.exe",
    "HTTPWorm.exe",
    "SQLInject.exe",
    "DeepscanV1.exe",
    "DeepscanV2.exe",
    "Autolink.exe",
    ],
    ],
    },
    {
    file: object_helpers.string_botnet,
    threads: 1,
    args: [float_period_check_seconds],
    },
    ];
    // flags
    for (const string_argument in object_arguments)
    if (object_arguments.hasOwnProperty(string_argument)) {
    const argument_value = object_arguments[string_argument];
    (("a" === string_argument && argument_value) ||
    ("ram" === string_argument && !argument_value)) &&
    array_helpers.splice(
    integer_get_index_of_file(array_helpers, object_helpers.string_ram),
    1
    ),
    (("e" === string_argument && argument_value) ||
    ("servers" === string_argument && !argument_value)) &&
    array_helpers.splice(
    integer_get_index_of_file(
    array_helpers,
    object_helpers.string_servers
    ),
    1
    ),
    (("o" === string_argument && argument_value) ||
    ("tor" === string_argument && !argument_value)) &&
    array_helpers.splice(
    integer_get_index_of_file(array_helpers, object_helpers.string_tor),
    1
    ),
    (("g" === string_argument && argument_value) ||
    ("programs" === string_argument && !argument_value)) &&
    array_helpers.splice(
    integer_get_index_of_file(
    array_helpers,
    object_helpers.string_programs
    ),
    1
    ),
    (("b" === string_argument && argument_value) ||
    ("botnet" === string_argument && !argument_value)) &&
    array_helpers.splice(
    integer_get_index_of_file(
    array_helpers,
    object_helpers.string_botnet
    ),
    1
    );
    }
    // main
    // reserve enough RAM for "hacker.js"
    ns.exec(object_helpers.string_nop, ns.getHostname(), integer_threads_nop);
    void_copy_scripts(ns);
    void_script_executor(ns, array_helpers);
    // kill "nop.js" scripts to free RAM
    void_kill_script_named_server_named(
    ns,
    ns.getHostname(),
    object_helpers.string_nop
    );
    ns.spawn(
    object_helpers.string_hacker,
    1,
    integer_job_cap,
    float_precision,
    float_steal_cap,
    float_padding_seconds,
    string_server_target
    );
    };
    // functions
    const object_get_constants = function() {
    return {
    // helper scripts
    object_helpers: {
    string_nop: "nop.js",
    string_hacker: "hacker.js",
    string_ram: "ram.js",
    string_servers: "servers.js",
    string_tor: "tor.js",
    string_programs: "programs.js",
    string_botnet: "botnet.js"
    }
    };
    };
    // return the difference in RAM requirements between two scripts
    const float_get_ram_difference = function(ns, string_script_0, string_script_1) {
    return ns.getScriptRam(string_script_0) - ns.getScriptRam(string_script_1);
    };
    // return the amount of threads of "nop.js" is required to make up RAM difference between two scripts
    const integer_get_threads_nop = function (
    ns,
    string_script_0,
    string_script_1
    ) {
    return Math.ceil(
    float_get_ram_difference(ns, string_script_0, string_script_1) /
    ns.getScriptRam(object_get_constants().object_helpers.string_nop)
    );
    };
    // copy all scripts from the current server to all servers
    const void_copy_scripts = function (ns) {
    const string_host = ns.getHostname(),
    array_script_extensions = [".js", ".ns", ".script"];
    for (
    let integer_indices_0 = 0;
    integer_indices_0 < array_script_extensions.length;
    ++integer_indices_0
    ) {
    const string_extension = array_script_extensions[integer_indices_0];
    void_copy_files_to_servers(
    ns,
    array_get_files_to_copy(ns, string_host, string_extension),
    string_host
    );
    }
    };
    // returns the index of the scripts array which matches the filename input
    const integer_get_index_of_file = function (array_scripts, string_file) {
    for (
    let integer_indices_0 = 0;
    integer_indices_0 < array_scripts.length;
    ++integer_indices_0
    ) {
    const object_script = array_scripts[integer_indices_0],
    string_script_file = object_script.file;
    if (string_script_file === string_file) return integer_indices_0;
    }
    };
    // copies files to all rooted servers
    const void_copy_files_to_servers = function (ns, array_files, string_source) {
    const array_servers = array_get_servers(ns);
    for (
    let integer_indices_0 = 0;
    integer_indices_0 < array_servers.length;
    ++integer_indices_0
    )
    for (
    let integer_indices_1 = 0;
    integer_indices_1 < array_files.length;
    ++integer_indices_1
    )
    ns.scp(
    array_files[integer_indices_1],
    string_source,
    array_servers[integer_indices_0]
    );
    };
    // runs scripts on any server that has enough available RAM
    const void_script_executor = function (ns, array_scripts) {
    const array_servers_rooted_sorted_by_ram = array_get_servers_rooted_sorted_by_ram(
    ns
    );
    for (
    let integer_indices_0 = 0;
    integer_indices_0 < array_scripts.length;
    ++integer_indices_0
    ) {
    const object_script = array_scripts[integer_indices_0],
    string_file = object_script.file,
    float_ram = ns.getScriptRam(string_file),
    integer_threads = object_script.threads,
    array_arguments = object_script.args;
    if (!boolean_script_running(ns, string_file))
    // use servers with the biggest rams first
    for (
    let integer_indices_1 = array_servers_rooted_sorted_by_ram.length - 1;
    integer_indices_1 >= 0;
    --integer_indices_1
    ) {
    const string_server_used =
    array_servers_rooted_sorted_by_ram[integer_indices_1];
    if (
    float_get_server_ram_free(ns, string_server_used) >=
    float_ram * integer_threads
    ) {
    try {
    ns.exec(
    string_file,
    string_server_used,
    integer_threads,
    ...array_arguments
    );
    } catch (error) {
    ns.tprint(JSON.stringify(error));
    }
    break;
    }
    0 === integer_indices_1 &&
    ns.tprint(
    `WARNING: Unable to find a server with sufficient RAM to run \"${string_file}\".`
    );
    }
    }
    };
    ================================
    // argument parsing
    // options
    const object_arguments = object_parse_arguments(ns.args);
    for (const string_argument in object_arguments)
    if (object_arguments.hasOwnProperty(string_argument)) {
    const argument_value = object_arguments[string_argument];
    switch (string_argument) {
    case "c":
    // fall-through
    case "check-delay":
    float_period_check_seconds = argument_value;
    break;
    case "d":
    // fall-through
    case "job-delay":
    float_padding_seconds = argument_value;
    break;
    case "i":
    // fall-through
    case "target":
    string_server_target = argument_value;
    break;
    case "j":
    // fall-through
    case "job-cap":
    integer_job_cap = argument_value;
    break;
    case "n":
    // fall-through
    case "server-name":
    string_servers_bought_name = argument_value;
    break;
    case "p":
    // fall-through
    case "precision":
    float_precision = argument_value;
    break;
    case "r":
    // fall-through
    case "ram-utilisation":
    float_ram_utilisation_threshold = argument_value;
    break;
    case "s":
    // fall-through
    case "steal-cap":
    float_steal_cap = argument_value;
    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  • replacement in bin/lshw.js at line 14
    [5.2594][5.2594:2626]()
    let float_sleep_duration = 0,
    [5.2594]
    [5.2626]
    let
    float_sleep_duration = 0,
  • replacement in bin/lshw.js at line 17
    [5.2653][5.2653:2677]()
    array_servers = [];
    [5.2653]
    [5.2677]
    array_servers = [],
    boolean_print_help = !1;
  • edit in bin/lshw.js at line 30
    [5.3102]
    [5.3102]
    case "h":
    // fall-through
    case "help":
    boolean_print_help = argument_value;
    break;
  • edit in bin/lshw.js at line 50
    [5.3537]
    [2.1578]
    if (boolean_print_help)
    return void_print_help(ns, integer_precision);
  • replacement in bin/lshw.js at line 54
    [5.18378][5.18378:18411](),[5.18411][5.3619:3667](),[5.3667][5.18461:18487](),[5.18461][5.18461:18487]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_servers.length;
    ++integer_indices_0
    [5.18378]
    [5.18487]
    let integer_index_server = 0;
    integer_index_server < array_servers.length;
    ++integer_index_server
  • replacement in bin/lshw.js at line 58
    [5.18495][5.3668:3730]()
    const string_server = array_servers[integer_indices_0];
    [5.18495]
    [5.18765]
    const string_server = array_servers[integer_index_server];
  • replacement in bin/lshw.js at line 71
    [5.19014][5.3802:3883](),[5.3883][5.11967:12179](),[5.11967][5.11967:12179](),[5.12179][5.19015:19105]()
    const void_print_information = function (ns, string_server, integer_precision) {
    const float_cash_max = ns.getServerMaxMoney(string_server);
    const float_cash_current = ns.getServerMoneyAvailable(string_server);
    const float_security_minimum = ns.getServerMinSecurityLevel(string_server);
    const float_security_current = Math.round(
    ns.getServerSecurityLevel(string_server)
    [5.19014]
    [5.19105]
    const void_print_help = function (
    ns,
    integer_precision
    ) {
    ns.tprint(
    `
    DESCRIPTION
    Display information about one or more servers.
    Optionally, display the information at regular intervals.
    USAGE
    run lshw.js [OPTIONS ...] <ARGUMENT [ARGUMENT ...]>
    ARGUMENT = Server to display the information about.
    OPTIONS
    -d, --delay <SECONDS>
    SECONDS = The duration of delay between update, in seconds. Should be a floating-point number >= 0.001. By default, the script will only display server information once, unless this option is manually set.
    -p, --precision <INTEGER>
    INTEGER = The decimal places to display floating point values with. Should be an integer >= 0. Defaults to ${integer_precision}.
    FLAGS
    -h, --help
    Displays this message then exits.`
  • replacement in bin/lshw.js at line 97
    [5.19110][5.12266:12451](),[5.12266][5.12266:12451](),[5.12451][5.19111:19147]()
    const array_ram = ns.getServerRam(string_server);
    const float_ram_total = array_ram[0];
    const float_ram_used = array_ram[1];
    const float_ram_free = array_ram[0] - array_ram[1];
    const string_server_information =
    [5.19110]
    [5.19147]
    };
    const void_print_information = function (
    ns,
    string_server,
    integer_precision
    ) {
    const
    float_cash_max = ns.getServerMaxMoney(string_server),
    float_cash_current = ns.getServerMoneyAvailable(string_server),
    float_security_minimum = ns.getServerMinSecurityLevel(string_server),
    float_security_current = ns.getServerSecurityLevel(string_server),
    array_ram = ns.getServerRam(string_server),
    float_ram_total = array_ram[0],
    float_ram_used = array_ram[1],
    float_ram_free = array_ram[0] - array_ram[1],
    string_server_information =
  • replacement in bin/kill.js at line 1
    [5.3798805][5.3798806:3798938]()
    // kill.js - 2.55GB - TODO:
    // * maybe implement a loop that repeats logic until all appropriate scripts have actually been killed.
    [5.3798805]
    [5.3798938]
    /* kill.js - 2.55GB - TODO:
    * maybe implement a loop that repeats logic until all appropriate scripts have actually been killed.
    */
  • replacement in bin/kill.js at line 9
    [5.3799125][5.3799125:3799166]()
    export const main = async function(ns) {
    [5.3798994]
    [5.3799166]
    export const main = async function (ns) {
  • replacement in bin/kill.js at line 11
    [5.3799181][5.3799181:3799233]()
    let array_servers = [];
    let array_scripts = [];
    [5.3799181]
    [5.3799233]
    let
    array_servers = [],
    array_scripts = [],
    boolean_print_help = !1;
  • replacement in bin/kill.js at line 25
    [5.3799590][5.5316:5362]()
    array_scripts.push(argument_value);
    [5.3799590]
    [5.3799632]
    "object" == typeof argument_value
    ? array_scripts.push(...argument_value)
    : array_scripts.push(argument_value);
  • replacement in bin/kill.js at line 32
    [5.3799714][5.5363:5409]()
    array_servers.push(argument_value);
    [5.3799714]
    [5.3799756]
    "object" == typeof argument_value
    ? array_servers.push(...argument_value)
    : array_servers.push(argument_value);
    break;
    case "h":
    // fall-through
    case "help":
    boolean_print_help = argument_value;
  • edit in bin/kill.js at line 51
    [5.3800048]
    [5.3800048]
    if (boolean_print_help)
    return void_print_help(ns);
  • edit in bin/kill.js at line 64
    [5.3800375]
    [5.3800375]
    const void_print_help = function (ns) {
    ns.tprint(
    `
    DESCRIPTION
    Kill all running scripts.
    Optionally, kill only named scripts instead.
    Optionally, kill only scripts on named servers instead.
    Optionally, kill only named scripts on named servers instead.
    USAGE
    run kill.js [FLAGS ...] [OPTIONS ...]
    OPTIONS
    -c, --script <SCRIPT>
    SCRIPT = The name of a script to kill.
    -e, --server <SERVER>
    SERVER = The name of a server on which scripts will be killed.
    FLAGS
    -h, --help
    Displays this message then exits.`
    );
    };
  • replacement in bin/kill.js at line 96
    [5.3800544][5.3800544:3800645]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_scripts.length;
    ++integer_indices_0
    [5.3800544]
    [5.3800645]
    let integer_index_script = 0;
    integer_index_script < array_scripts.length;
    ++integer_index_script
  • replacement in bin/kill.js at line 100
    [5.3800651][5.3800651:3800711]()
    const string_script = array_scripts[integer_indices_0];
    [5.3800651]
    [5.3800711]
    const string_script = array_scripts[integer_index_script];
  • replacement in bin/kill.js at line 112
    [5.3800963][5.3800963:3801064]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_servers.length;
    ++integer_indices_0
    [5.3800963]
    [5.3801064]
    let integer_index_server = 0;
    integer_index_server < array_servers.length;
    ++integer_index_server
  • replacement in bin/kill.js at line 116
    [5.3801070][5.3801070:3801130]()
    const string_server = array_servers[integer_indices_0];
    [5.3801070]
    [5.3801130]
    const string_server = array_servers[integer_index_server];
  • replacement in bin/kill.js at line 130
    [5.3801602][5.3801602:3801711]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_scripts_running.length;
    ++integer_indices_0
    [5.3801602]
    [5.3801711]
    let integer_index_script = 0;
    integer_index_script < array_scripts_running.length;
    ++integer_index_script
  • replacement in bin/kill.js at line 134
    [5.3801717][5.3801717:3801785]()
    const object_script = array_scripts_running[integer_indices_0],
    [5.3801717]
    [5.3801785]
    const object_script = array_scripts_running[integer_index_script],
  • replacement in bin/kill.js at line 144
    [5.3802085][5.3802085:3802186]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_servers.length;
    ++integer_indices_0
    [5.3802085]
    [5.3802186]
    let integer_index_server = 0;
    integer_index_server < array_servers.length;
    ++integer_index_server
  • replacement in bin/kill.js at line 148
    [5.3802192][5.3802192:3802252]()
    const string_server = array_servers[integer_indices_0];
    [5.3802192]
    [5.3802252]
    const string_server = array_servers[integer_index_server];
  • edit in bin/cp.js at line 2
    [5.11423]
    [5.19516]
    import { object_parse_arguments } from "lib_minimist.js";
  • replacement in bin/cp.js at line 8
    [5.19672][5.19672:19707]()
    const array_arguments = ns.args;
    [5.19672]
    [5.19707]
    // argument parsing
    const object_arguments = object_parse_arguments(ns.args);
    let array_substrings = [];
    for (const string_argument in object_arguments)
    if (object_arguments.hasOwnProperty(string_argument)) {
    const argument_value = object_arguments[string_argument];
    switch (string_argument) {
    case "h":
    // fall-through
    case "help":
    boolean_print_help = argument_value;
    break;
    case "_":
    "object" == typeof argument_value
    ? array_substrings.push(...argument_value)
    : array_substrings.push(argument_value);
    break;
    default:
    const string_message_error = `Unknown argument passed: "${string_argument}".`;
    throw (ns.tprint(`ERROR: ${string_message_error}`), new Error(string_message_error));
    }
    }
    // main
    if (boolean_print_help)
    return void_print_help(ns);
  • replacement in bin/cp.js at line 35
    [5.19715][5.19715:19818]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_arguments.length;
    ++integer_indices_0
    [5.19715]
    [5.19818]
    let integer_index_substring = 0;
    integer_index_substring < array_substrings.length;
    ++integer_index_substring
  • replacement in bin/cp.js at line 39
    [5.19824][5.19824:19889]()
    const string_substring = array_arguments[integer_indices_0];
    [5.19824]
    [5.19889]
    const string_substring = array_substrings[integer_index_substring];
  • edit in bin/cp.js at line 45
    [5.19969]
    [5.3803101]
    const void_print_help = function (ns) {
    ns.tprint(
    `
    DESCRIPTION
    Copy all files that contain particular substring(s) in their filenames from all servers to the current server.
    USAGE
    run cp.js [FLAGS ...] <ARGUMENT [ARGUMENT ...]>
    ARGUMENT = Substring contained in the names of files to be copied to the current server.
    FLAGS
    -h, --help
    Displays this message then exits.`
    );
    };
  • replacement in bin/cp.js at line 85
    [5.20424][5.20424:20525]()
    let integer_indices_0 = 0;
    integer_indices_0 < array_servers.length;
    ++integer_indices_0
    [5.20424]
    [5.20525]
    let integer_index_server = 0;
    integer_index_server < array_servers.length;
    ++integer_index_server
  • replacement in bin/cp.js at line 89
    [5.20531][5.20531:20598]()
    const string_server_source = array_servers[integer_indices_0],
    [5.20531]
    [5.20598]
    const string_server_source = array_servers[integer_index_server],
  • replacement in bin/cp.js at line 96
    [5.20737][5.20737:20850]()
    let integer_indices_1 = 0;
    integer_indices_1 < array_files_to_copy.length;
    ++integer_indices_1
    [5.20737]
    [5.20850]
    let integer_index_file = 0;
    integer_index_file < array_files_to_copy.length;
    ++integer_index_file
  • replacement in bin/cp.js at line 100
    [5.20858][5.3804646:3804720](),[5.3804646][5.3804646:3804720]()
    const string_file_to_copy = array_files_to_copy[integer_indices_1];
    [5.20858]
    [5.3804720]
    const string_file_to_copy = array_files_to_copy[integer_index_file];
  • replacement in README.md at line 26
    [5.3327][5.9622:9664](),[5.7256][5.3353:3400](),[5.9664][5.3353:3400](),[5.3353][5.3353:3400](),[5.3400][5.3644:3794](),[5.3794][5.3568:3600](),[5.3568][5.3568:3600](),[5.3600][3.4758:4880]()
    `run main.js [OPTIONS ...] [FLAGS ...]`
    #### OPTIONS
    `-c, --check-delay <SECONDS>`
    * SECONDS = The duration of delay between each main loop used in helper scripts, in seconds. Should be a floating-point number > 0. Defaults to 10.
    `-d, --job-delay <SECONDS>`
    * SECONDS = The duration of delay between each job, in seconds. Should be a floating-point number > 0. Defaults to 0.5.
    [5.3327]
    [5.3722]
    `run main.js [FLAGS ...] [OPTIONS ...]`
  • edit in README.md at line 28
    [5.3723][5.3723:3750](),[5.3750][5.6241:6526](),[5.6526][5.4035:4060](),[5.4035][5.4035:4060](),[5.3043][5.3499:3500](),[5.4060][5.3499:3500](),[5.3499][5.3499:3500](),[5.3500][5.5609:5715](),[5.2275][5.4162:4684](),[5.5715][5.4162:4684](),[5.4162][5.4162:4684](),[5.4684][5.11621:12018](),[5.12018][5.4684:4712](),[5.4684][5.4684:4712](),[5.4712][5.2276:2418](),[5.2418][5.4855:4856](),[5.4855][5.4855:4856]()
    `-i, --target <SERVER>`
    * SERVER = The server that should be targetted by the `weaken`, `grow` and `hack` functions. Should be a string. Defaults to choosing an optimal target using a scoring system based on the server's maximum cash, growth, required hacking level, and the player's current hacking level.
    `-j, --job-cap <CAP>`
    * CAP = The maximum amount of jobs to execute per schedule. Should be an integer > 0. Defaults to 1000.
    `-n, --server-name <NAME>`
    * NAME = The name to be used for purchased servers. Should be a string. Defaults to "server".
    `-p, --precision <PRECISION>`
    * PRECISION = A value used in determining how many cycles of bisection the binary search algorithm used for the percentage to steal calculator should use. Should be a floating point number > 0 <= 1. Values closer to 0 will result in greater precision in the calculation, but potentially longer run-times and compared to values closer to 1. Defaults to 0.001.
    `-r, --ram-utilisation <THRESHOLD>`
    * THRESHOLD = The botnet's ram utilisation threshold after which upgrades/replacements should be bought for servers and the RAM of "home". Should be a floating point number >= 0 <= 1. Values closer to 0 will result in attempting more frequent upgrades/replacements at the cost of less efficient RAM utilisation to cash spenditure ratios. Defaults to 0.9.
    `-s, --steal-cap <CAP>`
    * CAP = The maximum amount fraction of cash to steal from the target server per `hack` job. Should be an integer >= 0 <=1. Defaults to 0.9.
  • edit in README.md at line 41
    [5.7685]
    [5.6072]
    `-h, --help`
    * Displays a help message then exits.
  • edit in README.md at line 52
    [5.4604][5.6337:6338](),[5.6337][5.6337:6338](),[5.6338][5.4856:4930](),[5.7685][5.4856:4930](),[5.4856][5.4856:4930](),[5.4930][5.6339:6429](),[5.6429][5.4988:4989](),[5.7766][5.4988:4989](),[5.12084][5.4988:4989](),[5.4988][5.4988:4989](),[5.4989][5.6430:6831](),[5.6733][5.5163:5169](),[5.6831][5.5163:5169](),[5.8158][5.5163:5169](),[5.12406][5.5163:5169](),[5.5163][5.5163:5169](),[5.5169][5.9665:9689](),[5.5196][5.3528:3558](),[5.9689][5.3528:3558](),[5.45287][5.3528:3558](),[5.3528][5.3528:3558](),[5.3558][5.9690:9865]()
    #### EXAMPLES
    `run main.js`
    * Runs the script using default values.
    `run main.js --job-cap 4000 -i "harakiri-sushi" -r 0.7 --steal-cap=0.5 -ao --no-botnet`
    * Runs the script with up to 4000 jobs, targetting "harakiri-sushi", only upgrading/replacing servers when at least 0.7 of your network's total RAM is being used, and stealing only up to 50% of harakiri-sushi's cash per "hack.js" job that finishes executing, whilst the remaining variables are set to defaults. The "ram.js", "tor.js" and "botnet.js" helper scripts are also prevented from starting.
    ---
    ### "kill.js" (2.55 GB)
    * Kill all running scripts.
    * Optionally, kill only named scripts instead.
    * Optionally, kill only scripts on named servers instead.
    * Optionally, kill only named scripts on named servers instead.
  • edit in README.md at line 53
    [5.3559][5.5197:5208](),[5.5208][5.9866:9897]()
    #### USAGE
    `run kill.js [OPTIONS ...]`
  • replacement in README.md at line 54
    [5.9910][5.9910:9936]()
    `-c, --script <SCRIPT>`
    [5.9910]
    [5.9936]
    `-c, --check-delay <SECONDS>`
  • replacement in README.md at line 56
    [5.9937][5.9937:9981]()
    * SCRIPT = The name of a scripts to kill.
    [5.9937]
    [5.9981]
    * SECONDS = The duration of delay between each main loop used in helper scripts, in seconds. Should be a floating-point number > 0. Defaults to 10.
  • replacement in README.md at line 58
    [5.9982][5.9982:10008]()
    `-e, --server <SERVER>`
    [5.9982]
    [5.5242]
    `-d, --job-delay <SECONDS>`
  • replacement in README.md at line 60
    [5.5243][5.10009:10084]()
    * SERVER = The name of a server on which running scripts will be killed.
    [5.5243]
    [5.5392]
    * SECONDS = The duration of delay between each job, in seconds. Should be a floating-point number > 0. Defaults to 1.
  • replacement in README.md at line 62
    [5.5393][5.5393:5407](),[5.5407][5.10085:10178](),[5.10178][5.5442:5443](),[5.5442][5.5442:5443](),[5.5443][5.6734:6837](),[5.6837][5.10179:10505](),[5.6837][5.5546:5552](),[5.10505][5.5546:5552](),[5.5546][5.5546:5552](),[5.5552][5.5716:5740](),[5.5576][5.3600:3651](),[5.5740][5.3600:3651](),[5.45312][5.3600:3651](),[5.3600][5.3600:3651](),[5.3651][5.5577:5651](),[5.5651][5.5741:5797](),[5.5797][5.5703:5774](),[5.5703][5.5703:5774](),[5.5774][5.4665:4691](),[5.4691][5.5805:5806](),[5.5805][5.5805:5806](),[5.5806][5.4692:4902](),[5.4902][5.6022:6023](),[5.6022][5.6022:6023](),[5.6023][5.5798:5943]()
    #### EXAMPLES
    `run kill.js`
    * Kills all running scripts.
    `run kill.js -c grow.js --script hack.js`
    * Kills all scripts named "grow.js" and "hack.js" on any servers that they are currently running on.
    `run kill.js -e home --server harakiri-sushi`
    * Kills all scripts currently running on the "home" and "harakiri-sushi" servers.
    `run kill.js -c grow.js --script hack.js -e home --server harakiri-sushi`
    * Kills all scripts named "grow.js" and "hack.js" currently running on the "home" and "harakiri-sushi" servers.
    ---
    ### "lshw.js" (7.25 GB)
    * Display information about one or more servers.
    * Optionally, display the information at regular intervals.
    #### USAGE
    `run lshw.js [OPTIONS ...] <ARGUMENT [ARGUMENT ...]>`
    * ARGUMENT = Server to display the information about.
    #### OPTIONS
    `-d, --delay <SECONDS>`
    * SECONDS = The duration of delay between update, in seconds. Should be a floating-point number >= 0.001. By default, the script will only display server information once, unless this option is manually set.
    `-p, --precision <INTEGER>`
    * INTEGER = The decimal places to display floating point values with. Should be an integer >= 0. Defaults to 2.
    [5.5393]
    [5.5943]
    `-i, --target <SERVER>`
  • replacement in README.md at line 64
    [5.5944][5.6023:6037](),[5.6023][5.6023:6037](),[5.6037][5.5945:5996]()
    #### EXAMPLES
    `run lshw.js -d 1 --precision=4 home foodnstuff`
    [5.5944]
    [5.6077]
    * SERVER = The server that should be targetted by the `weaken`, `grow` and `hack` functions. Should be a string. Defaults to choosing an optimal target using a scoring system based on the server's maximum cash, growth, required hacking level, and the player's current hacking level.
  • replacement in README.md at line 66
    [5.6078][5.5997:6176]()
    * Causes the terminal to output up-to-date information about the "home" and "foodnstuff" servers every second, using 4 decimal places for the floating point values it displays.
    [5.6078]
    [5.6191]
    `-j, --job-cap <CAP>`
  • replacement in README.md at line 68
    [5.6192][5.6192:6196]()
    ---
    [5.6192]
    [5.3873389]
    * CAP = The maximum amount of jobs to execute per schedule. Should be an integer > 0. Defaults to 300.
  • replacement in README.md at line 70
    [5.3873390][5.45313:45335](),[5.6219][5.3004:3119](),[5.45335][5.3004:3119](),[5.3004][5.3004:3119](),[5.3119][5.3668:3669](),[5.3668][5.3668:3669](),[5.3669][5.6220:6271](),[5.6271][5.3760:3761](),[5.3760][5.3760:3761](),[5.3761][5.6272:6365]()
    ### "cp.js" (2.65 GB)
    * Copy all files that contain particular substring(s) in their filenames from all servers to the current server.
    #### USAGE
    `run cp.js <ARGUMENT [ARGUMENT ...]>`
    * ARGUMENT = Substring contained in the names of files to be copied to the current server.
    [5.3873390]
    [5.3770]
    `-n, --server-name <NAME>`
  • replacement in README.md at line 72
    [5.3771][5.6366:6412]()
    #### EXAMPLES
    `run cp.js .lit .script .txt`
    [5.3771]
    [5.14449]
    * NAME = The name to be used for purchased servers. Should be a string. Defaults to "server".
  • replacement in README.md at line 74
    [5.14450][5.6413:6545]()
    * Copies all files that contain the strings ".lit", ".script" or ".txt" in their filename from all servers to the current server.
    [5.14450]
    [5.3393]
    `-p, --precision <PRECISION>`
  • replacement in README.md at line 76
    [5.3394][5.6546:6550]()
    ---
    [5.3394]
    [5.1992]
    * PRECISION = A value used in determining how many cycles of bisection the binary search algorithm used for the percentage to steal calculator should use. Should be a floating point number > 0 <= 1. Values closer to 0 will result in greater precision in the calculation, but potentially longer run-times and compared to values closer to 1. Defaults to 0.01.
  • replacement in README.md at line 78
    [5.1993][5.6551:6724]()
    ## Installation
    Save all the `.js` files in this repository to the root directory of the "home" server using the same filenames that they currently have in this repository.
    [5.1993]
    [5.3873767]
    `-r, --ram-utilisation <THRESHOLD>`
  • replacement in README.md at line 80
    [5.3873768][5.6725:6729]()
    ---
    [5.3873768]
    [5.2132]
    * THRESHOLD = The botnet's ram utilisation threshold after which upgrades/replacements should be bought for servers and the RAM of "home". Should be a floating point number >= 0 <= 1. Values closer to 0 will result in attempting more frequent upgrades/replacements at the cost of less efficient RAM utilisation to cash spenditure ratios. Defaults to 0.9.
  • replacement in README.md at line 82
    [5.2133][5.3873768:3873779](),[5.3873768][5.3873768:3873779](),[5.3873779][5.12407:12672]()
    ## License
    This Work is distributed and dual-licensed under the terms of both the [MIT License](https://nest.pijul.com/nicoty/bitburner_scripts:master/4bb17ded7a86f7decd) and the [Apache License 2.0](https://nest.pijul.com/nicoty/bitburner_scripts:master/4bb17ded7a86f7de02).
    [5.2133]
    [5.3873924]
    `-s, --steal-cap <CAP>`
  • replacement in README.md at line 84
    [5.3873925][5.3873925:3873942](),[5.3873943][5.3873943:3874158]()
    ### Contribution
    Unless You explicitly state otherwise, any Contribution submitted for inclusion in the Work by You, as defined in the Apache License 2.0, shall be dual-licensed as above, without any additional terms or conditions.
    [5.3873925]
    * CAP = The maximum amount fraction of cash to steal from the target server per `hack` job. Should be an integer >= 0 <=1. Defaults to 0.9.