|
|
@ -37,6 +37,8 @@ class Driver {
|
|
|
|
this.wappalyzer.apps = json.apps;
|
|
|
|
this.wappalyzer.apps = json.apps;
|
|
|
|
this.wappalyzer.categories = json.categories;
|
|
|
|
this.wappalyzer.categories = json.categories;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.wappalyzer.parseJsPatterns();
|
|
|
|
|
|
|
|
|
|
|
|
this.wappalyzer.driver.log = (message, source, type) => this.log(message, source, type);
|
|
|
|
this.wappalyzer.driver.log = (message, source, type) => this.log(message, source, type);
|
|
|
|
this.wappalyzer.driver.displayApps = detected => this.displayApps(detected);
|
|
|
|
this.wappalyzer.driver.displayApps = detected => this.displayApps(detected);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -120,34 +122,17 @@ class Driver {
|
|
|
|
.finally(() => {
|
|
|
|
.finally(() => {
|
|
|
|
this.timer('browser.wait end');
|
|
|
|
this.timer('browser.wait end');
|
|
|
|
|
|
|
|
|
|
|
|
const headers = {};
|
|
|
|
const headers = this.getHeaders(browser);
|
|
|
|
|
|
|
|
const html = this.getHtml(browser);
|
|
|
|
browser.resources['0'].response.headers._headers.forEach(header => {
|
|
|
|
const scripts = this.getScripts(browser);
|
|
|
|
if ( !headers[header[0]] ){
|
|
|
|
const js = this.getJs(browser);
|
|
|
|
headers[header[0]] = [];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
headers[header[0]].push(header[1]);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let html = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
console.log(js);
|
|
|
|
html = browser.html();
|
|
|
|
|
|
|
|
} catch ( e ) {
|
|
|
|
|
|
|
|
this.wappalyzer.log(error.message, 'browser', 'error');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const vars = Object.getOwnPropertyNames(browser.window);
|
|
|
|
|
|
|
|
const scripts = Array.prototype.slice
|
|
|
|
|
|
|
|
.apply(browser.document.scripts)
|
|
|
|
|
|
|
|
.filter(s => s.src)
|
|
|
|
|
|
|
|
.map(s => s.src);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.wappalyzer.analyze(pageUrl.hostname, pageUrl.href, {
|
|
|
|
this.wappalyzer.analyze(pageUrl.hostname, pageUrl.href, {
|
|
|
|
headers,
|
|
|
|
headers,
|
|
|
|
html,
|
|
|
|
html,
|
|
|
|
env: vars,
|
|
|
|
js,
|
|
|
|
scripts
|
|
|
|
scripts
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -160,6 +145,70 @@ class Driver {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getHeaders(browser) {
|
|
|
|
|
|
|
|
const headers = {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
browser.resources['0'].response.headers._headers.forEach(header => {
|
|
|
|
|
|
|
|
if ( !headers[header[0]] ){
|
|
|
|
|
|
|
|
headers[header[0]] = [];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
headers[header[0]].push(header[1]);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return headers;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getHtml(browser) {
|
|
|
|
|
|
|
|
let html = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
html = browser.html();
|
|
|
|
|
|
|
|
} catch ( e ) {
|
|
|
|
|
|
|
|
this.wappalyzer.log(error.message, 'browser', 'error');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return html;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getScripts(browser) {
|
|
|
|
|
|
|
|
const scripts = Array.prototype.slice
|
|
|
|
|
|
|
|
.apply(browser.document.scripts)
|
|
|
|
|
|
|
|
.filter(s => s.src)
|
|
|
|
|
|
|
|
.map(s => s.src);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return scripts;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getJs(browser) {
|
|
|
|
|
|
|
|
const patterns = this.wappalyzer.jsPatterns;
|
|
|
|
|
|
|
|
const js = {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object.keys(patterns).forEach(appName => {
|
|
|
|
|
|
|
|
js[appName] = {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object.keys(patterns[appName]).forEach(chain => {
|
|
|
|
|
|
|
|
js[appName][chain] = {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
patterns[appName][chain].forEach((pattern, index) => {
|
|
|
|
|
|
|
|
const properties = chain.split('.');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let value = properties.reduce((parent, property) => {
|
|
|
|
|
|
|
|
return parent && parent.hasOwnProperty(property) ? parent[property] : null;
|
|
|
|
|
|
|
|
}, browser.window);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
value = typeof value === 'string' ? value : !!value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( value ) {
|
|
|
|
|
|
|
|
js[appName][chain][index] = value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return js;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
crawl(pageUrl, index = 1, depth = 1) {
|
|
|
|
crawl(pageUrl, index = 1, depth = 1) {
|
|
|
|
this.timer('crawl');
|
|
|
|
this.timer('crawl');
|
|
|
|
|
|
|
|
|
|
|
|