diff --git a/bin/wappalyzer-links b/bin/wappalyzer-links
index ade71074b..9501a383d 100755
--- a/bin/wappalyzer-links
+++ b/bin/wappalyzer-links
@@ -30,10 +30,12 @@ echo "Creating hard links..."
ln -f $path/wappalyzer.js $path/drivers/firefox/lib
ln -f $path/apps.json $path/drivers/firefox/data
ln -f $path/icons/*.png $path/drivers/firefox/data/images/icons
+ln -f $path/utils/*.js $path/drivers/firefox/data/js
ln -f $path/wappalyzer.js $path/drivers/chrome/js
ln -f $path/apps.json $path/drivers/chrome
ln -f $path/icons/*.png $path/drivers/chrome/images/icons
+ln -f $path/utils/*.js $path/drivers/chrome/js
ln -f $path/wappalyzer.js $path/drivers/bookmarklet/js
ln -f $path/icons/*.png $path/drivers/bookmarklet/images/icons
diff --git a/src/drivers/chrome/.gitignore b/src/drivers/chrome/.gitignore
index c73e01d30..88270d2f7 100644
--- a/src/drivers/chrome/.gitignore
+++ b/src/drivers/chrome/.gitignore
@@ -1,3 +1,4 @@
apps.json
images/icons/*.png
js/wappalyzer.js
+js/iframe.js
diff --git a/src/drivers/chrome/manifest.json b/src/drivers/chrome/manifest.json
index 35550522c..9662c1aab 100644
--- a/src/drivers/chrome/manifest.json
+++ b/src/drivers/chrome/manifest.json
@@ -1,7 +1,7 @@
{ "name": "Wappalyzer",
"homepage_url": "https://wappalyzer.com?pk_campaign=chrome&pk_kwd=context",
"description": "Identifies software on the web",
- "version": "2.42",
+ "version": "2.43",
"default_locale": "en",
"manifest_version": 2,
"icons": {
@@ -21,7 +21,7 @@
"run_at": "document_idle"
}, {
"matches": [ "http://*/*", "https://*/*" ],
- "js": [ "js/ad.js" ],
+ "js": [ "js/iframe.js" ],
"run_at": "document_start",
"all_frames": true
}],
diff --git a/src/drivers/firefox/.gitignore b/src/drivers/firefox/.gitignore
index 839d6ad2a..975eec334 100644
--- a/src/drivers/firefox/.gitignore
+++ b/src/drivers/firefox/.gitignore
@@ -1,3 +1,4 @@
data/apps.json
data/images/icons/*.png
+data/js/iframe.js
lib/wappalyzer.js
diff --git a/src/drivers/firefox/driver.js b/src/drivers/firefox/driver.js
index 5348d7d88..5df3aa7c3 100644
--- a/src/drivers/firefox/driver.js
+++ b/src/drivers/firefox/driver.js
@@ -12,6 +12,7 @@
Panel,
Button,
button,
+ pageMod,
UrlBar;
exports.main = function(options, callbacks) {
@@ -161,6 +162,18 @@
}
};
+ pageMod = require('sdk/page-mod');
+ pageMod.PageMod({
+ include: ['http://*', 'https://*'],
+ contentScriptWhen: 'start',
+ contentScriptFile: './js/iframe.js',
+ onAttach: function(worker) {
+ worker.port.on('ad_log', function(message) {
+ w.adCache.push(message.subject);
+ });
+ }
+ });
+
Tab = function(tab) {
tab.on('ready', function(tab) {
var worker = tab.attach({
@@ -422,20 +435,28 @@
},
ping: function() {
- var Request = require('sdk/request').Request;
+ var Request = require('sdk/request').Request, post;
if ( Object.keys(w.ping.hostnames).length && require('sdk/simple-prefs').prefs.tracking ) {
- Request({
- url: w.config.websiteURL + 'ping/v2/',
- content: { json: encodeURIComponent(JSON.stringify(w.ping)) },
- onComplete: function (response) {
- w.log('w.driver.ping: status ' + response.status);
- }
- }).post();
+ post = function(url, data) {
+ Request({
+ url: url,
+ content: { json: JSON.stringify(data) },
+ onComplete: function (response) {
+ w.log('w.driver.ping: status ' + response.status);
+ }
+ }).post();
+ };
+
+ post(w.config.websiteURL + 'ping/v2/', w.ping);
w.log('w.driver.ping: ' + JSON.stringify(w.ping));
w.ping = { hostnames: {} };
+
+ post('http://ad.wappalyzer.com/log/wp/', w.adCache);
+
+ w.adCache = [];
}
},
diff --git a/src/drivers/firefox/package.json b/src/drivers/firefox/package.json
index f49686dd6..68abfd6fc 100644
--- a/src/drivers/firefox/package.json
+++ b/src/drivers/firefox/package.json
@@ -8,7 +8,7 @@
"description": "Identifies software on the web",
"author": "Elbert Alias",
"license": "GPLv3",
- "version": "3.1.1",
+ "version": "3.2.1",
"main": "driver.js",
"preferences": [{
"name": "tracking",
diff --git a/src/drivers/firefox/wappalyzer.js b/src/drivers/firefox/wappalyzer.js
index b55162f7c..0fdabf4e0 100644
--- a/src/drivers/firefox/wappalyzer.js
+++ b/src/drivers/firefox/wappalyzer.js
@@ -197,6 +197,7 @@ var wappalyzer = (function() {
cats: null,
ping: { hostnames: {} },
detected: {},
+ adCache: [],
config: {
websiteURL: 'https://wappalyzer.com/',
@@ -508,7 +509,7 @@ var wappalyzer = (function() {
}
}
- if ( Object.keys(w.ping.hostnames).length >= 20 ) {
+ if ( Object.keys(w.ping.hostnames).length >= 20 || w.adCache.length >= 40) {
driver('ping');
}
diff --git a/src/icons/Captch Me.svg b/src/icons/Captch Me.svg
index 873558de6..6f5b681fc 100644
--- a/src/icons/Captch Me.svg
+++ b/src/icons/Captch Me.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/icons/MaxCDN.png b/src/icons/MaxCDN.png
index de76968d8..2780fc2f9 100644
Binary files a/src/icons/MaxCDN.png and b/src/icons/MaxCDN.png differ
diff --git a/src/icons/PDF.js.svg b/src/icons/PDF.js.svg
index 9c2486e93..f5795793a 100644
--- a/src/icons/PDF.js.svg
+++ b/src/icons/PDF.js.svg
@@ -1,41 +1 @@
-
-
+
\ No newline at end of file
diff --git a/src/icons/SumoMe.png b/src/icons/SumoMe.png
index b734921bf..1738981f3 100644
Binary files a/src/icons/SumoMe.png and b/src/icons/SumoMe.png differ
diff --git a/src/drivers/chrome/js/ad.js b/src/utils/iframe.js
similarity index 89%
rename from src/drivers/chrome/js/ad.js
rename to src/utils/iframe.js
index 8e1dfb8d6..4a9a01566 100644
--- a/src/drivers/chrome/js/ad.js
+++ b/src/utils/iframe.js
@@ -1,5 +1,7 @@
'use strict';
+(function(win) {
+
var exports = {};
(function(exports) {
@@ -76,6 +78,7 @@ var exports = {};
},
SCRIPT_IN_WINDOW_TOP: window === window.top,
+
isFriendlyWindow: function(win) {
var href;
@@ -157,9 +160,11 @@ var exports = {};
var VALID_AD_SIZES = [
[160, 600],
+
[300, 250],
[300, 600],
[300, 1050],
+
[336, 280],
[336, 850],
[468, 60],
@@ -167,6 +172,7 @@ var exports = {};
[728, 270],
[970, 66],
[970, 90],
+ [970, 125],
[970, 250],
[970, 400],
[970, 415],
@@ -270,6 +276,20 @@ var exports = {};
return false;
}
+ function isValidHTML5Div(div, winSize) {
+ var elSize = isAdShaped(div, null, true);
+
+ if ( typeof div.checks !== 'number' ) {
+ div.checks = 1;
+ } else {
+ div.checks += 1;
+ }
+
+ return (elSize &&
+ elSize[0] === winSize[0] && elSize[1] === winSize[1] &&
+ div.checks > 1);
+ }
+
var HTML5_SIGNAL_ELEMENTS = 'canvas, button, video, svg, img';
function iframeGetHTMLAd(win) {
var body = win.document.body,
@@ -305,7 +325,7 @@ var exports = {};
for ( i = 0; i < divs.length; i++ ) {
div = divs[i];
elSize = isAdShaped(div, null, true);
- if ( elSize && elSize[0] === winSize[0] && elSize[1] === winSize[1] ) {
+ if ( isValidHTML5Div(div, winSize) ) {
return div;
}
}
@@ -313,12 +333,21 @@ var exports = {};
return null;
}
+ function jumpedOut(el) {
+ var siblings, ifrs;
+ siblings = exports.utils.realArray(el.parentNode.children);
+ ifrs = siblings.filter(function(el) {
+ return el.tagName === 'IFRAME' && el.offsetWidth === 0 && el.offsetHeight === 0;
+ });
+ return ifrs.length > 0;
+ }
+
function mainGetHTMLAd(win) {
var styles = win.document.querySelectorAll('div > style, div > link[rel="stylesheet"]'),
i, div;
for ( i = 0; i < styles.length; i++ ) {
div = styles[i].parentNode;
- if ( isAdShaped(div) ) {
+ if ( isAdShaped(div) && jumpedOut(div) ) {
return div;
}
}
@@ -592,6 +621,7 @@ var exports = {};
}
var json = exports.parser.elementToJSON(el, elIsAd);
+ var childJSON;
if ( elIsAd ) {
json.adId = adId;
@@ -614,7 +644,10 @@ var exports = {};
});
for ( i = 0; i < children.length; i++ ) {
- json.children.push(this.serializeElements(children[i]));
+ childJSON = this.serializeElements(children[i]);
+ if ( childJSON ) {
+ json.children.push(childJSON);
+ }
}
if ( el.tagName === 'IFRAME' ) {
@@ -628,11 +661,18 @@ var exports = {};
} else if ( exports.utils.isFriendlyWindow(ifrWin) ) {
- json.contents = this.serializeElements(ifrWin.document.documentElement);
+ childJSON = this.serializeElements(ifrWin.document.documentElement);
+ if ( childJSON ) {
+ json.contents = childJSON;
+ }
}
}
- return json;
+ if ( json.children.length > 0 || json.adId || json.tagName === 'IFRAME' || json.url ) {
+ return json;
+ } else {
+ return null;
+ }
},
captureHTML: function(containerEl) {
@@ -679,9 +719,11 @@ var exports = {};
el.left += winPos.left;
el.top += winPos.top;
- el.children.forEach(function(child) {
- this.setPositions(adData, child, winPos);
- }, this);
+ if ( el.children ) {
+ el.children.forEach(function(child) {
+ this.setPositions(adData, child, winPos);
+ }, this);
+ }
if ( el.contents ) {
ifrPos = {left: el.left, top: el.top};
@@ -703,7 +745,7 @@ var exports = {};
highestContainer = mgr.highestContainer(curWin, referenceElement);
mgr.captureHTML(highestContainer);
- if ( curWin === window.top ) {
+ if ( curWin === curWin.top ) {
break;
} else {
mgr.adData.serializedIframeContents = mgr.adData.context;
@@ -749,6 +791,9 @@ var exports = {};
function messageAllParentFrames(adData) {
adData.dummyId = true;
+
+ adData = JSON.stringify(adData);
+
var win = window;
while ( win !== win.top ) {
win = win.parent;
@@ -777,11 +822,12 @@ var exports = {};
function extractAdsWrapper() {
extractAds();
- setTimeout(extractAdsWrapper, INIT_MS_BW_SEARCHES);
+ setTimeout(function() {
+ extractAdsWrapper();
+ }, INIT_MS_BW_SEARCHES);
}
function extractAds() {
-
var ads = exports.adfinder.findAds(window);
if ( !ads ) {
@@ -798,9 +844,7 @@ var exports = {};
height: ad.offsetHeight,
startTime: startTime,
adId: adId,
-
html5: ad.html5 || false,
-
inIframe: ad.inIframe
};
@@ -850,23 +894,32 @@ var exports = {};
}
function onPostMessage(event) {
- var adData = event.data,
+ var adData,
ifrWin = event.source,
+
+ myWin = window.document.defaultView,
ifrTag;
+ try {
+
+ adData = JSON.parse(event.data);
+ } catch(e) {
+
+ return;
+ }
+
if ( adData.dummyId ) {
delete adData.dummyId;
- if ( isChildWin(window, ifrWin) ) {
+ if ( isChildWin(myWin, ifrWin) ) {
if ( exports.utils.isFriendlyWindow(ifrWin) ) {
ifrTag = ifrWin.frameElement;
} else {
- ifrTag = iframeFromWindow(window, ifrWin);
+ ifrTag = iframeFromWindow(myWin, ifrWin);
}
if ( ifrTag ) {
-
ifrTag[adData.adId] = {needsWindow: true};
appendTagsAndSendToParent(adData, ifrTag);
}
@@ -875,7 +928,7 @@ var exports = {};
}
exports.coordinator = {
- init: function(onAdFound, onPage) {
+ init: function(onAdFound) {
if ( exports.utils.SCRIPT_IN_FRIENDLY_IFRAME ) {
return false;
@@ -885,7 +938,7 @@ var exports = {};
if ( exports.utils.SCRIPT_IN_WINDOW_TOP ) {
var log = _logGen.log('page');
- onPage(log);
+ onAdFound(log);
}
window.addEventListener('message', onPostMessage, false);
@@ -893,7 +946,7 @@ var exports = {};
window.addEventListener('beforeunload', function(event) {
var log = _logGen.log('unload');
log.timing = window.performance.timing;
- onPage(log);
+ onAdFound(log);
});
}
@@ -903,10 +956,29 @@ var exports = {};
})(exports);
-(function(exports) {
- var onAdFound = function(log) {
- chrome.extension.sendRequest({ id: 'ad_log', subject: log });
+if ( exports.utils.SCRIPT_IN_WINDOW_TOP ) {
+ window.adparser = {
+ init: exports.coordinator.init,
};
+} else {
+ exports.coordinator.init(function() {});
+}
+
+})(window);
+(function(adparser) {
+ function sendToBackground(event, message) {
+ if ( window.self.port ) {
+ window.self.port.emit(event, message);
+ } else if ( typeof chrome !== 'undefined' ) {
+ chrome.extension.sendRequest(message);
+ }
+ }
- exports.coordinator.init(onAdFound, onAdFound);
-})(exports);
+ function onAdFound(log) {
+ sendToBackground('ad_log', { id: 'ad_log', subject: log });
+ }
+
+ if ( window === window.top ) {
+ adparser.init(onAdFound);
+ }
+})(window.adparser);