From f05b17ee9a622ccb44d26ace88895b0caf4f594f Mon Sep 17 00:00:00 2001 From: etianl <115842502+etianl@users.noreply.github.com> Date: Fri, 6 Jan 2023 01:49:31 -0800 Subject: [PATCH 1/2] Option for how many concurrent connections to use. Can increase scan efficiency with higher numbers, or you can reduce the amount of connections for use on terrible internet connections. Default is 256 --- README.md | 3 ++- scanner.js | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a3265da..705c2b6 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Run `node ./scanner.js [options] --ip ` * `--min-players ` - Minimum number of players. * `--max-players ` - Maximum player count. * `--version ` - Glob expression to filter version (eg- `1.19.*`, or `1.1*.*`). (Default: `*`) +* `--conc ` - How many concurrent connections to use for scanning. (Default is 256) #### Output Options * `--show-desc` - Enable showing of server description in output. @@ -47,5 +48,5 @@ Run `node ./scanner.js [options] --ip ` In this example it took `3.183` seconds to scan `255` IP addresses, and find `85` MineCraft servers. At this speed, a full `/16` (`123.45.0.0 - 123.45.255.255`) will take about `13.5` minutes to scan. ## Limitations -* Fails to scan more than a /16 without kicking the bucket... so you should probably stick to that or smaller ranges. +* Fails to scan more than a /10 without kicking the bucket... so you should probably stick to that or smaller ranges. * Working on a Minecraft bot client... doesn't work though... you can see how badly it doesn't work by using `--enable-client` flag... it is totally broken. **Don't use it**. \ No newline at end of file diff --git a/scanner.js b/scanner.js index 23cac77..02492af 100644 --- a/scanner.js +++ b/scanner.js @@ -13,6 +13,7 @@ var SCAN_OPTS_HOSTS = (process.params['ip']||'0.0.0.0/0').toString(); var SCAN_OPTS_PORTS = (process.params['port'] || MINECRAFT_DEFAULT_PORT).toString(); var SCAN_OPTS_OUTPUT_CSV = (process.params['out']||null); var SCAN_OPTS_VERSION_FILTER = (process.params['version']||'*'); +var SCAN_OPTS_CONCURRENCY = (process.params['conc'] || 256); var CLIENT_TOKEN; if(process.params['geo-ip']) @@ -88,14 +89,14 @@ if(process.params['enable-client'] && !process.params['client-token']) }); } -console.log("Scanning ports " + SCAN_OPTS_PORTS + " on " + SCAN_OPTS_HOSTS); +console.log("Scanning ports " + SCAN_OPTS_PORTS + " on " + SCAN_OPTS_HOSTS + " with " + SCAN_OPTS_CONCURRENCY " connections."); var options = { target: SCAN_OPTS_HOSTS, port: SCAN_OPTS_PORTS, states: 'O', banner: false, - concurrency: 256 + concurrency: SCAN_OPTS_CONCURRENCY } var scan = new Scanner(options); From 73afc7407492624c08b25ed4647c0a8536a6312a Mon Sep 17 00:00:00 2001 From: etianl <115842502+etianl@users.noreply.github.com> Date: Fri, 6 Jan 2023 01:55:43 -0800 Subject: [PATCH 2/2] forgot a + derp --- scanner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scanner.js b/scanner.js index 02492af..a26ad67 100644 --- a/scanner.js +++ b/scanner.js @@ -89,7 +89,7 @@ if(process.params['enable-client'] && !process.params['client-token']) }); } -console.log("Scanning ports " + SCAN_OPTS_PORTS + " on " + SCAN_OPTS_HOSTS + " with " + SCAN_OPTS_CONCURRENCY " connections."); +console.log("Scanning ports " + SCAN_OPTS_PORTS + " on " + SCAN_OPTS_HOSTS + " with " + SCAN_OPTS_CONCURRENCY + " connections."); var options = { target: SCAN_OPTS_HOSTS,