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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

53 lines
1013 B

#!/usr/bin/env node
const Wappalyzer = require('./driver');
const args = process.argv.slice(2);
const options = {};
let url;
let arg;
while (true) { // eslint-disable-line no-constant-condition
arg = args.shift();
if (!arg) {
break;
}
const matches = /--([^=]+)(?:=(.+))?/.exec(arg);
if (matches) {
const key = matches[1].replace(/-\w/g, _matches => _matches[1].toUpperCase());
const value = matches[2] || true;
options[key] = value;
} else {
url = arg;
}
}
if (!url) {
process.stderr.write('No URL specified\n');
process.exit(1);
}
// eslint-disable-next-line import/no-dynamic-require
const Browser = require(`./browsers/${options.browser || 'zombie'}`);
const wappalyzer = new Wappalyzer(Browser, url, options);
wappalyzer.analyze()
.then((json) => {
process.stdout.write(`${JSON.stringify(json, null, options.pretty ? 2 : null)}\n`);
process.exit(0);
})
.catch((error) => {
process.stderr.write(`${error}\n`);
process.exit(1);
});