Finalized Firefox adapter

main
ElbertF 13 years ago
parent 00241871a9
commit 3a0381cc9a

@ -72,14 +72,14 @@
// Get response headers
onStateChange: function(progress, request, flags, status) {
if ( request.nsIHttpChannel != null && flags & Components.interfaces.nsIWebProgressListener.STATE_STOP ) {
if ( request && request.nsIHttpChannel && flags & Components.interfaces.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 ( progress.currentURI ) w.analyze(progress.currentURI.host, progress.currentURI.spec, { headers: headers });
}
}
});
@ -90,7 +90,8 @@
});
};
window.addEventListener('load', handler, false);
window.addEventListener('load', handler, false);
window.addEventListener('unload', w.adapter.track, false);
},
/**
@ -180,7 +181,55 @@
*/
goToURL: function(args) {
gBrowser.selectedTab = gBrowser.addTab(args.url);
}
},
/**
* Anonymously track detected applications
*/
track: function() {
if ( 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
var request = new XMLHttpRequest();
request.open('POST', w.config.websiteURL + 'report/', true);
request.channel.loadFlags |= Components.interfaces.nsIRequest.LOAD_BYPASS_CACHE;
request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
request.onreadystatechange = function(e) {
if ( request.readyState == 4 ) {
if ( request.status == 200 ) {
w.history = new Object();
w.log('w.adapter.track: ' + report);
}
report = '';
if ( request.close ) request.close();
request = false;
}
};
request.send('d=' + encodeURIComponent(report));
}
}
},
};
/**

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -28,7 +28,8 @@
22: { name: 'Web server', plural: 'Web servers' },
23: { name: 'Cache tool', plural: 'Cache tools' },
24: { name: 'Rich text editor', plural: 'Rich text editors' },
25: { name: 'Javascript Graphics', plural: 'Javascript Graphics' }
25: { name: 'Javascript graphics', plural: 'Javascript graphics' },
26: { name: 'Mobile framework', plural: 'Mobile frameworks' }
};
w.apps = {
@ -51,6 +52,7 @@
'Blogger': { cats: { 1: 11 }, meta: { 'generator': /blogger/i }, url: /^(www.)?.+\.blogspot\.com/i },
'Bugzilla': { cats: { 1: 13 }, html: /<[^>]+(id|title|name)=("|')bugzilla/i },
'Burning Board': { cats: { 1: 2 }, html: /<a href=('|")[^>]+woltlab\.com.+Burning Board/i },
'Chameleon': { cats: { 1: 1 }, meta: { 'generator': /chameleon\-cms/i } },
'chartbeat': { cats: { 1: 10 }, html: /function loadChartbeat\(\) {/i },
'Chamilo': { cats: { 1: 21 }, meta: { 'generator': /Chamilo/i }, headers: { 'X-Powered-By': /Chamilo/ } },
'Cherokee': { cats: { 1: 22 }, headers: { 'Server': /Cherokee/i } },
@ -83,6 +85,7 @@
'DotNetNuke': { cats: { 1: 1 }, meta: { 'generator': /DotNetNuke/i }, html: /<!\-\- by DotNetNuke Corporation/i },
'DreamWeaver': { cats: { 1: 20 }, html: /(<!\-\-[^>]*(InstanceBeginEditable|Dreamweaver[^>]+target|DWLayoutDefaultTable)|function MM_preloadImages\(\) {)/ },
'Drupal': { cats: { 1: 1 }, script: /drupal\.js/, html: /(jQuery\.extend\(Drupal\.settings, \{|Drupal\.extend\(\{ settings: \{|<link[^>]+sites\/(default|all)\/themes\/|<style[^>]+sites\/(default|all)\/(themes|modules)\/)/i, headers: { 'X-Drupal-Cache': /.*/, 'Expires': /19 Nov 1978/ }, env: /^Drupal$/ },
'Drupal Commerce': { cats: { 1: 6 }, html: /id\=\"block\-commerce\-cart\-cart|class\=\"commerce\-product\-field/i },
'Dynamicweb': { cats: { 1: 1 }, meta: { 'generator': /Dynamicweb/i } },
'e107': { cats: { 1: 1 }, script: /e107\.js/ },
'Exhibit': { cats: { 1: 25 }, script: /exhibit.*\.js/, env: /^Exhibit$/ },
@ -94,6 +97,7 @@
'FrontPage': { cats: { 1: 20 }, meta: { 'generator': /Microsoft FrontPage/ }, html: /<html[^>]+urn:schemas\-microsoft\-com:office:office/i },
'Get Satisfaction': { cats: { 1: 13 }, html: /var feedback_widget = new GSFN\.feedback_widget\(feedback_widget_options\)/ },
'Google Analytics': { cats: { 1: 10 }, script: /(\.google\-analytics\.com\/ga\.js|google-analytics\.com\/urchin\.js)/, env: /^gaGlobal$/ },
'Google App Engine': { cats: { 1: 22 }, headers: { 'Server': /Google Frontend/i } },
'Google Font API': { cats: { 1: 17 }, html: /<link[^>]* href=("|')http:\/\/fonts\.googleapis\.com/ },
'Google Friend Connect': { cats: { 1: 5 }, script: /google.com\/friendconnect/ },
'Google Maps': { cats: { 1: 5 }, script: /(maps\.google\.com\/maps\?file=api|maps\.google\.com\/maps\/api\/staticmap)/ },
@ -108,11 +112,14 @@
'iWeb': { cats: { 1: 20 }, meta: { 'generator': /iWeb/i } },
'Jalios': { cats: { 1: 1 }, meta: { 'generator': /Jalios/i } },
'Javascript Infovis Toolkit': { cats: { 1: 25 }, script: /jit.*\.js/, env: /^\$jit$/ },
'Jo': { cats: { 1: 26, 2: 12 }, script: /[^a-zA-Z]jo.*\.js/i },
'Joomla': { cats: { 1: 1 }, meta: { 'generator': /Joomla/i }, html: /<!\-\- JoomlaWorks "K2"/i, headers: { 'X-Content-Encoded-By': /Joomla/ } },
'jqPlot': { cats: { 1: 25 }, script: /jqplot.*\.js/, env: /^jQuery.jqplot$/ },
'jQTouch': { cats: { 1: 26 }, script: /jqtouch.*\.js/i, env:/^jQT$/ },
'jQuery UI': { cats: { 1: 12 }, script: /jquery\-ui.*\.js/ },
'jQuery': { cats: { 1: 12 }, script: /jquery.*.js/, env: /^jQuery$/ },
'jQuery Sparklines': { cats: { 1: 25 }, script: /sparkline.*\.js/i, env: /^jQuery\.fn\.sparkline$/ },
'jQuery Mobile': { cats: { 1: 26 }, script: /jquery\.mobile.*\.js/i },
'jQuery Sparklines': { cats: { 1: 25 }, script: /jquery\.sparkline.*\.js/i },
'JS Charts': { cats: { 1: 25 }, script: /jscharts.*\.js/i, env: /^JSChart$/ },
'JTL Shop': { cats: { 1: 6 }, html: /(<input[^>]+name=('|")JTLSHOP|<a href=('|")jtl\.php)/i },
'K2': { cats: { 1: 19 }, html: /<!\-\- JoomlaWorks "K2"/ },
@ -153,6 +160,8 @@
'OneStat': { cats: { 1: 10 }, html: /var p=("|')http("|')\+\(d\.URL\.indexOf\('https:'\)==0\?'s':''\)\+("|'):\/\/stat\.onestat\.com\/stat\.aspx\?tagver/i },
'OpenCart': { cats: { 1: 6 }, html: /(Powered By <a href=("|')[^>]+OpenCart|route = getURLVar\(("|')route)/i },
'openEngine': { cats: { 1: 1 }, html: /<meta[^>]+openEngine/i },
'OpenGSE': { cats: { 1: 22 }, headers: { 'Server': /GSE/i } },
'OpenLayers': { cats: { 1: 5 }, script: /openlayers/, env:/^OpenLayers$/ },
'osCommerce': { cats: { 1: 6 }, html: /<!-- header_eof \/\/-->|<a[^>]*(osCsid|cPath)/i },
'osCSS': { cats: { 1: 6 }, html: /<body onload=("|')window\.defaultStatus='oscss templates';("|')/i },
'PANSITE': { cats: { 1: 1 }, meta: { 'generator': /PANSITE/i } },
@ -179,9 +188,11 @@
'Reddit': { cats: { 1: 2 }, html: /(<script[^>]+>var reddit = {|<a[^>]+Powered by Reddit|powered by <a[^>]+>reddit<)/i, url: /^(www.)?reddit\.com/ },
'Redmine': { cats: { 1: 13 }, meta: { 'description': /Redmine/i }, html: /Powered by <a href=("|')[^>]+Redmine/i },
'Reinvigorate': { cats: { 1: 10 }, html: /reinvigorate\.track\("/ },
'RequireJS': { cats: { 1: 12 }, script: /require.*\.js/ , env: /^requirejs$/},
'S.Builder': { cats: { 1: 1 }, meta: { 'generator': /S\.Builder/i } },
's9y': { cats: { 1: 1 }, meta: { 'generator': /Serendipity/i } },
'script.aculo.us': { cats: { 1: 12 }, script: /(scriptaculous|protoaculous)\.js/, env: /^Scriptaculous$/ },
'Sencha Touch': { cats: { 1: 26, 2: 12}, script: /sencha\-touch.*\.js/ },
'ShareThis': { cats: { 1: 5 }, script: /w\.sharethis\.com\// },
'sIFR': { cats: { 1: 17 }, script: /sifr\.js/ },
'Site Meter': { cats: { 1: 10 }, script: /sitemeter.com\/js\/counter\.js\?site=/ },
@ -211,7 +222,8 @@
'TYPO3': { cats: { 1: 1 }, meta: { 'generator': /TYPO3/i }, html: /(<(script[^>]* src|link[^>]* href)=[^>]*fileadmin)/i, url: /\/typo3/i },
'Ubercart': { cats: { 1: 6 }, script: /uc_cart\/uc_cart_block\.js/ },
'Umbraco': { cats: { 1: 1 }, headers: { 'X-Umbraco-Version': /.+/ } },
'Underscore.js': { cats: { 1: 12 }, script: /underscore.*\.js/, env: /^_.VERSION$/ },
'Underscore.js': { cats: { 1: 12 }, script: /underscore.*\.js/ },
'UserRules': { cats: { 1: 13 }, html: /var _usrp =/ , env: /^\_usrp$/ },
'Vanilla': { cats: { 1: 2 }, html: /<body id=("|')(DiscussionsPage|vanilla)/i, headers: { 'X-Powered-By': /Vanilla/ } },
'Varnish': { cats: { 1: 22 }, headers: { 'X-Varnish': /.+/, 'X-Varnish-Age': /.+/, 'X-Varnish-Cache': /.+/, 'X-Varnish-Action': /.+/, 'X-Varnish-Hostname': /.+/, 'Via': /Varnish/ } },
'vBulletin': { cats: { 1: 2 }, meta: { 'generator': /vBulletin/i } },
@ -229,9 +241,10 @@
'WebPublisher': { cats: { 1: 1 }, meta: { 'generator': /WEB\|Publisher/i } },
'WebsiteBaker': { cats: { 1: 1 }, meta: { 'generator': /WebsiteBaker/i } },
'Webtrekk': { cats: { 1: 10 }, html: /var webtrekk = new Object/ },
'Webtrends': { cats: { 1: 10 }, html: /<img[^>]+id=("|')DCSIMG("|')[^>]+webtrends/i },
'Webtrends': { cats: { 1: 10 }, html: /<img[^>]+id=("|')DCSIMG("|')[^>]+webtrends/i, env: /WTOptimize/i },
'Weebly': { cats: { 1: 1 }, html: /<[^>]+class=("|')weebly/i },
'WikkaWiki': { cats: { 1: 8 }, meta: { 'generator': /WikkaWiki/ }, html: /Powered by <a href=("|')[^>]+WikkaWiki/i },
'wink': { cats: { 1: 26, 2: 12 }, script: /(\_base\/js\/base|wink).*\.js/i, env:/^wink$/ },
'Wolf CMS': { cats: { 1: 1 }, html: /<a href=("|')[^>]+wolfcms.org.+Wolf CMS.+inside/i },
'Woopra': { cats: { 1: 10 }, script: /static\.woopra\.com/ },
'WordPress': { cats: { 1: 1, 2: 11 }, meta: { 'generator': /WordPress/i }, html: /<link rel=("|')stylesheet("|') [^>]+wp-content/i },
@ -239,6 +252,7 @@
'XenForo': { cats: { 1: 2 }, html: /(jQuery\.extend\(true, XenForo|Forum software by XenForo&trade;|<!\-\-XF:branding)/ },
'XiTi': { cats: { 1: 10 }, html: /<[^>]+src=("|')[^>]+xiti.com\/hit.xiti/i },
'XMB': { cats: { 1: 2 }, html: /<!-- Powered by XMB/i },
'XUI': { cats: { 1: 26, 2: 12 }, script: /[^a-zA-Z]xui.*\.js/i, env:/^x\$$/ },
'XOOPS': { cats: { 1: 1 }, meta: { 'generator': /XOOPS/i } },
'xtCommerce': { cats: { 1: 6 }, meta: { 'generator': /xt:Commerce/ }, html: /<div class=("|')copyright("|')>.+<a[^>]+>xt:Commerce/i },
'YaBB': { cats: { 1: 2 }, html: /Powered by <a href=("|')[^>]+yabbforum/i },

@ -27,8 +27,8 @@ var wappalyzer = wappalyzer || (function() {
*/
var w = {
// Cache detected applications per URL
history: new Array,
detected: new Array,
history: new Object,
detected: new Object,
config: {
environment: 'dev', // dev | live
@ -89,8 +89,8 @@ var wappalyzer = wappalyzer || (function() {
var apps = new Array();
if ( w.history [hostname] == null ) w.history [hostname] = new Array();
if ( w.detected[url] == null ) w.detected[url] = new Array();
if ( w.history[hostname] == null ) w.history[hostname] = new Array();
if ( w.detected[url] == null ) w.detected[url] = new Array();
if ( data ) {
for ( var app in w.apps ) {
@ -180,17 +180,25 @@ var wappalyzer = wappalyzer || (function() {
// Keep history of detected apps
apps.map(function(app) {
// Per hostname
var index = w.history.indexOf(app);
if ( /^[a-z0-9._\-]+\.[a-z]+/.test(hostname) && !/(dev\.|\/admin|\.local)/.test(url) ) {
// Per hostname
var index = -1;
w.history[hostname].map(function(data, i) {
if ( data.app == app ) index = i;
});
if ( index === -1 ) {
w.history[hostname].push({ app: app, hits: 1 });
} else {
w.history[hostname][index].hits ++;
}
if ( index === -1 ) {
w.history[hostname].push({ app: app, hits: 1 });
} else {
w.history[hostname][index].hits ++;
if ( Object.keys(w.history).length >= 200 ) adapter('track');
}
// Per URL
var index = w.detected.indexOf(app);
var index = w.detected[url].indexOf(app);
if ( index === -1 ) w.detected[url].push(app);
});