位置:海鸟网 > IT > ASP.NET >

AspHTTP的组件的获取使用(小偷程序教学)

About AspHTTP
其实ASP类的小偷的本质都是利用 XMLHTTP向远程WEB发送请求,
然后分析远程的信息,从而获得自己需要的结果
AspHTTP 通过HTTP协议允许你提交GET/POST/HEAD
它是一个组件化的程序。
其中包括的特性:

GET, HEAD and POST 的方法请求
返回HTTP协议头
接受被修改过的HTTP头
判断是否超时
支持代理设置
客户端环境的判断
Custom Content-Type headers for POST
自动转向
支持多种登陆环境
将远程文件转换成二进制流文件
允许客户端的HTTP请求。

如何获取 AspHTTP

或者直接去官方购买
ASPHTTP并不是一个Free的产品,但好像存在有注册BUG,
如果你将你的计算机日期往后调回2004年前就可以合法的使用该组件了。
就是系统时间欺骗,^_^

AspHTTP的安装
将下面的保存为一个bat文件,运行就可以直接安装ASPHTTP

echo off
echo 文件说明:组件注册
echo 欢迎使用ASPHTTP组件!
echo 小偷教程
echo 组件版本 3.X
copy ASPPING.DLL %windir%system32
regsvr32 %windir%system32ASPPING.DL

下面是几个特别的例子说明:
1.获取页面上的地址列表 geturl.asp

  <html>
  <body>
  <%
  Server.ScriptTimeout = 240
  Set HttpObj = Server.CreateObject("AspHTTP.Conn")
  HttpObj.Url = "http://www.baidu.com/search/jiqiao.html"
  HttpObj.RequestMethod = "GET"
  HttpObj.UserAgent = "Mozilla/2.0 (compatible; MSIE 6.0B; Windows NT)"
  strResult = HttpObj.GetURL
  Response.Write "<h2>A HREF List</h2>"
  varHREFArray = HttpObj.GetHREFs
  intHREFArrayLimit = UBound(varHREFArray) -1
  For I = 0 to intHREFArrayLimit
    Response.Write varHREFArray(I) & "<br>" & VBCrLF
  Next
  %>
  </body>
  </html>

2.获取远程的文件并下载到本地 getImg.asp

<%
  Server.ScriptTimeout = 240
  Set HttpObj = Server.CreateObject("AspHTTP.Conn")
  HttpObj.Url = "http://www.im286.com/images/im286/logo.gif"
  '图片或文件的地址这样的有后缀的完整路径
  HttpObj.FollowRedirects = false
  HttpObj.RequestMethod = "GET"
  HttpObj.UserAgent = "Mozilla/2.0 (compatible; MSIE 6.01; Windows NT)"
  HttpObj.SaveFileTo = "D:/WEB/weburl/log.gif"        '图片或文件的保存路径
  HttpObj.GetURL
  Response.Write "已经成功下载到本地了"
  %>

3.获取远程的图片并显示出来  img.asp

<%
Response.ContentType = "image/gif"        '远程文件类型
Set HTTPObj = Server.CreateObject("AspHTTP.Conn")
HTTPObj.Url = "http://www.im286.com/images/im286/logo.gif"
HTTPObj.GetURL
Response.BinaryWrite HTTPObj.BinaryData
%>

4.获取远程页面的内容,并保存到本地

 <%
Set HttpObj = Server.CreateObject("AspHTTP.Conn")
HTTPObj.Url = "http://www.im286.com/index.php"
'HTTPObj.PostData = "suid=jimb&pwd=macabre&id=32&val=1.5"
HTTPObj.TimeOut = 1800
HTTPObj.Accept = "*/*"
HTTPObj.FollowRedirects = true
HTTPObj.Port = 80        
'HTTPObj.Proxy = "xxx.net:8080"                '使用代理地址,端口
'HTTPObj.ProxyPassword = "proxyusername:proxypassword"        '代理的用户名,密码
HttpObj.SaveFileTo = "D:/WEB/weburl/index.html"                '将远程页面保存到本地
HTTPObj.UserAgent = "Mozilla Compatible (MS IE 3.01 WinNT)"
HTTPObj.Protocol = "HTTP/1.1"
HTTPObj.Authorization = "USER:pass"        
HTTPObj.ContentType = "application/x-www-form-urlencoded"
HTTPObj.RequestMethod = "POST"
'HTTPObj.GetHREFs
'HTTPObj.RequestMethod = "HEAD"
strResult = HTTPObj.GetURL
response.write
strResult
%>