@ -0,0 +1,20 @@
|
|||||||
|
class Browser {
|
||||||
|
constructor(options) {
|
||||||
|
this.options = options;
|
||||||
|
|
||||||
|
this.window = null;
|
||||||
|
this.document = null;
|
||||||
|
this.statusCode = null;
|
||||||
|
this.contentType = null;
|
||||||
|
this.headers = null;
|
||||||
|
this.statusCode = null;
|
||||||
|
this.contentType = null;
|
||||||
|
this.html = null;
|
||||||
|
this.js = null;
|
||||||
|
this.links = null;
|
||||||
|
this.scripts = null;
|
||||||
|
this.cookies = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Browser;
|
@ -0,0 +1,121 @@
|
|||||||
|
const Zombie = require('zombie');
|
||||||
|
const Browser = require('../browser');
|
||||||
|
|
||||||
|
class ZombieBrowser extends Browser {
|
||||||
|
constructor(options) {
|
||||||
|
super(options);
|
||||||
|
|
||||||
|
this.browser = new Zombie({
|
||||||
|
proxy: options.proxy,
|
||||||
|
silent: true,
|
||||||
|
strictSSL: false,
|
||||||
|
userAgent: options.userAgent,
|
||||||
|
waitDuration: options.maxWait,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.browser.on('authenticate', (auth) => {
|
||||||
|
auth.username = this.options.username;
|
||||||
|
auth.password = this.options.password;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
visit(url) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
this.browser.visit(url, () => {
|
||||||
|
const resource = this.browser.resources.length
|
||||||
|
? this.browser.resources.filter(_resource => _resource.response).shift() : null;
|
||||||
|
|
||||||
|
this.window = this.browser.window;
|
||||||
|
this.document = this.browser.document;
|
||||||
|
this.headers = this.getHeaders();
|
||||||
|
this.statusCode = resource ? resource.response.status : 0;
|
||||||
|
this.contentType = this.headers['content-type'] ? this.headers['content-type'].shift() : null;
|
||||||
|
this.html = this.getHtml();
|
||||||
|
this.js = this.getJs();
|
||||||
|
this.links = this.getLinks();
|
||||||
|
this.scripts = this.getScripts();
|
||||||
|
this.cookies = this.getCookies();
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getHeaders() {
|
||||||
|
const headers = {};
|
||||||
|
|
||||||
|
const resource = this.browser.resources.length
|
||||||
|
? this.browser.resources.filter(_resource => _resource.response).shift() : null;
|
||||||
|
|
||||||
|
if (resource) {
|
||||||
|
// eslint-disable-next-line no-underscore-dangle
|
||||||
|
resource.response.headers._headers.forEach((header) => {
|
||||||
|
if (!headers[header[0]]) {
|
||||||
|
headers[header[0]] = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
headers[header[0]].push(header[1]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
getHtml() {
|
||||||
|
let html = '';
|
||||||
|
|
||||||
|
if (this.browser.document && this.browser.document.documentElement) {
|
||||||
|
try {
|
||||||
|
html = this.browser.html();
|
||||||
|
} catch (error) {
|
||||||
|
this.log(error.message, 'error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
|
||||||
|
getScripts() {
|
||||||
|
let scripts = [];
|
||||||
|
|
||||||
|
if (this.browser.document && this.browser.document.scripts) {
|
||||||
|
scripts = Array.prototype.slice
|
||||||
|
.apply(this.browser.document.scripts)
|
||||||
|
.filter(script => script.src)
|
||||||
|
.map(script => script.src);
|
||||||
|
}
|
||||||
|
|
||||||
|
return scripts;
|
||||||
|
}
|
||||||
|
|
||||||
|
getJs() {
|
||||||
|
return this.browser.window;
|
||||||
|
}
|
||||||
|
|
||||||
|
getLinks() {
|
||||||
|
let links = [];
|
||||||
|
|
||||||
|
if (this.browser.document) {
|
||||||
|
links = Array.from(this.browser.document.getElementsByTagName('a'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return links;
|
||||||
|
}
|
||||||
|
|
||||||
|
getCookies() {
|
||||||
|
const cookies = [];
|
||||||
|
|
||||||
|
if (this.browser.cookies) {
|
||||||
|
this.browser.cookies.forEach(cookie => cookies.push({
|
||||||
|
name: cookie.key,
|
||||||
|
value: cookie.value,
|
||||||
|
domain: cookie.domain,
|
||||||
|
path: cookie.path,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
return cookies;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = ZombieBrowser;
|
@ -0,0 +1,45 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
const Wappalyzer = require('./driver');
|
||||||
|
const Browser = require('./browsers/zombie');
|
||||||
|
|
||||||
|
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(Browser, 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);
|
||||||
|
});
|
@ -1,45 +1,16 @@
|
|||||||
#!/usr/bin/env node
|
const Driver = require('./driver');
|
||||||
|
const ZombieBrowser = require('./browsers/zombie');
|
||||||
|
|
||||||
|
class Wappalyzer {
|
||||||
|
constructor(pageUrl, options) {
|
||||||
|
this.browser = ZombieBrowser;
|
||||||
|
|
||||||
const Wappalyzer = require('./driver');
|
return new Driver(this.browser, pageUrl, options);
|
||||||
|
|
||||||
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);
|
Wappalyzer.browsers = {
|
||||||
})
|
zombie: ZombieBrowser,
|
||||||
.catch((error) => {
|
};
|
||||||
process.stderr.write(`${error}\n`);
|
|
||||||
|
|
||||||
process.exit(1);
|
module.exports = Wappalyzer;
|
||||||
});
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"webextension-polyfill": "^0.2.1"
|
"webextension-polyfill": "^0.4.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 779 B |
Before Width: | Height: | Size: 682 B |
After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 384 B |
After Width: | Height: | Size: 950 B |
After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 274 B |
Before Width: | Height: | Size: 743 B |
Before Width: | Height: | Size: 642 B |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 100 B After Width: | Height: | Size: 100 B |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 256 B |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 728 B |
After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 671 B After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 649 B After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 497 B |
Before Width: | Height: | Size: 430 B |
Before Width: | Height: | Size: 902 B |
After Width: | Height: | Size: 599 B |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 711 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 432 B |
Before Width: | Height: | Size: 812 B |
After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 334 B |
After Width: | Height: | Size: 771 B |
Before Width: | Height: | Size: 520 B |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 11 KiB |