From a94bc59dd4db1dc48ef668801872924d36a35072 Mon Sep 17 00:00:00 2001 From: ztimson Date: Sat, 26 Feb 2022 09:39:04 -0500 Subject: [PATCH] Updated network-graph.js --- .gitignore | 1 + README.md | 5 +++-- scripts/network-graph.js | 7 ++++++- 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..722d5e7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vscode diff --git a/README.md b/README.md index 85ed72e..adc4e3f 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ Options: ### [network-graph.js](./scripts/network-graph.js) **RAM:** 3.80 GB -Scan the network for devices and display as an ASCII tree +Scan the network for devices and display as an ASCII tree. ``` [home ~/]> run /scripts/network-graph.js -h Running script with 1 thread(s), pid 138 and args: ["-h"]. @@ -105,7 +105,8 @@ Scan the network for devices and display as an ASCII tree: ├─ foodnstuff (ROOTED) └─ sigma-cosmetics (ROOTED) -Usage: run network-graph.js [OPTIONS] TARGET +Usage: run network-graph.js + run network-graph.js [OPTIONS] TARGET run network-graph.js --help TARGET Starting point to scan from, defaults to home diff --git a/scripts/network-graph.js b/scripts/network-graph.js index 6a75cd1..5e2342d 100644 --- a/scripts/network-graph.js +++ b/scripts/network-graph.js @@ -74,6 +74,7 @@ export async function main(ns) { const argParser = new ArgParser({ desc: 'Scan the network for devices and display as an ASCII tree:\n ├─ n00dles (ROOTED)\n | └─ max-hardware (80|1)\n | └─ neo-net (50|1)\n ├─ foodnstuff (ROOTED)\n └─ sigma-cosmetics (ROOTED)', examples: [ + 'run network-graph.js', 'run network-graph.js [OPTIONS] TARGET', 'run network-graph.js --help', ], @@ -120,10 +121,14 @@ export async function main(ns) { const last = i == arr.length - 1; const branch = last ? '└─ ' : '├─ '; ns.tprint(`${spacer}${branch}${key}`); - render(tree[key], spacer + (last ? ' ' : '| ')); + render(tree[key], spacer + (last ? ' ' : '| ')); }); } const network = scan(start); render(network); } + +export function autocomplete(data) { + return [...data.servers]; +}