main.js: fix regression. lib_ls.js: refactor.

[?]
May 17, 2020, 9:58 AM
XUZPBRE6E2XZPQVFLLZ24H6U42SSBJPKCMSCEUVBVXGWXBIUSB3QC

Dependencies

  • [2] IFVY3INI contracts.js: add --verbose and --check-delay options. README.md: update.
  • [3] JS52JD4Q weaken_manager.js: add. lib_server_used.js: move to lib_ram_script. lib_ps: delete. main.js, hacker.js, lib_ram_script.js: refactor. README.md: update.
  • [4] SLSWBNYT added ram utilisation logic to `ram.js` and `servers.js`. split and refactored redundant code into separate library files.
  • [5] SXEJJKPI 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.
  • [6] ZVQK2652 executables: fix help message.
  • [7] JGNALSUQ add "cyclic_weaken.js" feature. hacker.js, main.js, libs: refactor. README.md: update.
  • [8] FCJA5EXS contracts.js: add. README.md: update.
  • [9] 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.
  • [10] FBAPT2WW executables: dynamically load help messages. lshw.js, main.js: add options to change score correction method and score factor multipliers. README.md: update.
  • [11] 2BKHJI2S init
  • [12] AXGQ7FML split and refactor hacking logic to "hacker.js" and argument parsing and script execution logic to "main.js". update "README.md".
  • [13] HSNSECD5 all: refactor. main.js: fix call to `void_kill_script_named_server_named`.
  • [14] ZRPOW4ER hacker.js, lib_time.js: supress error messages. hacker.js: use `getBitNodeMultipliers`. lib_time.js: use `getStats`. README.md: update.
  • [15] EYKBOK3O optimised the scheduling logic by ensuring that cycles start and finish at minimum security of target.

Change contents

  • replacement in lib/lib_ls.js at line 6
    [4.3793][4.3793:3812]()
    string_substring
    [4.3793]
    [4.3812]
    substring
  • replacement in lib/lib_ls.js at line 8
    [4.3816][4.3733784:3733845](),[4.3733784][4.3733784:3733845](),[4.3733845][4.1789:1825](),[4.1825][4.3817:3825](),[4.3733877][4.3817:3825](),[4.3825][4.9483:9595](),[4.9595][4.3934:3940](),[4.3934][4.3934:3940](),[4.3940][4.9596:9663](),[4.9663][4.3941:3987](),[4.3734050][4.3941:3987](),[4.3987][4.1826:1875]()
    const array_files_in_server = ns.ls(string_server_source);
    let array_files_with_string = [];
    for (
    let integer_index_file = 0;
    integer_index_file < array_files_in_server.length;
    ++integer_index_file
    ) {
    const string_file = array_files_in_server[integer_index_file];
    string_file.includes(string_substring) &&
    array_files_with_string.push(string_file);
    [4.3816]
    [4.3734151]
    const array_files_with_string = [];
    const string_type_substring = typeof substring;
    switch (string_type_substring) {
    case "object":
    for (
    let integer_index_substring = 0;
    integer_index_substring < substring.length;
    ++integer_index_substring
    ) {
    const string_substring = substring[integer_index_substring];
    array_files_with_string.push(
    ns.ls(string_server_source, string_substring)
    );
    }
    break;
    case "string":
    array_files_with_string.push(ns.ls(string_server_source, substring));
    break;
    default:
    const string_message_error = `Invalid input "${substring}" of type ${string_type_substring}.`;
    throw (ns.tprint(`ERROR: ${string_message_error}`), new Error(string_message_error));
  • replacement in bin/main.js at line 57
    [2.1618][2.1618:1648]()
    boolean_print_help = !1
    [2.1618]
    [4.9119]
    boolean_print_help: !1,
  • edit in bin/main.js at line 169
    [3.37075]
    [4.11126]
    // script extensions
    array_script_extensions: [
    ".js",
    ".ns",
    ".script"
    ],
  • replacement in bin/main.js at line 200
    [4.12051][4.12051:12140]()
    throw (ns.tprint(`ERROR: ${integer_threads_nop}`), new Error(string_message_error));
    [4.12051]
    [4.12140]
    throw (ns.tprint(`ERROR: ${string_message_error}`), new Error(string_message_error));
  • replacement in bin/main.js at line 555
    [4.29029][4.29029:29284]()
    for (
    let integer_index_file = 0;
    integer_index_file < array_files.length;
    ++integer_index_file
    )
    ns.scp(
    array_files[integer_index_file],
    string_source,
    array_servers[integer_index_server]
    );
    [4.29029]
    [4.29284]
    ns.scp(
    array_files,
    string_source,
    array_servers[integer_index_server]
    );
  • replacement in bin/main.js at line 564
    [4.29389][4.29389:29740]()
    const string_host = ns.getHostname(),
    array_script_extensions = [".js", ".ns", ".script"];
    for (
    let integer_index_extension = 0;
    integer_index_extension < array_script_extensions.length;
    ++integer_index_extension
    ) {
    const string_extension = array_script_extensions[integer_index_extension];
    void_copy_files_to_servers(
    [4.29389]
    [4.29740]
    const string_host = ns.getHostname();
    void_copy_files_to_servers(
    ns,
    array_get_files_with_string(
  • replacement in bin/main.js at line 569
    [4.29750][4.1973:2043](),[4.2043][4.29816:29845](),[4.29816][4.29816:29845]()
    array_get_files_with_string(ns, string_host, string_extension),
    string_host
    );
    }
    [4.29750]
    [4.29845]
    string_host,
    object_get_constants().array_script_extensions
    ),
    string_host
    );
  • replacement in bin/main.js at line 586
    [4.30128][4.30128:30191]()
    const object_script = array_scripts[integer_index_script],
    [4.30128]
    [4.30191]
    const
    object_script = array_scripts[integer_index_script],
  • replacement in bin/cp.js at line 1
    [4.3802495][4.11405:11423]()
    // cp.js - 2.65GB
    [4.3802495]
    [4.10005]
    /* cp.js - 2.65GB - TODO:
    * set default to silent
    * add verbose option
    */
  • replacement in bin/cp.js at line 55
    [4.14790][4.19707:19715](),[4.19707][4.19707:19715](),[4.19715][4.14791:14913](),[4.14913][4.19818:19824](),[4.19818][4.19818:19824](),[4.19824][4.14914:14986](),[4.14986][4.19889:19952](),[4.19889][4.19889:19952]()
    for (
    let integer_index_substring = 0;
    integer_index_substring < array_substrings.length;
    ++integer_index_substring
    ) {
    const string_substring = array_substrings[integer_index_substring];
    void_copy_files_with_to_current(ns, string_substring);
    }
    [4.14790]
    [4.19952]
    void_copy_files_with_to_current(ns, array_substrings);
  • replacement in bin/cp.js at line 82
    [4.20040][4.20040:20062]()
    string_file_to_copy
    [4.20040]
    [4.20062]
    files_to_copy
  • edit in bin/cp.js at line 84
    [4.20066]
    [4.3803266]
    const string_input = JSON.stringify(files_to_copy);
  • replacement in bin/cp.js at line 86
    [4.3803274][4.3803274:3803347]()
    ns.scp(string_file_to_copy, string_server_source, ns.getHostname());
    [4.3803274]
    [4.20067]
    ns.scp(files_to_copy, string_server_source, ns.getHostname());
  • replacement in bin/cp.js at line 88
    [4.20082][4.20082:20180]()
    `Copied the file "${string_file_to_copy}" located in the server "${string_server_source}".`
    [4.20082]
    [4.20180]
    `Copied "${string_input}" located in the server "${string_server_source}".`
  • replacement in bin/cp.js at line 93
    [4.20224][4.4030:4149]()
    `${error}\nAttempted to copy the file "${string_file_to_copy}" located in the server "${string_server_source}".`
    [4.20224]
    [4.20333]
    `${error}\nAttempted to copy "${string_input}" located in the server "${string_server_source}".`
  • replacement in bin/cp.js at line 99
    [4.3804151][4.20341:20415]()
    const void_copy_files_with_to_current = function (ns, string_substring) {
    [4.3804151]
    [4.3804224]
    const void_copy_files_with_to_current = function (ns, substring) {
  • replacement in bin/cp.js at line 106
    [4.20531][4.15496:15566](),[4.15566][4.2152:2209](),[4.2209][4.20651:20737](),[4.20651][4.20651:20737](),[4.20737][4.15567:15683](),[4.15683][4.20850:20858](),[4.20850][4.20850:20858](),[4.20858][4.15684:15759](),[4.15759][4.3804720:3804801](),[4.3804720][4.3804720:3804801]()
    const string_server_source = array_servers[integer_index_server],
    array_files_to_copy = array_get_files_with_string(
    ns,
    string_server_source,
    string_substring
    );
    for (
    let integer_index_file = 0;
    integer_index_file < array_files_to_copy.length;
    ++integer_index_file
    ) {
    const string_file_to_copy = array_files_to_copy[integer_index_file];
    void_copy_to_current(ns, string_server_source, string_file_to_copy);
    }
    [4.20531]
    [4.3804801]
    const
    string_server_source = array_servers[integer_index_server];
    void_copy_to_current(ns, string_server_source, array_get_files_with_string(
    ns,
    string_server_source,
    substring
    ));
  • replacement in bin/contracts.js at line 422
    [2.4610][2.4610:4720]()
    If set, displays messages regarding succesful attempts (in addition to standard failed attempt messages).
    [2.4610]
    [2.4720]
    If set, displays messages regarding successful attempts (in addition to standard failed attempt messages).
  • replacement in README.md at line 181
    [2.5787][2.5787:5897]()
    * If set, displays messages regarding succesful attempts (in addition to standard failed attempt messages).
    [2.5787]
    [2.5897]
    * If set, displays messages regarding successful attempts (in addition to standard failed attempt messages).