-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add a little tool that runs multiple protocols for an ip
- Loading branch information
1 parent
da464a5
commit c264138
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import Minimist from 'minimist' | ||
import GameDig from './../lib/index.js' | ||
|
||
const argv = Minimist(process.argv.slice(2), {}) | ||
|
||
const options = {} | ||
if (argv._.length >= 1) { | ||
const target = argv._[0] | ||
const split = target.split(':') | ||
options.host = split[0] | ||
if (split.length >= 2) { | ||
options.port = split[1] | ||
} | ||
} | ||
|
||
const gamedig = new GameDig(options) | ||
|
||
const protocols = ['valve', 'gamespy1', 'gamespy2', 'gamespy3', 'goldsrc', 'minecraft', 'quake1', 'quake2', 'quake3', 'unreal2', 'valve'] | ||
|
||
protocols.forEach(protocol => { | ||
gamedig.query({ | ||
...options, | ||
debug: true, | ||
type: `protocol-${protocol}` | ||
}) | ||
.then(data => { | ||
console.log(data) | ||
process.exit() | ||
}) | ||
.catch(error => { | ||
console.log(`Error on '${protocol}': ${error}`) | ||
}) | ||
}) |