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.
70 lines
1.3 KiB
70 lines
1.3 KiB
(function() {
|
|
var url, json, app, categories, page;
|
|
|
|
try {
|
|
if ( require('system').args.length > 1 ) {
|
|
url = require('system').args[1];
|
|
} else {
|
|
throw new Error('Usage: phantomjs ' + require('system').args[0] + ' <url>');
|
|
}
|
|
|
|
if ( !phantom.injectJs('js/wappalyzer.js') ) {
|
|
throw new Error('Unable to open file js/wappalyzer.js');
|
|
}
|
|
|
|
wappalyzer.driver = {
|
|
/**
|
|
* Log messages to console
|
|
*/
|
|
log: function(args) {
|
|
console.log(args.message);
|
|
},
|
|
|
|
/**
|
|
* Display apps
|
|
*/
|
|
displayApps: function() {
|
|
var count = wappalyzer.detected[url] ? Object.keys(wappalyzer.detected[url]).length.toString() : '0';
|
|
|
|
console.log(count);
|
|
},
|
|
|
|
/**
|
|
* Initialize
|
|
*/
|
|
init: function() {
|
|
json = JSON.parse(require('fs').read('apps.json'));
|
|
|
|
wappalyzer.apps = json.apps;
|
|
wappalyzer.categories = json.categories;
|
|
|
|
page = require('webpage').create();
|
|
|
|
page.onConsoleMessage = function(message) {
|
|
console.log(message);
|
|
};
|
|
|
|
page.open(url, function(status) {
|
|
var a, hostname;
|
|
|
|
a = document.createElement('a');
|
|
|
|
a.href = url.replace(/#.*$/, '');
|
|
|
|
hostname = a.hostname;
|
|
|
|
wappalyzer.analyze(hostname, url, { html: page.content });
|
|
|
|
phantom.exit();
|
|
});
|
|
}
|
|
};
|
|
|
|
wappalyzer.init();
|
|
} catch ( e ) {
|
|
console.error(e);
|
|
|
|
phantom.exit();
|
|
}
|
|
})();
|