-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdomainbot.js
More file actions
executable file
·54 lines (48 loc) · 2.2 KB
/
Copy pathdomainbot.js
File metadata and controls
executable file
·54 lines (48 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env node
const program = require('commander');
const pck = require('./package.json');
const domainbot = require('./src');
function convertStringToBool(str) {
return JSON.parse(str.toLowerCase());
}
program
.version(pck.version)
.option('-p, --proxy <boolean>', 'turn proxies on or off. defaults to true')
.option('-P, --proxycount <number>', 'define the number of proxies to use')
.option('-w, --wait <number>', 'define the time to wait between calls (ms)')
.option('-m, --mock', 'mock run (dont call whois servers)');
program
.command('search <word>')
.description('Thesaurus synonyms domain search against all extensions')
.option('-p, --proxy <boolean>', 'turn proxies on or off. defaults to true')
.option('-P, --proxycount <number>', 'define the number of proxies to use')
.option('-w, --wait <number>', 'define the time to wait between calls (ms)')
.option('-m, --mock', 'mock run (dont call whois servers)')
.action((word, config) => {
const options = {
verbose: true,
};
if (config.proxy !== undefined) options.proxy = convertStringToBool(config.proxy);
if (config.proxycount) options.proxycount = config.proxycount;
if (config.wait) options.wait = config.wait;
if (config.mock) options.mock = config.mock;
domainbot.synonyms(word, options);
});
program
.command('check <word>')
.description('Single word domain search against all extensions')
.option('-p, --proxy <boolean>', 'turn proxies on or off. defaults to true')
.option('-P, --proxycount <number>', 'define the number of proxies to use')
.option('-w, --wait <number>', 'define the time to wait between calls (ms)')
.option('-m, --mock', 'mock run (dont call whois servers)')
.action((word, config) => {
const options = {
verbose: true,
};
if (config.proxy !== undefined) options.proxy = convertStringToBool(config.proxy);
if (config.proxycount) options.proxycount = config.proxycount;
if (config.wait) options.wait = config.wait;
if (config.mock) options.mock = config.mock;
domainbot.check(word, options);
});
program.parse(process.argv);