You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
760 B
46 lines
760 B
#!/usr/bin/env node
|
|
|
|
|
|
const Wappalyzer = require('./driver');
|
|
|
|
const args = process.argv.slice(2);
|
|
|
|
const url = args.shift() || '';
|
|
|
|
if (!url) {
|
|
process.stderr.write('No URL specified\n');
|
|
|
|
process.exit(1);
|
|
}
|
|
|
|
const options = {};
|
|
|
|
let arg;
|
|
|
|
do {
|
|
arg = args.shift();
|
|
|
|
const matches = /--([^=]+)=(.+)/.exec(arg);
|
|
|
|
if (matches) {
|
|
const key = matches[1].replace(/-\w/g, _matches => _matches[1].toUpperCase());
|
|
const value = matches[2];
|
|
|
|
options[key] = value;
|
|
}
|
|
} while (arg);
|
|
|
|
const wappalyzer = new Wappalyzer(url, options);
|
|
|
|
wappalyzer.analyze()
|
|
.then((json) => {
|
|
process.stdout.write(`${JSON.stringify(json)}\n`);
|
|
|
|
process.exit(0);
|
|
})
|
|
.catch((error) => {
|
|
process.stderr.write(`${error}\n`);
|
|
|
|
process.exit(1);
|
|
});
|