?? clsthief.asp
字號:
<%
Class clsThief
'____________________
Private value_ '竊取到的內容
Private src_ '要偷的目標URL地址
Private isGet_ '判斷是否已經偷過
public property let src(str) '賦值—要偷的目標URL地址/屬性
src_=str
end property
public property get value '返回值—最終竊取并應用類方法加工過的內容/屬性
value=value_
end property
Public Property get Version
Version="燕鋒小偷類 Version 2007 www.sohv.cn"
End Property
private sub class_initialize()
value_=""
src_=""
isGet_= false
end sub
private sub class_terminate()
end sub
private 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
public sub steal() '竊取目標URL地址的HTML代碼/方法
if src_<>"" then
dim Http
set Http=server.createobject("MSXML2.XMLHTTP")
Http.open "GET",src_ ,false
Http.send()
if Http.readystate<>4 then
exit sub
end if
value_=BytesToBSTR(Http.responseBody,"GB2312")
isGet_= True
set http=nothing
if err.number<>0 then err.Clear
else
response.Write("<script>alert(""請先設置src屬性!"")</script>")
end if
end sub
'轉換為小寫
public sub LcaseStr()
if isGet_= false then call steal()
value_=Lcase(value_)
end sub
'刪除偷到的內容中里面的換行、回車符以便進一步加工/方法
public sub noReturn()
if isGet_= false then call steal()
value_=replace(replace(value_ , vbCr,""),vbLf,"")
end sub
'對偷到的內容中的個別字符串用新值更換/方法
public sub change(oldStr,str) '參數分別是舊字符串,新字符串
if isGet_= false then call steal()
value_=replace(value_ , oldStr,str)
end sub
'按指定首尾字符串對偷取的內容進行裁減(不包括首尾字符串)/方法
public sub cut(head,bot) '參數分別是首字符串,尾字符串
if isGet_= false then call steal()
if instr(value_ , head)>0 and instr(value_ , bot)>0 then
value_=mid(value_ ,instr(value_ ,head)+len(head),instr(value_ ,bot)-instr(value_ ,head)-len(head))
else
value_= "<p align=""center"">函數cut指定裁減內容不存在,請重新定義"
end if
end sub
'按指定首尾字符串對偷取的內容進行裁減(包括首尾字符串)/方法
public sub cutX(head,bot) '參數分別是首字符串,尾字符串
if isGet_= false then call steal()
if instr(value_,head)>0 and instr(value_,bot)>0 then
value_=mid(value_ ,instr(value_ ,head),instr(value_ ,bot)-instr(value_ ,head)+len(bot))
else
value_= "<p align=""center"">函數cutX指定裁減的內容不存在"
end if
end sub
'按指定首尾字符串位置偏移指針對偷取的內容進行裁減/方法
public sub cutBy(head,headCusor,bot,botCusor)
'參數分別是首字符串,首偏移值,尾字符串,尾偏移值,左偏移用負值,偏移指針單位為字符數
if isGet_= false then call steal()
if instr(value_,head)>0 and instr(value_,bot)>0 then
value_=mid(value_ ,instr(value_ ,head)+len(head)+headCusor,instr(value_ ,bot)-1+botCusor-instr(value_ ,head)-len(head)-headcusor)
else
value_= "<p align=""center"">函數cutBy指定裁減內容不存在"
end if
end sub
'按指定首尾字符串對偷取的內容用新值進行替換(不包括首尾字符串)/方法
public sub filt(head,bot,str) '參數分別是首字符串,尾字符串,新值,新值位空則為過濾
if isGet_= false then call steal()
if instr(value_,head)>0 and instr(value_,bot)>0 then
value_=replace(value_,mid(value_ ,instr(value_ ,head)+len(head),instr(value_ ,bot)-1),str)
else
value_= "<p align=""center"">函數filt指定替換的內容不存在"
end if
end sub
'按指定首尾字符串對偷取的內容用新值進行替換(包括首尾字符串)/方法
public sub filtX(head,bot,str) '參數分別是首字符串,尾字符串,新值,新值為空則為過濾
if isGet_= false then call steal()
if instr(value_,head)>0 and instr(value_,bot)>0 then
value_=replace(value_,mid(value_ ,instr(value_ ,head),instr(value_ ,bot)+len(bot)-1),str)
else
value_= "<p align=""center"">函數filtX指定替換的內容不存在"
end if
end sub
'按指定首尾字符串位置偏移指針對偷取的內容新值進行替換/方法
public sub filtBy(head,headCusor,bot,botCusor,str)
'參數分別是首字符串,首偏移值,尾字符串,尾偏移值,新值,左偏移用負值,偏移指針單位為字符數,新值為空則為過濾
if isGet_= false then call steal()
if instr(value_,head)>0 and instr(value_,bot)>0 then
value_=replace(value_ ,mid(value_ ,instr(value_ ,head)+len(head)+headCusor,instr(value_ ,bot)-1+botCusor-instr(value_ ,head)-len(head)-headcusor),str)
else
value_= "<p align=""center"">函數filtBy指定替換的內容不存在"
end if
end sub
'將偷取的內容中的絕對URL地址改為本地相對地址
public sub local()
dim tempReg
set tempReg=new RegExp
tempReg.IgnoreCase=true
tempReg.Global=true
tempReg.Pattern="^(http|https|ftp):(\/\/|////)(\w+.)+(com|net|org|cc|tv|cn|biz|com.cn|net.cn|sh.cn)\/"
value_=tempReg.replace(value_ ,"")
set tempReg=nothing
end sub
'對偷到的內容中的符合正則表達式的字符串用新值進行替換/方法
public sub replaceByReg(patrn,str) '參數是你自定義的正則表達式,新值
if isGet_= false then call steal()
dim tempReg
set tempReg=new RegExp
tempReg.IgnoreCase=true
tempReg.Global=true
tempReg.Pattern=patrn
value_=tempReg.replace(value_ ,str)
set tempReg=nothing
end sub
'應用正則表達式對符合條件的內容進行分塊采集并組合,最終內容為以<!--lkstar-->隔斷的大文本/方法
'通過屬性value得到此內容后你可以用split(value,"<!--lkstar-->")得到你需要的數組
public sub pickByReg(patrn) '參數是你自定義的正則表達式
if isGet_= false then call steal()
dim tempReg,match,matches,content
set tempReg=new RegExp
tempReg.IgnoreCase=true
tempReg.Global=true
tempReg.Pattern=patrn
set matches=tempReg.execute(value_)
for each match in matches
content=content&match.value&"<!--lkstar-->"
next
value_=content
set matches=nothing
set tempReg=nothing
end sub
'類排錯模式——在類釋放之前應用此方法可以隨時查看你截獲的內容HTML代碼和頁面顯示效果/方法
public sub debug()
dim tempstr
tempstr="<SCRIPT>function runEx(){var winEx2 = window.open("""", ""winEx2"", ""width=500,height=300,status=yes,menubar=no,scrollbars=yes,resizable=yes""); winEx2.document.open(""text/html"", ""replace""); winEx2.document.write(unescape(event.srcElement.parentElement.children[0].value)); winEx2.document.close(); }function saveFile(){var win=window.open('','','top=10000,left=10000');win.document.write(document.all.asdf.innerText);win.document.execCommand('SaveAs','','javascript.htm');win.close();}</SCRIPT><center><TEXTAREA id=asdf name=textfield rows=32 wrap=VIRTUAL cols=""120"">"&value_&"</TEXTAREA><BR><BR><INPUT name=Button onclick=runEx() type=button value=""查看效果""> <INPUT name=Button onclick=asdf.select() type=button value=""全選""> <INPUT name=Button onclick=""asdf.value=''"" type=button value=""清空""> <INPUT onclick=saveFile(); type=button value=""保存代碼""></center>"
response.Write(tempstr)
end sub
end class
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -