Updated tracker

main
ElbertF 12 years ago
parent 2e8802caa5
commit 4eb5af3b0d

@ -29,7 +29,7 @@ var wappalyzer = wappalyzer || (function() {
*/
var w = {
// Cache detected applications per URL
history: [],
ping: {},
detected: [],
config: {
@ -99,8 +99,7 @@ var wappalyzer = wappalyzer || (function() {
var i, app, type, regex, match, content, meta, header, apps = [];
if ( w.history[hostname] == null ) { w.history[hostname] = []; }
if ( w.detected[url] == null ) { w.detected[url] = []; }
if ( w.detected[url] == null ) { w.detected[url] = []; }
if ( data ) {
for ( app in w.apps ) {
@ -211,21 +210,23 @@ var wappalyzer = wappalyzer || (function() {
for ( i in apps ) {
app = apps[i];
// Per hostname
if ( /^[a-z0-9._\-]+\.[a-z]+/.test(hostname) && !/(dev\.|\/admin|\.local)/.test(url) ) {
// Per hostname
var index = -1;
if ( typeof w.ping.hostnames === 'undefined' ) {
w.ping.hostnames = {};
}
w.history[hostname].map(function(data, i) {
if ( data.app === app ) { index = i; }
});
if ( typeof w.ping.hostnames[hostname] === 'undefined' ) {
w.ping.hostnames[hostname] = { applications: {} };
}
if ( index === -1 ) {
w.history[hostname].push({ app: app, hits: 1 });
} else {
w.history[hostname][index].hits ++;
if ( typeof w.ping.hostnames[hostname].applications[app] === 'undefined' ) {
w.ping.hostnames[hostname].applications[app] = 1;
}
if ( Object.keys(w.history).length >= 200 ) { driver('track'); }
w.ping.hostnames[hostname].applications[app] ++;
if ( Object.keys(w.ping.hostnames).length >= 200 ) { driver('ping'); }
}
// Per URL

@ -138,49 +138,28 @@
};
},
/**
* Anonymously track detected applications
* Anonymously track detected applications for research purposes
*/
track: function() {
if ( localStorage['tracking'] ) {
var i, data, report = '';
if ( w.history ) {
for ( hostname in w.history ) {
report += '[' + hostname;
w.history[hostname].map(function(data) {
report += '|' + data.app + ':' + data.hits;
});
report += ']';
}
ping: function() {
if ( Object.keys(w.ping.hostnames).length && localStorage['tracking'] ) {
// Make POST request
var request = new XMLHttpRequest();
// Make POST request
var request = new XMLHttpRequest();
request.open('POST', w.config.websiteURL + 'ping/', true);
request.open('POST', w.config.websiteURL + '_track.php', true);
request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
request.onreadystatechange = function(e) {
if ( request.readyState == 4 ) { w.log('w.driver.ping: status ' + request.status); }
};
request.onreadystatechange = function(e) {
if ( request.readyState == 4 ) {
if ( request.status == 200 ) {
w.history = [];
request.send('json=' + encodeURIComponent(JSON.stringify(w.ping)));
w.log('w.driver.track: ' + report);
}
report = '';
if ( request.close ) { request.close(); }
w.log('w.driver.ping: ' + JSON.stringify(w.ping));
request = null;
}
};
request.send('d=' + encodeURIComponent(report));
}
w.ping = {};
}
},

@ -29,7 +29,7 @@ var wappalyzer = wappalyzer || (function() {
*/
var w = {
// Cache detected applications per URL
history: [],
ping: {},
detected: [],
config: {
@ -99,8 +99,7 @@ var wappalyzer = wappalyzer || (function() {
var i, app, type, regex, match, content, meta, header, apps = [];
if ( w.history[hostname] == null ) { w.history[hostname] = []; }
if ( w.detected[url] == null ) { w.detected[url] = []; }
if ( w.detected[url] == null ) { w.detected[url] = []; }
if ( data ) {
for ( app in w.apps ) {
@ -211,21 +210,23 @@ var wappalyzer = wappalyzer || (function() {
for ( i in apps ) {
app = apps[i];
// Per hostname
if ( /^[a-z0-9._\-]+\.[a-z]+/.test(hostname) && !/(dev\.|\/admin|\.local)/.test(url) ) {
// Per hostname
var index = -1;
if ( typeof w.ping.hostnames === 'undefined' ) {
w.ping.hostnames = {};
}
w.history[hostname].map(function(data, i) {
if ( data.app === app ) { index = i; }
});
if ( typeof w.ping.hostnames[hostname] === 'undefined' ) {
w.ping.hostnames[hostname] = { applications: {} };
}
if ( index === -1 ) {
w.history[hostname].push({ app: app, hits: 1 });
} else {
w.history[hostname][index].hits ++;
if ( typeof w.ping.hostnames[hostname].applications[app] === 'undefined' ) {
w.ping.hostnames[hostname].applications[app] = 1;
}
if ( Object.keys(w.history).length >= 200 ) { driver('track'); }
w.ping.hostnames[hostname].applications[app] ++;
if ( Object.keys(w.ping.hostnames).length >= 200 ) { driver('ping'); }
}
// Per URL

@ -1,7 +1,7 @@
{ "name": "Wappalyzer",
"homepage_url": "http://wappalyzer.com",
"description": "Identifies software on the web",
"version": "2.4",
"version": "2.5",
"default_locale": "en",
"manifest_version": 2,
"icons": {

@ -71,14 +71,18 @@
// Get response headers
onStateChange: function(progress, request, flags, status) {
if ( request && progress.currentURI && request.nsIHttpChannel && request.name == progress.currentURI.spec && request.contentType == 'text/html' && flags & Ci.nsIWebProgressListener.STATE_STOP ) {
var headers = new Object();
request.nsIHttpChannel.visitResponseHeaders(function(header, value) {
headers[header] = value;
});
w.analyze(progress.currentURI.host, progress.currentURI.spec, { headers: headers });
if ( request != null && flags & Ci.nsIWebProgressListener.STATE_STOP ) {
if ( request.nsIHttpChannel && request.contentType == 'text/html' ) {
if ( progress.currentURI && request.name == progress.currentURI.spec ) {
var headers = new Object();
request.nsIHttpChannel.visitResponseHeaders(function(header, value) {
headers[header] = value;
});
w.analyze(progress.currentURI.host, progress.currentURI.spec, { headers: headers });
}
}
}
}
});
@ -187,52 +191,28 @@
},
/**
* Anonymously track detected applications
* Anonymously track detected applications for research purposes
*/
track: function() {
if ( prefs.getBoolPref('tracking') ) {
var report = '';
if ( w.history ) {
for ( hostname in w.history ) {
report += '[' + hostname;
ping: function() {
if ( Object.keys(w.ping.hostnames).length && prefs.getBoolPref('tracking') ) {
// Make POST request
var request = new XMLHttpRequest();
w.history[hostname].map(function(data) {
report += '|' + data.app + ':' + data.hits;
});
request.open('POST', w.config.websiteURL + 'ping/', true);
report += ']';
}
// Make POST request
var request = new XMLHttpRequest();
request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
request.open('POST', w.config.websiteURL + '_track.php', true);
request.onreadystatechange = function(e) {
if ( request.readyState == 4 ) { w.log('w.driver.ping: status ' + request.status); }
};
request.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
request.send('json=' + encodeURIComponent(JSON.stringify(w.ping)));
request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
w.log('w.driver.ping: ' + JSON.stringify(w.ping));
request.onreadystatechange = function(e) {
if ( request.readyState == 4 ) {
if ( request.status == 200 ) {
w.history = [];
w.log('w.driver.track: ' + report);
}
report = '';
if ( request.close ) { request.close(); }
request = null;
}
};
request.send('d=' + encodeURIComponent(report));
}
w.ping = {};
}
},
}
};
/**

@ -29,7 +29,7 @@ var wappalyzer = wappalyzer || (function() {
*/
var w = {
// Cache detected applications per URL
history: [],
ping: {},
detected: [],
config: {
@ -99,8 +99,7 @@ var wappalyzer = wappalyzer || (function() {
var i, app, type, regex, match, content, meta, header, apps = [];
if ( w.history[hostname] == null ) { w.history[hostname] = []; }
if ( w.detected[url] == null ) { w.detected[url] = []; }
if ( w.detected[url] == null ) { w.detected[url] = []; }
if ( data ) {
for ( app in w.apps ) {
@ -211,21 +210,23 @@ var wappalyzer = wappalyzer || (function() {
for ( i in apps ) {
app = apps[i];
// Per hostname
if ( /^[a-z0-9._\-]+\.[a-z]+/.test(hostname) && !/(dev\.|\/admin|\.local)/.test(url) ) {
// Per hostname
var index = -1;
if ( typeof w.ping.hostnames === 'undefined' ) {
w.ping.hostnames = {};
}
w.history[hostname].map(function(data, i) {
if ( data.app === app ) { index = i; }
});
if ( typeof w.ping.hostnames[hostname] === 'undefined' ) {
w.ping.hostnames[hostname] = { applications: {} };
}
if ( index === -1 ) {
w.history[hostname].push({ app: app, hits: 1 });
} else {
w.history[hostname][index].hits ++;
if ( typeof w.ping.hostnames[hostname].applications[app] === 'undefined' ) {
w.ping.hostnames[hostname].applications[app] = 1;
}
if ( Object.keys(w.history).length >= 200 ) { driver('track'); }
w.ping.hostnames[hostname].applications[app] ++;
if ( Object.keys(w.ping.hostnames).length >= 200 ) { driver('ping'); }
}
// Per URL

@ -3,7 +3,7 @@
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>wappalyzer@crunchlabz.com</em:id>
<em:version>2.2.3</em:version>
<em:version>2.3.0</em:version>
<em:type>2</em:type>
<em:unpack>true</em:unpack>
@ -12,7 +12,7 @@
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>4.0</em:minVersion>
<em:maxVersion>14.*</em:maxVersion>
<em:maxVersion>17.*</em:maxVersion>
</Description>
</em:targetApplication>

@ -29,7 +29,7 @@ var wappalyzer = wappalyzer || (function() {
*/
var w = {
// Cache detected applications per URL
history: [],
ping: {},
detected: [],
config: {
@ -99,8 +99,7 @@ var wappalyzer = wappalyzer || (function() {
var i, app, type, regex, match, content, meta, header, apps = [];
if ( w.history[hostname] == null ) { w.history[hostname] = []; }
if ( w.detected[url] == null ) { w.detected[url] = []; }
if ( w.detected[url] == null ) { w.detected[url] = []; }
if ( data ) {
for ( app in w.apps ) {
@ -211,21 +210,23 @@ var wappalyzer = wappalyzer || (function() {
for ( i in apps ) {
app = apps[i];
// Per hostname
if ( /^[a-z0-9._\-]+\.[a-z]+/.test(hostname) && !/(dev\.|\/admin|\.local)/.test(url) ) {
// Per hostname
var index = -1;
if ( typeof w.ping.hostnames === 'undefined' ) {
w.ping.hostnames = {};
}
w.history[hostname].map(function(data, i) {
if ( data.app === app ) { index = i; }
});
if ( typeof w.ping.hostnames[hostname] === 'undefined' ) {
w.ping.hostnames[hostname] = { applications: {} };
}
if ( index === -1 ) {
w.history[hostname].push({ app: app, hits: 1 });
} else {
w.history[hostname][index].hits ++;
if ( typeof w.ping.hostnames[hostname].applications[app] === 'undefined' ) {
w.ping.hostnames[hostname].applications[app] = 1;
}
if ( Object.keys(w.history).length >= 200 ) { driver('track'); }
w.ping.hostnames[hostname].applications[app] ++;
if ( Object.keys(w.ping.hostnames).length >= 200 ) { driver('ping'); }
}
// Per URL

Before

Width:  |  Height:  |  Size: 801 B

After

Width:  |  Height:  |  Size: 801 B

@ -29,7 +29,7 @@ var wappalyzer = wappalyzer || (function() {
*/
var w = {
// Cache detected applications per URL
history: [],
ping: {},
detected: [],
config: {
@ -99,8 +99,7 @@ var wappalyzer = wappalyzer || (function() {
var i, app, type, regex, match, content, meta, header, apps = [];
if ( w.history[hostname] == null ) { w.history[hostname] = []; }
if ( w.detected[url] == null ) { w.detected[url] = []; }
if ( w.detected[url] == null ) { w.detected[url] = []; }
if ( data ) {
for ( app in w.apps ) {
@ -211,21 +210,23 @@ var wappalyzer = wappalyzer || (function() {
for ( i in apps ) {
app = apps[i];
// Per hostname
if ( /^[a-z0-9._\-]+\.[a-z]+/.test(hostname) && !/(dev\.|\/admin|\.local)/.test(url) ) {
// Per hostname
var index = -1;
if ( typeof w.ping.hostnames === 'undefined' ) {
w.ping.hostnames = {};
}
w.history[hostname].map(function(data, i) {
if ( data.app === app ) { index = i; }
});
if ( typeof w.ping.hostnames[hostname] === 'undefined' ) {
w.ping.hostnames[hostname] = { applications: {} };
}
if ( index === -1 ) {
w.history[hostname].push({ app: app, hits: 1 });
} else {
w.history[hostname][index].hits ++;
if ( typeof w.ping.hostnames[hostname].applications[app] === 'undefined' ) {
w.ping.hostnames[hostname].applications[app] = 1;
}
if ( Object.keys(w.history).length >= 200 ) { driver('track'); }
w.ping.hostnames[hostname].applications[app] ++;
if ( Object.keys(w.ping.hostnames).length >= 200 ) { driver('ping'); }
}
// Per URL