时间:2021-05-25
类代码(cls.asp)
<%
ClassclsThief
PrivatestrUrl'偷取地址
PrivatestrValue'偷取的内容,所有内容
PrivatestrResult'偷取结果,可以具体某一块内容
Privateflag'是否已经偷过
'-------初始化类--------'
PrivateSubClass_Initialize()
strUrl=""
strValue=""
strResult=""
flag=false
EndSub
'------类结束-----------'
PrivateSubClass_Terminate()
EndSub
'------初始化url属性----'
PublicPropertyLeturl(ByValiurl)
strUrl=iurl
EndProperty
'------返回输出内容----'
publicpropertygetvalue
value=strValue
endproperty
publicpropertygetresult
result=strResult
endproperty
'------------文字处理-----------'
privateFunctionBytesToBstr(body,Cset)
dimobjstream
setobjstream=Server.CreateObject("adodb.stream")
objstream.Type=1
objstream.Mode=3
objstream.Open
objstream.Writebody
objstream.Position=0
objstream.Type=2
objstream.Charset=Cset
BytesToBstr=objstream.ReadText
objstream.Close
setobjstream=nothing
EndFunction
'-------文字处理-------'
privateFunctionIchange(str)
DimfinalStr
DimicharCode
DiminextCode
Fori=1Tolenb(str)
icharCode=ascb(midb(str,i,1))
IficharCode<&H80Then
finalStr=finalStr&chr(icharCode)
Else
inextCode=ascb(midb(str,i+1,1))
finalstr=finalstr&chr(clng(icharCode)*&H100+cint(inextCode))
i=i+1
EndIf
Next
Ichange=finalStr
EndFunction
'-------内容抓取--------'
PublicsubSeize()
ifstrUrl<>""then
dimiconnect
Seticonnect=CreateObject("Microsoft.XMLHTTP")
iconnect.open"GET",strUrl,false
iconnect.send()
strValue=BytesToBSTR(iconnect.responseBody,"GB2312")
flag=true
seticonnect=nothing
iferr.number<>0thenerr.Clear
else
response.write("请设置url的属性,即url地址")
endif
endsub
'------内容分析------'
PublicsubAssay(head,headCusor,bot,botCusor)
ifflag=falsethencallSeize()
ifinstr(strValue,head)andinstr(strValue,bot)then
diminum
inum=len(strValue)-instr(strValue,head)-len(head)-headCusor
strValue=right(strValue,inum)
inum=instr(strValue,bot)-1+botCusor
strResult=left(strValue,inum)
else
strResult="没有匹配到相关记录,请检查开始标记代码是否唯一"
endif
endsub
'----替换空格及回车行----'
publicsubShift()
ifflag=falsethencallSeize()
strResult=replace(replace(strResult,vbCr,""),vbLf,"")
endsub
'------对内容自定义替换----'
PublicsubChange(oldStr,newStr)
ifflag=falsethencallSeize()
strResult=replace(strResult,oldStr,newStr)
endsub
'--------自定义正则进行匹配---'
publicsubpickByReg(patrn)
ifisGet_=falsethencallSeize()
dimtempReg,match,matches,content
settempReg=newRegExp
tempReg.IgnoreCase=true
tempReg.Global=true
tempReg.Pattern=patrn
setmatches=tempReg.execute(value_)
foreachmatchinmatches
content=content&match.value&"<!--lkstar-->"
next
strValue=content
setmatches=nothing
settempReg=nothing
endsub
'--------如果有首页文件则转入-----------'
PublicsubCheckFile(folderName,fileName)
dimurl
Setfs=Server.CreateObject("Scripting.FileSystemObject")
iffs.FolderExists(server.MapPath("./")&"\"&folderName&"\"&fileName)then
setfs=nothing
url=folderName&"/"&fileName
response.writeurl
'response.redirecturl
endif
endsub
'------生成文件------'
PublicsubMakeFile(folderName,fileName)
Setfs=Server.CreateObject("Scripting.FileSystemObject")
iffolderName<>""then
ifnotfs.FolderExists(server.MapPath("/"&folderName&"/"))then
response.write"文件不存在"
fs.CreateFolder(folderName)
else
response.write"文件存在"
endif
endif
SetCrFi=fs.CreateTextFile(server.MapPath("./")&"\"&folderName&"\"&fileName)
Crfi.Writeline(strResult)
setCrFi=nothing
setfs=nothing
dimurl
url=folderName&"/"&fileName
response.redirecturl
endsub
'-------查看偷出的代码----'
publicsublook()
dimtempstr
tempstr="<SCRIPT>functionrunEx(){varwinEx2=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();}functionsaveFile(){varwin=window.open('','','top=10000,left=10000');win.document.write(document.all.asdf.innerText);win.document.execCommand('SaveAs','','javascript.htm');win.close();}</SCRIPT><center><TEXTAREAid=asdfname=textfieldrows=32wrap=VIRTUALcols=""120"">"&strResult&"</TEXTAREA><BR><BR><INPUTname=Buttononclick=runEx()type=buttonvalue=""查看效果""> <INPUTname=Buttononclick=asdf.select()type=buttonvalue=""全选""> <INPUTname=Buttononclick=""asdf.value=''""type=buttonvalue=""清空""> <INPUTonclick=saveFile();type=buttonvalue=""保存代码""></center>"
response.Write(tempstr)
endsub
endclass
%>
引用页(test.asp)
<!--#IncludeFile="cls.asp"-->
<%
dimmyThief,value
setmyThief=newclsThief'实例化类
myThief.CheckFile"","index.html"'检测是否已经偷过并生成
myThief.url="http://"'目标URL
myThief.Seize'开始偷取
myThief.Assay"<html>","-7","</html>","7"'剪切标记
myThief.Change"择优","浪人"'进行替换
value=myThief.result'最后得到的内容
myThief.MakeFile"","index.html"'生成文件
setmyThief=nothing
'response.writevalue
%>
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
现在网上流行的小偷程序比较多,有新闻类小偷,音乐小偷,下载小偷,那么它们是如何做的呢,下面我来做个简单介绍,希望对各位站长有所帮助。(一)原理小偷程序实际上是通
数月前,网上疯传一个段子,一小偷将数家商店内的二维码偷偷换成了自己的,等到众店主发现时,小偷已默默“收”了70多万元。朋友圈的调侃竟然成真。近日,佛山东方广场数
QT有封装好的UDP协议的类,QUdpSocket,里面有我们想要的函数接口。感兴趣的话,可以看看。先搞服务端吧,写一个子类,继承QDialog类,起名为Udp
最近一段时间,采集很热门,从新闻小偷,到音乐小偷,到新闻采集,Flash采集,都有他的踪影,现在还有很多的人对采集都很感兴趣,为了服务大家,我也正在写一套采集程
你甚至为每个ajax请求添加一个后端页面!你是不是甚至在想,尼玛,要是能够直接调用C#类文件中的方法就爽了?!(这里FishLi做了一个框架,有兴趣可以去看看)