rm.js: fix incorrect logic, refactor. lib_servers.js: refactor. README.md: clarify confusing "hacker.js" troubleshooting explanation.

[?]
Oct 12, 2020, 12:43 AM
EDSOZNELN4QFPJ4RGPWTWVL5IWEET5DGFAMNN3QQYBR7S3OAG2GQC

Dependencies

  • [2] VTCBEUHD README.md: add clarification and extra information.
  • [3] 7SRULDRF minor refactoring.
  • [4] 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.
  • [5] 5DIUM5GJ hacknet.js: convert from helper script to stand-alone script. main.js, README.md: update to accommodate "hacknet.js" changes. README.md: add "Troubleshooting" section and alter misleading information about required server for installation.
  • [6] TDBVUKLO cache some calculations which should increase performance.
  • [7] 2BKHJI2S init
  • [8] FBAPT2WW executables: dynamically load help messages. lshw.js, main.js: add options to change score correction method and score factor multipliers. README.md: update.
  • [9] DJDWBCCQ add missing "nop.js". killall.js: rename to kill.js. add `--script` and `--server` options.
  • [10] 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.

Change contents

  • replacement in lib/lib_servers.js at line 4
    [3.3713867][3.2643:2692](),[3.2692][3.5059:5156](),[3.5156][3.2767:2775](),[3.2767][3.2767:2775](),[3.2775][3.5585:5619](),[3.5619][3.5157:5206](),[3.5206][3.5668:5695](),[3.5668][3.5668:5695](),[3.5695][3.2876:2882](),[3.2876][3.2876:2882](),[3.2882][3.5207:5351](),[3.5351][3.2883:2893](),[3.5773][3.2883:2893](),[3.3714167][3.2883:2893](),[3.2893][3.5774:5815](),[3.5815][3.5352:5413](),[3.5413][3.5876:5910](),[3.5876][3.5876:5910](),[3.5910][3.3005:3011](),[3.3005][3.3005:3011](),[3.3011][3.5911:6071](),[3.6071][3.3714435:3714439](),[3.3714435][3.3714435:3714439]()
    export const array_get_servers = function (ns) {
    const
    array_servers = [ns.getHostname()],
    array_servers_length = array_servers.length;
    for (
    let integer_index_server = 0;
    integer_index_server < array_servers_length;
    ++integer_index_server
    ) {
    const
    array_scan_results = ns.scan(array_servers[integer_index_server]),
    array_scan_results_length = array_scan_results.length;
    for (
    let integer_index_scan_result = 0;
    integer_index_scan_result < array_scan_results_length;
    ++integer_index_scan_result
    )
    -1 === array_servers.indexOf(array_scan_results[integer_index_scan_result]) &&
    array_servers.push(array_scan_results[integer_index_scan_result]);
    }
    [3.3713867]
    [3.3714439]
    export const array_get_servers = (ns) => {
    const array_servers = [ns.getHostname()];
    array_servers.forEach(string_server => {
    ns.scan(string_server).forEach(string_scan_result => {
    -1 === array_servers.indexOf(string_scan_result) &&
    array_servers.push(string_scan_result);
    });
    });
  • replacement in lib/lib_servers.js at line 13
    [3.3714463][3.3714463:3714465]()
    };
    [3.3714463]
    };
  • edit in bin/rm.js at line 7
    [3.3788153]
    [3.3788153]
    import {
    array_get_servers
    } from "lib_servers.js";
  • replacement in bin/rm.js at line 12
    [3.3788167][3.3788167:3788475]()
    const object_get_constants = function () {
    return {
    object_argument_names: {
    file_regex: {
    short: "f",
    long: "file",
    },
    server_regex: {
    short: "e",
    long: "server",
    },
    help: {
    short: "h",
    long: "help",
    },
    }
    };
    };
    [3.3788167]
    [3.3788475]
    const object_get_constants = () => ({
    object_argument_names: {
    file_regex: {
    short: "f",
    long: "file"
    },
    server_regex: {
    short: "e",
    long: "server"
    },
    help: {
    short: "h",
    long: "help"
    },
    },
    });
  • replacement in bin/rm.js at line 29
    [3.3788476][3.3788476:3788516]()
    const void_print_help = function (ns) {
    [3.3788476]
    [3.3788516]
    const void_print_help = (ns) => {
  • edit in bin/rm.js at line 60
    [3.3789639][3.3789639:3789683]()
    const array_servers = [ns.getHostname()];
  • replacement in bin/rm.js at line 61
    [3.3789731][3.3789731:3789768]()
    const array_server_regexes = [];
    [3.3789731]
    [3.3789768]
    const
    array_server_regexes = [],
    array_servers_matching_regexes = [];
  • replacement in bin/rm.js at line 67
    [3.3789907][3.3789907:3790340]()
    array_servers.forEach(string_server => {
    const array_scan_results = ns.scan(string_server);
    array_scan_results.forEach(string_scan_result => {
    array_server_regexes.forEach(object_server_regex => {
    if (
    object_server_regex.test(string_scan_result) &&
    array_servers.indexOf(string_scan_result) === -1
    )
    array_servers.push(string_scan_result);
    });
    [3.3789907]
    [3.3790340]
    array_get_servers(ns).forEach(string_server => {
    array_server_regexes.forEach(object_server_regex => {
    object_server_regex.test(string_server) &&
    array_servers_matching_regexes.push(string_server);
  • edit in bin/rm.js at line 73
    [3.3790358]
    [3.3790358]
    return array_servers_matching_regexes;
  • replacement in bin/rm.js at line 75
    [3.3790369][3.3790369:3790658]()
    array_servers.forEach(string_server => {
    const array_scan_results = ns.scan(string_server);
    array_scan_results.forEach(string_scan_result => {
    if (array_servers.indexOf(string_scan_result) === -1)
    array_servers.push(string_scan_result);
    });
    });
    [3.3790369]
    [3.3790658]
    return array_get_servers(ns);
  • edit in bin/rm.js at line 77
    [3.3790662][3.3790662:3790686]()
    return array_servers;
  • replacement in bin/rm.js at line 87
    [3.3790888][3.3790888:3790912]()
    array_files = [];
    [3.3790888]
    [3.3790912]
    array_files_matching_regexes = [];
  • replacement in bin/rm.js at line 93
    [3.3791149][3.3791149:3791239]()
    if (object_file_regex.test(string_file))
    array_files.push(string_file);
    [3.3791149]
    [3.3791239]
    object_file_regex.test(string_file) &&
    array_files_matching_regexes.push(string_file);
  • replacement in bin/rm.js at line 97
    [3.3791257][3.3791257:3791281]()
    return array_files;
    [3.3791257]
    [3.3791281]
    return array_files_matching_regexes;
  • replacement in bin/rm.js at line 132
    [3.3791982][3.3791982:3792024]()
    export const main = async function (ns) {
    [3.3791982]
    [3.3792024]
    export const main = async (ns) => {
  • edit in bin/main.js at line 4
    [3.1652][3.9668:9773]()
    * use the same server choosing logic used in hacker.js for picking which server to run helper scripts on
  • replacement in README.md at line 339
    [3.11061][2.3380:3790]()
    * Make sure there is enough RAM (see requirements in the "Overview" section above) on the server that you ran "main.js" from and that there are no scripts running on that server before "hacker.js" has a chance to get spawned into it. Sometimes, "weaken_manager.js" will run "cyclic_weaken.js" on that server so you might need to kill any instances of the latter on that server before "hacker.js" is spawned.
    [3.11061]
    [3.11463]
    * Make sure there is enough RAM for "hacker.js" (see requirements in the "Overview" section above) on the server that you ran "main.js" from. Sometimes, "weaken_manager.js" will run "cyclic_weaken.js" on that server so you might need to look out for and kill any instances of the latter that get executed on that server before "hacker.js" has a chance to get spawned.