Updated tracker

main
ElbertF 13 years ago
parent 2e8802caa5
commit 4eb5af3b0d

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

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

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

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

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

@ -29,7 +29,7 @@ var wappalyzer = wappalyzer || (function() {
*/ */
var w = { var w = {
// Cache detected applications per URL // Cache detected applications per URL
history: [], ping: {},
detected: [], detected: [],
config: { config: {
@ -99,7 +99,6 @@ var wappalyzer = wappalyzer || (function() {
var i, app, type, regex, match, content, meta, header, apps = []; 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 ) { if ( data ) {
@ -211,21 +210,23 @@ var wappalyzer = wappalyzer || (function() {
for ( i in apps ) { for ( i in apps ) {
app = apps[i]; app = apps[i];
if ( /^[a-z0-9._\-]+\.[a-z]+/.test(hostname) && !/(dev\.|\/admin|\.local)/.test(url) ) {
// Per hostname // Per hostname
var index = -1; if ( /^[a-z0-9._\-]+\.[a-z]+/.test(hostname) && !/(dev\.|\/admin|\.local)/.test(url) ) {
if ( typeof w.ping.hostnames === 'undefined' ) {
w.ping.hostnames = {};
}
w.history[hostname].map(function(data, i) { if ( typeof w.ping.hostnames[hostname] === 'undefined' ) {
if ( data.app === app ) { index = i; } w.ping.hostnames[hostname] = { applications: {} };
}); }
if ( index === -1 ) { if ( typeof w.ping.hostnames[hostname].applications[app] === 'undefined' ) {
w.history[hostname].push({ app: app, hits: 1 }); w.ping.hostnames[hostname].applications[app] = 1;
} else {
w.history[hostname][index].hits ++;
} }
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 // 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#"> <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"> <Description about="urn:mozilla:install-manifest">
<em:id>wappalyzer@crunchlabz.com</em:id> <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:type>2</em:type>
<em:unpack>true</em:unpack> <em:unpack>true</em:unpack>
@ -12,7 +12,7 @@
<Description> <Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>4.0</em:minVersion> <em:minVersion>4.0</em:minVersion>
<em:maxVersion>14.*</em:maxVersion> <em:maxVersion>17.*</em:maxVersion>
</Description> </Description>
</em:targetApplication> </em:targetApplication>

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

Before

Width:  |  Height:  |  Size: 801 B

After

Width:  |  Height:  |  Size: 801 B

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