如何寫(xiě)ASP入庫(kù)小偷程序
更新時(shí)間:2007年06月06日 00:00:00 作者:
現(xiàn)在網(wǎng)上流行的小偷程序比較多,有新聞?lì)愋⊥?,音?lè)小偷,下載小偷,那么它們是如何做的呢,下面我來(lái)做個(gè)簡(jiǎn)單介紹,希望對(duì)各位站長(zhǎng)有所幫助。
(一)原理
小偷程序?qū)嶋H上是通過(guò)了XML中的XMLHTTP組件調(diào)用其它網(wǎng)站上的網(wǎng)頁(yè)。比如新聞小偷程序,很多都是調(diào)用了sina的新聞網(wǎng)頁(yè),并且對(duì)其中的html進(jìn)行了一些替換,同時(shí)對(duì)廣告也進(jìn)行了過(guò)濾。用小偷程序的優(yōu)點(diǎn)有:無(wú)須維護(hù)網(wǎng)站,因?yàn)樾⊥党绦蛑械臄?shù)據(jù)來(lái)自其他網(wǎng)站,它將隨著該網(wǎng)站的更新而更新;可以節(jié)省服務(wù)器資源,一般小偷程序就幾個(gè)文件,所有網(wǎng)頁(yè)內(nèi)容都是來(lái)自其他網(wǎng)站。缺點(diǎn)有:不穩(wěn)定,如果目標(biāo)網(wǎng)站出錯(cuò),程序也會(huì)出錯(cuò),而且,如果目標(biāo)網(wǎng)站進(jìn)行升級(jí)維護(hù),那么小偷程序也要進(jìn)行相應(yīng)修改;速度,因?yàn)槭沁h(yuǎn)程調(diào)用,速度和在本地服務(wù)器上讀取數(shù)據(jù)比起來(lái),肯定要慢一些。
(二)事例
下面就XMLHTTP在ASP中的應(yīng)用做個(gè)簡(jiǎn)單說(shuō)明
代碼: <%
'常用函數(shù)
'1、輸入url目標(biāo)網(wǎng)頁(yè)地址,返回值getHTTPPage是目標(biāo)網(wǎng)頁(yè)的html代碼
function getHTTPPage(url)
dim Http
set Http=server.createobject("MSXML2.XMLHTTP"
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312"
set http=nothing
if err.number<>0 then err.Clear
end function
'2、轉(zhuǎn)換亂瑪,直接用xmlhttp調(diào)用有中文字符的網(wǎng)頁(yè)得到的將是亂瑪,可以通過(guò)adodb.stream組件進(jìn)行轉(zhuǎn)換
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
'下面試著調(diào)用http://www.998w.net/class/的html內(nèi)容
Dim Url,Html
Url="http://www.998w.net/class/"
Html = getHTTPPage(Url)
Response.write Html
%>
------------------------------------------------------
代碼:
'代碼用XMLHTTP讀取遠(yuǎn)程文件
<%
Response.Buffer = True
Dim objXMLHTTP, xml
Set xml = Server.CreateObject("Microsoft.XMLHTTP"
xml.Open "GET", "http://www.998w.net/down/998w1.0.rar", False
xml.Send
' Add a header to give it a file name:
Response.AddHeader "Content-Disposition", _
"attachment;filename=mitchell-pres.zip"
' Specify the content type to tell the browser what to do:
Response.ContentType = "application/zip"
' Binarywrite the bytes to the browser
Response.BinaryWrite xml.responseBody
Set xml = Nothing
%>
(一)原理
小偷程序?qū)嶋H上是通過(guò)了XML中的XMLHTTP組件調(diào)用其它網(wǎng)站上的網(wǎng)頁(yè)。比如新聞小偷程序,很多都是調(diào)用了sina的新聞網(wǎng)頁(yè),并且對(duì)其中的html進(jìn)行了一些替換,同時(shí)對(duì)廣告也進(jìn)行了過(guò)濾。用小偷程序的優(yōu)點(diǎn)有:無(wú)須維護(hù)網(wǎng)站,因?yàn)樾⊥党绦蛑械臄?shù)據(jù)來(lái)自其他網(wǎng)站,它將隨著該網(wǎng)站的更新而更新;可以節(jié)省服務(wù)器資源,一般小偷程序就幾個(gè)文件,所有網(wǎng)頁(yè)內(nèi)容都是來(lái)自其他網(wǎng)站。缺點(diǎn)有:不穩(wěn)定,如果目標(biāo)網(wǎng)站出錯(cuò),程序也會(huì)出錯(cuò),而且,如果目標(biāo)網(wǎng)站進(jìn)行升級(jí)維護(hù),那么小偷程序也要進(jìn)行相應(yīng)修改;速度,因?yàn)槭沁h(yuǎn)程調(diào)用,速度和在本地服務(wù)器上讀取數(shù)據(jù)比起來(lái),肯定要慢一些。
(二)事例
下面就XMLHTTP在ASP中的應(yīng)用做個(gè)簡(jiǎn)單說(shuō)明
代碼: <%
'常用函數(shù)
'1、輸入url目標(biāo)網(wǎng)頁(yè)地址,返回值getHTTPPage是目標(biāo)網(wǎng)頁(yè)的html代碼
function getHTTPPage(url)
dim Http
set Http=server.createobject("MSXML2.XMLHTTP"
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312"
set http=nothing
if err.number<>0 then err.Clear
end function
'2、轉(zhuǎn)換亂瑪,直接用xmlhttp調(diào)用有中文字符的網(wǎng)頁(yè)得到的將是亂瑪,可以通過(guò)adodb.stream組件進(jìn)行轉(zhuǎn)換
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
'下面試著調(diào)用http://www.998w.net/class/的html內(nèi)容
Dim Url,Html
Url="http://www.998w.net/class/"
Html = getHTTPPage(Url)
Response.write Html
%>
------------------------------------------------------
代碼:
'代碼用XMLHTTP讀取遠(yuǎn)程文件
<%
Response.Buffer = True
Dim objXMLHTTP, xml
Set xml = Server.CreateObject("Microsoft.XMLHTTP"
xml.Open "GET", "http://www.998w.net/down/998w1.0.rar", False
xml.Send
' Add a header to give it a file name:
Response.AddHeader "Content-Disposition", _
"attachment;filename=mitchell-pres.zip"
' Specify the content type to tell the browser what to do:
Response.ContentType = "application/zip"
' Binarywrite the bytes to the browser
Response.BinaryWrite xml.responseBody
Set xml = Nothing
%>
相關(guān)文章
用正則和xmlHttp實(shí)現(xiàn)的asp小偷程序
用正則和xmlHttp實(shí)現(xiàn)的asp小偷程序...2007-03-03
asp下以Json獲取中國(guó)天氣網(wǎng)天氣的代碼
這兩天搞個(gè)天氣預(yù)報(bào),記得以前用.net版本有種是抓取百度天氣寫(xiě)入txt,再讀取。時(shí)間久了,txt很多。感覺(jué)不是很好。2010-07-07
非常不錯(cuò)的flash采集程序測(cè)試通過(guò)
非常不錯(cuò)的flash采集程序測(cè)試通過(guò)...2006-12-12
[轉(zhuǎn)]XMLHTTPRequest的屬性和方法簡(jiǎn)介
[轉(zhuǎn)]XMLHTTPRequest的屬性和方法簡(jiǎn)介...2007-02-02
網(wǎng)站生成靜態(tài)頁(yè)面攻略2:數(shù)據(jù)采集
網(wǎng)站生成靜態(tài)頁(yè)面攻略2:數(shù)據(jù)采集...2006-08-08

