Total Complexity | 7 |
Complexity/F | 1.75 |
Lines of Code | 47 |
Function Count | 4 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | #!/usr/bin/env node |
||
2 | 'use strict'; |
||
3 | |||
4 | const Wappalyzer = require('./driver'); |
||
5 | |||
6 | const args = process.argv.slice(2); |
||
7 | |||
8 | const url = args.shift() || ''; |
||
9 | |||
10 | if ( !url ) { |
||
11 | process.stderr.write('No URL specified\n'); |
||
12 | |||
13 | process.exit(1); |
||
14 | } |
||
15 | |||
16 | var options = {}; |
||
17 | var arg; |
||
18 | |||
19 | while ( arg = args.shift() ) { |
||
20 | var matches = /--([^=]+)=(.+)/.exec(arg); |
||
21 | |||
22 | if ( matches ) { |
||
23 | var key = matches[1].replace(/-\w/g, matches => matches[1].toUpperCase()); |
||
24 | var value = matches[2]; |
||
25 | |||
26 | options[key] = value; |
||
27 | } |
||
28 | } |
||
29 | |||
30 | const wappalyzer = new Wappalyzer(url, options); |
||
31 | |||
32 | setTimeout(() => { |
||
33 | console.log('force quit'); |
||
34 | |||
35 | process.exit(1); |
||
36 | }, 10000); |
||
37 | |||
38 | wappalyzer.analyze() |
||
39 | .then(json => { |
||
40 | process.stdout.write(JSON.stringify(json) + '\n') |
||
41 | |||
42 | process.exit(0); |
||
43 | }) |
||
44 | .catch(error => { |
||
45 | process.stderr.write(error + '\n') |
||
46 | |||
47 | process.exit(1); |
||
48 | }); |
||
49 |