From c6e5f6fb25e1c87cd637bea91207d6925c8805fe Mon Sep 17 00:00:00 2001 From: Rob Date: Sat, 26 Feb 2022 23:32:59 -0600 Subject: [PATCH] bug fixes, final touches --- README.md | 11 +++++++++-- scanner.js | 8 +++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5d8b47e..ae7f031 100644 --- a/README.md +++ b/README.md @@ -14,12 +14,19 @@ Run `node ./scanner.js [options] --ip ` ### CLI Options * `--ip ` - IP Address or Range of IP Addresses with CIDR notation (eg- 192.168.1.0/24) * `--port ` - Ports to look for minecraft servers on. (Default: `25565-25566`) +* `--min-players ` - Minimum number of players. +* `--max-players ` - Maximum player count. + +#### Output Options * `--show-desc` - Enable showing of server description in output. * `--quiet` - Silence terminal output. -* `--min-players ` - Minimum number of players to display. -* `--max-players ` - Only show servers with max player count or below. + + +#### Output File Options * `--out ` - Output to CSV file (Can be opened as a spreadsheet in MS Office, Google Docs, etc.) * `--format ` - Output format (`txt-connect-only` for `ip:port` list format) +* `--log-desc` - Output server discription to output file. + #### Geo Location * `--geo-ip` - Use IP Geolocation database. * `--geo-coords` - Add geo-coordinates to output. diff --git a/scanner.js b/scanner.js index f69877b..8346912 100644 --- a/scanner.js +++ b/scanner.js @@ -118,7 +118,7 @@ scan.on('result', function(data){ var theText = data.ip + ":" + data.port + "\t" + pingRes.version.name + "\t" + pingRes.players.online + " of " + pingRes.players.max + " players"; if(process.params['show-desc']) { - theText += "\t"+pingRes.description.text; + theText += "\t"+pingRes.description.text.replace(/\n/g, ' '); } if (SCAN_OPTS_OUTPUT_CSV) { @@ -127,6 +127,9 @@ scan.on('result', function(data){ { case "txt": line = data.ip + ":" + data.port + "\t" + pingRes.version.name.replace(/\,/g, '+'); + if (process.params['log-desc']) { + line += "\t" + pingRes.description.text.replace(/\n/g, ' '); + } break; case "txt-connect-only": line = data.ip + ":" + data.port; @@ -134,6 +137,9 @@ scan.on('result', function(data){ case "csv": default: line = data.ip + ":" + data.port + "," + pingRes.version.name.replace(/\,/g, '+') + "," + pingRes.players.online + "/" + pingRes.players.max; + if (process.params['log-desc']) { + line += "," + pingRes.description.text.replace(/\n/g, ' ').replace(/\,/g, ';'); + } } if(process.params['geo-ip']) {