Skip to content

Instantly share code, notes, and snippets.

@gmetais
Created May 1, 2016 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmetais/a3d2fd03287bd6ee4ccfc2f6baf1eb49 to your computer and use it in GitHub Desktop.
Save gmetais/a3d2fd03287bd6ee4ccfc2f6baf1eb49 to your computer and use it in GitHub Desktop.
if (window.addEventListener) {
window.addEventListener("load", AIALoadEvent);
} else {
window.attachEvent("onload", AIALoadEvent);
}
function AIALoadEvent() {
if (self == top) {
setTimeout(AIADisplayADV, 2000);
}
}
function AIADisplayADV() {
var url = 'http://www.wiz.athensairport.gr/Styles/WizBanners.css?a=1'
if (document.createStyleSheet) {
try { document.createStyleSheet(url); } catch (e) { }
}
else {
var css;
css = document.createElement('link');
css.rel = 'stylesheet';
css.type = 'text/css';
css.media = "all";
css.href = url;
document.getElementsByTagName("head")[0].appendChild(css);
}
var aiaProxybackgroundDiv = document.createElement('div');
aiaProxybackgroundDiv.setAttribute("id", "aiabackgroundDiv");
var aiaProxyCenterDiv = document.createElement('div');
var aiaProxyFooterDiv = document.createElement('div');
aiaProxyCenterDiv.setAttribute("id", "aiaAdvDiv");
aiaProxyFooterDiv.setAttribute("id", "aiaAdvFooterDiv");
aiaProxybackgroundDiv.style.cssText = 'opacity:0.8; background: #000; width: 100%; height: 100%; z-index: 16777270; top: 0; left: 0; position: fixed; ';
aiaProxyCenterDiv.className = "aiawizADV";
aiaProxyFooterDiv.className = "aiawizFooterADV";
var xhr1, xhr2;
try {
if (typeof XMLHttpRequest !== 'undefined') {
xhr1 = new XMLHttpRequest();
xhr2 = new XMLHttpRequest();
}
if (xhr1) {
xhr1.withCredentials = true;
xhr1.open("GET", "http://www.wiz.athensairport.gr/handlers/WizBanners.ashx?pos=1", true);
xhr1.onload = function() {
if (xhr1.responseText.length > 0) {
aiaProxyCenterDiv.innerHTML = '<div><div><input style="line-height: 12px;height: 24px;width: 24px;font-size: 8pt;font-family: tahoma;margin-top: 1px;margin-right: 2px;position: absolute;top: 0;right: 0;color: black; background: white none repeat scroll 0% 0%;border-radius: 4px;" type="button" value="X" onclick="hideAiaAdv()"></div>' + xhr1.responseText + "</div>";
document.body.appendChild(aiaProxybackgroundDiv);
document.body.appendChild(aiaProxyCenterDiv);
}
}
xhr1.send();
}
if (xhr2) {
xhr2.withCredentials = true;
xhr2.open("GET", "http://www.wiz.athensairport.gr/handlers/WizBanners.ashx?pos=2", true);
xhr2.onload = function() {
if (xhr2.responseText.length > 0) {
aiaProxyFooterDiv.innerHTML = '<div>' + xhr2.responseText + "</div>";
document.body.appendChild(aiaProxyFooterDiv);
}
}
xhr2.send();
}
} catch (e) { }
}
function hideAiaAdv() {
var div1 = document.getElementById("aiabackgroundDiv");
var div2 = document.getElementById("aiaAdvDiv");
div1.style.display = 'none';
div2.style.display = 'none';
}
@gmetais
Copy link
Author

gmetais commented May 1, 2016

This is an example of an script automatically injected by the Athens Airport Free Wifi on every none-https website.
It's injected at the very beginning of the .

Only solution: visit HTTPS websites only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment