用正则和xmlHttp做到的asp小偷程序
用正则和xmlHttp做到的asp小偷程序: 代码如下: <% '======================================== class EngineerSearch '老龙:laolong9999@sina.com ':模拟XML获取http标记资源(用过之后就知道为什么XML有用:)) '利用引擎搜索(显示引擎信息或其超连接网站上的信息或直接一个指定页面的相关信息,利用正则和xmlHttp, '程序的使用需要会构造正则) '--------------------------------------------------------------- private oReg,oxmlHttp'一个正则,一个微软xmlhttp '--------------------------------------------------------------- public sub class_initialize()'对象建立触发 set oReg=new regExp oReg.Global=true oReg.IgnoreCase=true set oXmlHttp=server.createobject("Microsoft.XmlHttp") end sub '--------------------------------------------------------------- public sub class_terminate()'对象销毁触发 set oReg=nothing'必须手动释放class内的自建对象,asp只自动释放由class定义的对象 set oXmlHttp=nothing If typename(tempReg)<>"nothing" then'方法体内的对象释放资源 set tempReg=nothing end if end sub '--------------------------------------------------------------- '引擎级搜索 public function engineer(url,EngineerReg) '功能介绍:获得url的返回信息(通常用于引擎查找),提取其中的EngineerReg的特定信息,返回matches集合到 '函数名。获得url查询结果,搜寻出用engineerReg正则定义的结果,生成一个matches集合, '由于无法建立集合及操作集合个数(vbscript),最好再自己遍历集合,也可以考虑二维数组 dim strConent strContent=oXmlHttp.open("get",url,false) on error resume next oXmlHttp.send() if err.number<>0 then exit function end if strContent=bytes2BSTR(oXmlHttp.responseBody) if isnull(EngineerReg) then engineer=AbsoluteURL(strContent,url) else oReg.Pattern=EngineerReg set engineer=oReg.Execute(AbsoluteURL(strContent,url)) end if end function '--------------------------------------------------------------- '汉字编码,(网人) public Function bytes2BSTR(vIn) strReturn = "" For i = 1 To LenB(vIn) ThisCharCode = AscB(MidB(vIn,i,1)) If ThisCharCode < &H80 Then strReturn = strReturn & Chr(ThisCharCode) Else NextCharCode = AscB(MidB(vIn,i+1,1)) (编辑:汽车网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |