答案:对前一个网友的程序进行了少许修改,完成的一个非常简单的小偷程序。
说简单是因为,原网页就比较规则。所以只要是查找和替换,就可以将想要的内容提取出来,大概所有的ASP或者PHP生成的网页都有这个特点吧。
可惜不能把文件上载所以只能是把程序的列表拷贝下来:共两个文件,List.asp和dispArticle.Asp。我在本地实验是可以的,但是没有拿到网上测一下,也不知在网上行不。
List.asp:
<html><head><title>一个简单的小偷程序,希望您喜欢</title>
<META NAME='ROBOTS' CONTENT = 'All'>
<link href=> </head>
<%
'Server.ScriptTimeOut=90
dim id,ccc_top,ccc_body
on error resume next
if Cint(request("page"))<=1 then
NoncePage=1
url="http://www.ynian.com/haha/List.Asp?ClassID=2"
else
NoncePage=request("page")
url="http://www.ynian.com/haha/List.Asp?ClassID=2&Page=" & CStr(NoncePage)
end if
'url="http://www.ynian.com/haha/List.Asp?ClassID=2"
ccc_code=getHTTPPage(url)
if err.number=0 then
start=Instr(ccc_code,"<table width=""100%"" border=""0"" cellspacing=""0"">")
over=Instr(ccc_code,"<script>document.title='永年信息网---乐翻天暴笑娱乐城 - 搞笑网文'</script>")
ccc_top=mid(ccc_code,start,over-start)
else
wscript.echo err.description
end if
%>
<body>
<CENTER>
<table border="1" width="750" cellspacing="0" cellpadding="0" bordercolorlight="#F1F1F1" bordercolordark="#FFFFFF"><%=ccc_top%></TD></TR></TBODY></TABLE>
<table border="1" width="750" cellspacing="0" cellpadding="0" bordercolorlight="#F1F1F1"
bordercolordark="#FFFFFF"></TD></TR></TBODY></TABLE>
</CENTER></BODY></HTML>
<%
function getHTTPPage(url)
on error resume next
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytes2BSTR(Http.responseBody)
set http=nothing
if err.number<>0 then err.Clear
end function
Function bytes2BSTR(vIn)
dim strReturn
dim i1,ThisCharCode,NextCharCode
strReturn = ""
For i1 = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i1,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i1+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i1 = i1 + 1
End If
Next
bytes2BSTR = strReturn
End Function
%>
dispArticle.Asp:
<html><head><title>显示部分</title>
[page_break]
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META NAME='ROBOTS' CONTENT = 'All'>
<link href=> </head>
<%
'Server.ScriptTimeOut=90
dim id,ccc_top,ccc_body
on error resume next
if Cint(request("id"))<=1 then
NoncePage=94
url="http://www.ynian.com/haha/dispArticle.Asp?ID=94"
else
NoncePage=request("id")
url="http://www.ynian.com/haha/dispArticle.Asp?ID=" & CStr(NoncePage)
end if
'url="http://www.ynian.com/haha/List.Asp?ClassID=2"
ccc_code=getHTTPPage(url)
ccc_code = replace(ccc_code,"AsE??","Asp?id=")
if err.number=0 then
start=Instr(ccc_code,"<TD align=middle height=40 vAlign=center width=""98%"">")
over=Instr(ccc_code,"<strong>供稿:</strong>永年信息网---乐翻天暴笑娱乐城</TD>")
ccc_top=mid(ccc_code,start,over-start)
else
wscript.echo err.description
end if
%>
<body>
<CENTER>
<table border="1" width="750" cellspacing="0" cellpadding="0" bordercolorlight="#F1F1F1" bordercolordark="#FFFFFF"><%=over%></TD></TR></TBODY></TABLE>
<table border="1" width="750" cellspacing="0" cellpadding="0" bordercolorlight="#F1F1F1"
bordercolordark="#FFFFFF"><%=start%></TD></TR></TBODY></TABLE>
<table border="1" width="750" cellspacing="0" cellpadding="0" bordercolorlight="#F1F1F1"
bordercolordark="#FFFFFF"><%=ccc_top%></TD></TR></TBODY></TABLE>
</CENTER></BODY></HTML>
<%
function getHTTPPage(url)
on error resume next
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytes2BSTR(Http.responseBody)
set http=nothing
if err.number<>0 then err.Clear
end function
Function bytes2BSTR(vIn)
dim strReturn
dim i1,ThisCharCode,NextCharCode
strReturn = ""
For i1 = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i1,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i1+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i1 = i1 + 1
End If
Next
bytes2BSTR = strReturn
End Function
%>