- 相關推薦
防盜鏈接ASP函數實現代碼
簡單介紹下功能吧:使用了ASP的一個對象ServerVariables(服務器環境變量),通過這個環境變量可以獲取到真正的下載地址再通過一些簡單的VBS內置函數破壞其真正地址的完整性。達到欺騙下載軟件的功能。現附上源碼提供大家學習。
復制代碼 代碼如下:
<% FunctIon DownloadFIle(StrFIle)
StrFIlename=StrFIle
Response.Buffer=True
Response.Clear
Set S=Server.CreateObJect("ADODB.Stream")
S.Open
S.Type=1
on Error Resume Next
Set Fso=Server.CreateObJect("ScrIptIng.FIleSystemObJect")
If Not Fso.FIleExists(StrFIleName) Then
From_Url=Cstr(Request.ServerVarIables("HTTP_REFERER"))
Serv_Url=Cstr(Request.ServerVarIables("SERVER_NAME"))
If MId(From_Url,8,len(Serv_Url)) <> Serv_Url Then
Response.WrIte "該文件不存在或者已經刪除."
Response.End
End If
Response.RedIrect Request.ServerVarIables("HTTP_REFERER")
Response.End
End If
FileExt=MId(StrFIlename,InStrRev(StrFIleName, ".")+1)
Select Case UCase(FIleExt)
Case "ASP", "ASA", "ASPX", "ASAX", "MDB", "PHP", "JSP", "SHTML", "HTML", "HTM", "TV", "DATA"
From_Url=Cstr(Request.ServerVarIables("HTTP_REFERER"))
Serv_Url=Cstr(Request.ServerVarIables("SERVER_NAME"))
If MId(From_Url,8,len(Serv_Url)) <> Serv_Url Then
Response.WrIte "該文件不存在或者已經刪除."
Response.End
End If
Response.RedIrect Request.ServerVarIables("HTTP_REFERER")
Response.End
End Select
Set F=Fso.GetFIle(StrFIlename)
IntFIlelength=F.SIze
s.LoadFromFIle(StrFIlename)
If Err Then
From_Url=Cstr(Request.ServerVarIables("HTTP_REFERER"))
Serv_Url=Cstr(Request.ServerVarIables("SERVER_NAME"))
If MId(From_Url,8,len(Serv_Url)) <> Serv_Url Then
Response.WrIte "該文件數據不完整或許已損壞."
Response.End
End If
Response.RedIrect Request.ServerVarIables("HTTP_REFERER")
Response.End
End If
Set Upload=Server.CreateObJect("PersIts.Upload")
If Upload Is Nothing Then
Response.AddHeader "Content-DIsposItIon","attachment; FIlename="&F.Name
Response.AddHeader "Content-Length",IntFilelength
Response.CharSet="UTF-8"
Response.ContentType="application/x-download"
Response.BinaryWrite S.Read
Response.Flush
S.Close
Set s=NothIng
Else
Upload.SendBinary StrFIlename,True,"application/x-download",False
End If
End FunctIon
%>
使用:<%call>。
【防盜鏈接ASP函數實現代碼】相關文章:
關于asp 的常用函數用法10-11
解讀Rnd 函數中的asp08-03
關于ASP.NET使用JavaScript顯示信息提示窗口實現原理及代碼05-09
揭秘利用ajax實現預覽鏈接看鏈接的內容10-19
JavaScript實現網頁刷新代碼段08-07
將php實現過濾UBB代碼09-11
ASP.NET Page函數調用解析10-01
php對圖像的各種處理函數代碼總結07-03
ASP.NET連SQL7接口的源代碼06-06