Disable robots.txt fetching when tracking is disabled

main
Elbert Alias 8 years ago
parent 123058f69b
commit f4850308e4

@ -266,6 +266,12 @@ wappalyzer.driver.displayApps = (detected, context) => {
*/ */
wappalyzer.driver.getRobotsTxt = (host, secure = false) => { wappalyzer.driver.getRobotsTxt = (host, secure = false) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getOption('tracking', true)
.then(tracking => {
if ( !tracking ) {
return resolve([]);
}
getOption('robotsTxtCache') getOption('robotsTxtCache')
.then(robotsTxtCache => { .then(robotsTxtCache => {
robotsTxtCache = robotsTxtCache || {}; robotsTxtCache = robotsTxtCache || {};
@ -273,7 +279,7 @@ wappalyzer.driver.getRobotsTxt = (host, secure = false) => {
if ( host in robotsTxtCache ) { if ( host in robotsTxtCache ) {
resolve(robotsTxtCache[host]); resolve(robotsTxtCache[host]);
} else { } else {
var url = 'http' + ( secure ? 's' : '' ) + '://' + host + '/robots.txt'; const url = 'http' + ( secure ? 's' : '' ) + '://' + host + '/robots.txt';
fetch('http' + ( secure ? 's' : '' ) + '://' + host + '/robots.txt') fetch('http' + ( secure ? 's' : '' ) + '://' + host + '/robots.txt')
.then(response => { .then(response => {
@ -293,13 +299,12 @@ wappalyzer.driver.getRobotsTxt = (host, secure = false) => {
setOption('robotsTxtCache', robotsTxtCache); setOption('robotsTxtCache', robotsTxtCache);
resolve(robotsTxtCache[host]); resolve(robotsTxtCache[host]);
var hostname = host.replace(/:[0-9]+$/, '')
}) })
.catch(reject); .catch(reject);
} }
}); });
}); });
});
}; };
/** /**