http://www.pbc.gov.cn
这是官网链接,关闭javascript打开后,显示:
请开启JavaScript并刷新该页.
html源码如下:
<html>
<head>
</head>
<body>
<noscript>
<h1><strong>请开启JavaScript并刷新该页.</strong></h1>
</noscript>
<script type="text/javascript">
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>32?String.fromCharCode(c+32):c.toString(33))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('15 D="k";15 1a="i";15 1b="l";15 11=7;15 F = "e+/=";J g(10) {15 U, N, R;15 o, p, q;R = 10.S;N = 0;U = "";17 (N < R) {o = 10.s(N++) & 6;O (N == R) {U += F.r(o >> a);U += F.r((o & 1) << c);U += "==";n;}p = 10.s(N++);O (N == R) {U += F.r(o >> a);U += F.r(((o & 1) << c) | ((p & 5) >> c));U += F.r((p & 4) << a);U += "=";n;}q = 10.s(N++);U += F.r(o >> a);U += F.r(((o & 1) << c) | ((p & 5) >> c));U += F.r(((p & 4) << a) | ((q & 3) >> d));U += F.r(q & 2);}W U;}J H(){15 16= 19.Q||B.C.u||B.m.u;15 K= 19.P||B.C.t||B.m.t;O (16*K <= 9) {W 14;}15 1d = 19.Y;15 1e = 19.Z;O (1d + 16 <= 0 || 1e + K <= 0 || 1d >= 19.X.18 || 1e >= 19.X.M) {W 14;}W G;}J h(){15 12 = 1a+1b;15 L = 0;15 N = 0;I(N = 0; N < 12.S; N++) {L += 12.s(N);}L *= b;L += 8;W "j"+L;}J f(){O(H()) {} E {15 A = ""; A = "1c="+g(11.13()) + "; V=/";B.w = A; 15 v = h();A = "1a="+g(v.13()) + "; V=/";B.w = A; 19.T=D;}}f();',59,74,'0|0x3|0x3f|0xc0|0xf|0xf0|0xff|10|111111|120000|2|31|4|6|ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789|HXXTTKKLLPPP5|KTKY2RBD9NHPBCIHV9ZMEQQDARSLVFDU|QWERTASDFGXYSF|RANDOMSTR14559|WZWS_CONFIRM_PREFIX_LABEL10|/|STRRANDOM14559|body|break|c1|c2|c3|charAt|charCodeAt|clientHeight|clientWidth|confirm|cookie|cookieString|document|documentElement|dynamicurl|else|encoderchars|false|findDimensions|for|function|h|hash|height|i|if|innerHeight|innerWidth|len|length|location|out|path|return|screen|screenX|screenY|str|template|tmp|toString|true|var|w|while|width|window|wzwschallenge|wzwschallengex|wzwstemplate|x|y'.split('|'),0,{}))
</script>
</body>
</html>
浏览器不支持javascript就直接显示<noscript>里的内容,支持在运行下边的js脚本。
我不明白的是,下面的脚本看不出它是怎么运行的,可以把DOM树修改成最终需要的主页,求指教
1
alect 2015-07-24 17:31:37 +08:00
加密了
var dynamicurl="/"; var wzwschallenge="RANDOMSTR14559"; var wzwschallengex="STRRANDOM14559"; var template=10; var encoderchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; function KTKY2RBD9NHPBCIHV9ZMEQQDARSLVFDU(str) { var out, i, len; var c1, c2, c3; len = str.length; i = 0; out = ""; while (i < len) { c1 = str.charCodeAt(i++) & 0xff; if (i == len) { out += encoderchars.charAt(c1 >> 2); out += encoderchars.charAt((c1 & 0x3) << 4); out += "=="; break; } c2 = str.charCodeAt(i++); if (i == len) { out += encoderchars.charAt(c1 >> 2); out += encoderchars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xf0) >> 4)); out += encoderchars.charAt((c2 & 0xf) << 2); out += "="; break; } c3 = str.charCodeAt(i++); out += encoderchars.charAt(c1 >> 2); out += encoderchars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xf0) >> 4)); out += encoderchars.charAt(((c2 & 0xf) << 2) | ((c3 & 0xc0) >> 6)); out += encoderchars.charAt(c3 & 0x3f); } return out; } function findDimensions() { var w= window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth; var h= window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight; if (w*h <= 120000) { return true; } var x = window.screenX; var y = window.screenY; if (x + w <= 0 || y + h <= 0 || x >= window.screen.width || y >= window.screen.height) { return true; } return false; } function QWERTASDFGXYSF() { var tmp = wzwschallenge+wzwschallengex; var hash = 0; var i = 0; for(i = 0; i < tmp.length; i++) { hash += tmp.charCodeAt(i); } hash *= 31; hash += 111111; return "WZWS_CONFIRM_PREFIX_LABEL10"+hash; } function HXXTTKKLLPPP5() { if(findDimensions()) { } else { var cookieString = ""; cookieString = "wzwstemplate="+KTKY2RBD9NHPBCIHV9ZMEQQDARSLVFDU(template.toString()) + "; path=/"; document.cookie = cookieString; var confirm = QWERTASDFGXYSF(); cookieString = "wzwschallenge="+KTKY2RBD9NHPBCIHV9ZMEQQDARSLVFDU(confirm.toString()) + "; path=/"; document.cookie = cookieString; window.location=dynamicurl; } } HXXTTKKLLPPP5(); |
2
bestsanmao 2015-07-24 17:31:42 +08:00
上述代码像是一些防火墙的代码
如果安装了某些防火墙 在网站受到攻击时 就会出现类似的代码 这样真人用浏览器访问是不受影响的 但是机械访问时就会因为无法自动解析js而被阻断在这个代码上 |
4
ammzen OP @bestsanmao 偷偷告诉你,我这是在爬它网站时发现的😋
|
5
bestsanmao 2015-07-24 18:08:52 +08:00
@ammzen
难怪 看来你是触发它的防机器机制了 |
6
ammzen OP 最终目的其实只要能方便得得到主页的HTML源码就好了,可是现在被挡在<noscript>这里了
|
7
ammzen OP @bestsanmao 这个应该不是说防火墙那种东西,就只是没有JavaScript不能正常访问而已
|
9
66beta 2015-07-24 18:11:41 +08:00
没看出有修改dom啊,写了个cookie然后跳转了
|
10
bestsanmao 2015-07-24 18:13:27 +08:00
@ammzen
解密很简单 直接在这儿就可以 http://tool.chinaz.com/js.aspx 你可以研究一下它的代码 估计就是加了什么动态的cookies 您可以根据它的算法进行模拟 然后就可以继续了 |
13
ammzen OP @bestsanmao console里执行那段js后,它会打开 localhost,如果直接把这段代码保存下来,开JS打开后,会显示本地目录。
我想它这里的作用会不会是显示当前站点的根目录下的所有元素 |
14
66beta 2015-07-27 09:20:11 +08:00
|