网络编程
位置:首页>> 网络编程>> Asp编程>> ASP伪造REFERER方法

ASP伪造REFERER方法

 来源:asp之家 发布时间:2008-07-03 12:48:00 

标签:referer,XMLHTTP,代码


一个网站的一个页面download.asp通过判断referer来确定是不是从他本站点过来的链接,使用这个功能我们可以用来防止下载盗链,当然这种方法不是最可靠的,看下面的代码,通过XMLHTTP就伪造了REFERER地址。

ASP实现下载系统防盗链方法

代码:

<%
Function GetBody(weburl) 
    Set Retrieval = Server.CreateObject("MSXML2.XMLHTTP") 
    With Retrieval 
        .Open "Get", weburl, False, "", "" 
        .setRequestHeader "referer","https://www.aspxhome.com/"'想改什么就改什么
        .Send 
        GetBody = .ResponseBody
    End With 
    GetBody = BytesToBstr(GetBody,"GB2312")
    Set Retrieval = Nothing 
End Function
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
Response.Write(GetBody("https://www.aspxhome.com/referer.asp"))
%> 
0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com