bug fixes, final touches

This commit is contained in:
Rob
2022-02-26 23:32:59 -06:00
parent 8a68e61c0f
commit c6e5f6fb25
2 changed files with 16 additions and 3 deletions

View File

@@ -14,12 +14,19 @@ Run `node ./scanner.js [options] --ip <ip range>`
### CLI Options ### CLI Options
* `--ip <ip>` - IP Address or Range of IP Addresses with CIDR notation (eg- 192.168.1.0/24) * `--ip <ip>` - IP Address or Range of IP Addresses with CIDR notation (eg- 192.168.1.0/24)
* `--port <ports>` - Ports to look for minecraft servers on. (Default: `25565-25566`) * `--port <ports>` - Ports to look for minecraft servers on. (Default: `25565-25566`)
* `--min-players <count>` - Minimum number of players.
* `--max-players <count>` - Maximum player count.
#### Output Options
* `--show-desc` - Enable showing of server description in output. * `--show-desc` - Enable showing of server description in output.
* `--quiet` - Silence terminal output. * `--quiet` - Silence terminal output.
* `--min-players <count>` - Minimum number of players to display.
* `--max-players <count>` - Only show servers with max player count or below.
#### Output File Options
* `--out <filename>` - Output to CSV file (Can be opened as a spreadsheet in MS Office, Google Docs, etc.) * `--out <filename>` - Output to CSV file (Can be opened as a spreadsheet in MS Office, Google Docs, etc.)
* `--format <csv|txt|txt-connect-only>` - Output format (`txt-connect-only` for `ip:port` list format) * `--format <csv|txt|txt-connect-only>` - Output format (`txt-connect-only` for `ip:port` list format)
* `--log-desc` - Output server discription to output file.
#### Geo Location #### Geo Location
* `--geo-ip` - Use IP Geolocation database. * `--geo-ip` - Use IP Geolocation database.
* `--geo-coords` - Add geo-coordinates to output. * `--geo-coords` - Add geo-coordinates to output.

View File

@@ -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"; var theText = data.ip + ":" + data.port + "\t" + pingRes.version.name + "\t" + pingRes.players.online + " of " + pingRes.players.max + " players";
if(process.params['show-desc']) if(process.params['show-desc'])
{ {
theText += "\t"+pingRes.description.text; theText += "\t"+pingRes.description.text.replace(/\n/g, ' ');
} }
if (SCAN_OPTS_OUTPUT_CSV) if (SCAN_OPTS_OUTPUT_CSV)
{ {
@@ -127,6 +127,9 @@ scan.on('result', function(data){
{ {
case "txt": case "txt":
line = data.ip + ":" + data.port + "\t" + pingRes.version.name.replace(/\,/g, '+'); 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; break;
case "txt-connect-only": case "txt-connect-only":
line = data.ip + ":" + data.port; line = data.ip + ":" + data.port;
@@ -134,6 +137,9 @@ scan.on('result', function(data){
case "csv": case "csv":
default: default:
line = data.ip + ":" + data.port + "," + pingRes.version.name.replace(/\,/g, '+') + "," + pingRes.players.online + "/" + pingRes.players.max; 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']) if(process.params['geo-ip'])
{ {