parent
dd42af58c7
commit
7f50cc97cd
@ -1 +0,0 @@
|
||||
drivers/firefox/wappalyzer.xpi
|
@ -1,85 +1,98 @@
|
||||
(function() {
|
||||
var self = {
|
||||
debug: true,
|
||||
element: false,
|
||||
prevUrl: '',
|
||||
|
||||
var c = {
|
||||
init: function() {
|
||||
self.log('init');
|
||||
c.log('init');
|
||||
|
||||
self.onPageLoad();
|
||||
},
|
||||
chrome.extension.sendRequest({ id: 'analyze', subject: { html: document.documentElement.innerHTML } });
|
||||
|
||||
log: function(message) {
|
||||
if ( self.debug && message ) {
|
||||
console.log("Wappalyzer content.js: " + message);
|
||||
}
|
||||
c.getEnvironmentVars();
|
||||
c.getResponseHeaders();
|
||||
},
|
||||
|
||||
onPageLoad: function(e) {
|
||||
self.log('onPageLoad');
|
||||
|
||||
if ( document.body ) {
|
||||
self.getEnvironmentVars();
|
||||
}
|
||||
log: function(message) {
|
||||
chrome.extension.sendRequest({ id: 'log', message: '[ content.js ] ' + message });
|
||||
},
|
||||
|
||||
getEnvironmentVars: function() {
|
||||
self.log('getEnvironmentVars');
|
||||
c.log('getEnvironmentVars');
|
||||
|
||||
if ( typeof document.documentElement.innerHTML === 'undefined' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var environmentVars = '';
|
||||
|
||||
try {
|
||||
var element = document.createElement('wappalyzerData');
|
||||
var container = document.createElement('wappalyzerData');
|
||||
|
||||
element.setAttribute('id', 'wappalyzerData');
|
||||
element.setAttribute('style', 'display: none');
|
||||
container.setAttribute('id', 'wappalyzerData');
|
||||
container.setAttribute('style', 'display: none');
|
||||
|
||||
var script = document.createElement('script');
|
||||
|
||||
script.setAttribute('id', 'wappalyzerEnvDetection');
|
||||
script.setAttribute('id', 'text/javascript');
|
||||
|
||||
script.innerHTML = '(function() {' +
|
||||
script.innerHTML =
|
||||
'(function() {' +
|
||||
'try {' +
|
||||
'var event = document.createEvent("Events");' +
|
||||
'var i, environmentVars, event = document.createEvent("Events");' +
|
||||
'event.initEvent("wappalyzerEvent", true, false);' +
|
||||
'var environmentVars = "";' +
|
||||
'for ( var i in window ) { environmentVars += i + " "; }' +
|
||||
'for ( i in window ) { environmentVars += i + " "; }' +
|
||||
'document.getElementById("wappalyzerData").appendChild(document.createComment(environmentVars));' +
|
||||
'document.getElementById("wappalyzerData").dispatchEvent(event);' +
|
||||
'}' +
|
||||
'catch(e) { }' +
|
||||
'})();';
|
||||
|
||||
element.addEventListener('wappalyzerEvent', (function(event) {
|
||||
environmentVars = event.target.childNodes[0].nodeValue;
|
||||
|
||||
self.log('getEnvironmentVars: ' + environmentVars);
|
||||
container.addEventListener('wappalyzerEvent', (function(event) {
|
||||
var environmentVars = event.target.childNodes[0].nodeValue;
|
||||
|
||||
document.documentElement.removeChild(element);
|
||||
document.documentElement.removeChild(container);
|
||||
document.documentElement.removeChild(script);
|
||||
|
||||
chrome.extension.sendRequest({
|
||||
html: document.documentElement.innerHTML,
|
||||
msg: 'analyze',
|
||||
env: environmentVars.split(' ')
|
||||
});
|
||||
c.log('getEnvironmentVars: ' + environmentVars);
|
||||
|
||||
environmentVars = environmentVars.split(' ');
|
||||
|
||||
chrome.extension.sendRequest({ id: 'analyze', subject: { env: environmentVars } });
|
||||
}), true);
|
||||
|
||||
document.documentElement.appendChild(element);
|
||||
document.documentElement.appendChild(container);
|
||||
document.documentElement.appendChild(script);
|
||||
} catch(e) { }
|
||||
} catch(e) {
|
||||
c.log('Error: ' + e);
|
||||
}
|
||||
},
|
||||
|
||||
getResponseHeaders: function() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
||||
xhr.open('GET', window.location, true);
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
if ( xhr.readyState === 4 && xhr.status ) {
|
||||
var headers = xhr.getAllResponseHeaders().split("\n");
|
||||
|
||||
if ( headers.length > 0 && headers[0] != '' ) {
|
||||
c.log('responseHeaders: ' + xhr.getAllResponseHeaders());
|
||||
|
||||
var responseHeaders = {};
|
||||
|
||||
return environmentVars;
|
||||
headers.forEach(function(line) {
|
||||
if ( line ) {
|
||||
name = line.substring(0, line.indexOf(': '));
|
||||
value = line.substring(line.indexOf(': ') + 2, line.length - 1);
|
||||
|
||||
responseHeaders[name] = value;
|
||||
}
|
||||
});
|
||||
|
||||
chrome.extension.sendRequest({ id: 'analyze', subject: { headers: responseHeaders } });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
}
|
||||
|
||||
self.init();
|
||||
|
||||
return self;
|
||||
c.init();
|
||||
})();
|
||||
|
@ -0,0 +1,31 @@
|
||||
categoryNames = {
|
||||
1: 'CMS',
|
||||
2: 'Message Board',
|
||||
3: 'Database Manager',
|
||||
4: 'Documentation Tool',
|
||||
5: 'Widget',
|
||||
6: 'Web Shop',
|
||||
7: 'Photo Gallery',
|
||||
8: 'Wiki',
|
||||
9: 'Hosting Panel',
|
||||
10: 'Analytics',
|
||||
11: 'Blog',
|
||||
12: 'Javascript Framework',
|
||||
13: 'Issue Tracker',
|
||||
14: 'Video Player',
|
||||
15: 'Comment System',
|
||||
16: 'Captcha',
|
||||
17: 'Font Script',
|
||||
18: 'Web Framework',
|
||||
19: 'Miscellaneous',
|
||||
20: 'Editor',
|
||||
21: 'LMS',
|
||||
22: 'Web Server',
|
||||
23: 'Cache Tool',
|
||||
24: 'Rich Text Editor',
|
||||
25: 'Javascript Graphics',
|
||||
26: 'Mobile Framework',
|
||||
27: 'Programming Language',
|
||||
28: 'Operating System',
|
||||
29: 'Search Engine'
|
||||
};
|
@ -0,0 +1 @@
|
||||
wappalyzer.xpi
|
Loading…
Reference in new issue