首页 | 心情日记 | 建站心得 | 编程技术 | 大盘分析 | 股市信息 | 学习园地 | 电脑技巧 | 物流外贸 | 另类其它 | 站长推荐 | 给我留言 | 相册

用户登陆
用户:
密码:
 
不保存保存一天
保存一月保存一年

站点日历
73 2024 - 3 48
     12
3456789
10111213141516
17181920212223
24252627282930
31


站点统计

最新评论

日志搜索

 标题   内容


ASP防注入之解决方案--加强版 ASP自动发送邮件代码
未知 防ASP注入代码   [ 日期:2007-12-18 18:11:40 ]   [ 来自:本站原创 ]

海外邮件中继,海外退信中继,美国高速VPS,不限流量VPN,邮局维护和管理,邮件网关,EMOS邮件中继,POSTFIX邮件中继,Winwebmail邮件中继,Winmail邮件中继,DBMail邮件中继,JDMail邮件中继,Exchange邮件中继,MDaemon邮件中继 淘宝店:http://shantan.taobao.com 云邮科技官网:www.yunrelay.com

【字体设置:
<%
Dim 

kelife_Post,kelife_Get,kelife_In,kelife_Inf,kelife_Xh,kelife_db,kelife_dbstr,iftofile,filesave_url,tofile,if_ip,if_time,if_wz

,if_ym,if_tj,if_cs,if_sj,fso,TextStr,a
'自定义需要过滤的字串,用 "防" 分隔
kelife_In = "''防;防and防exec防insert防select防delete防update防count防*防%防chr防mid防master防truncate防char防declare防<防>防

|防'"
kelife_Inf = split(kelife_In,"防")
iftofile=1 '是否记录非法注入信息,1表示记录,0表示不记录
filesave_url="/inc/"   '设置保存信息的路径,最后一个字符必须是"/"
tofile="aspsafe.htm"  '设置记录非法注入信息的文件名
if_ip=1 '是否记录非法注入的操作IP,1表示记录,0表示不记录
if_time=1 '是否记录非法注入的操作时间,1表示记录,0表示不记
if_wz=1 '是否记录非法注入的操作网址,1表示记录,0表示不记
if_ym=1 '是否记录非法注入的操作页面,1表示记录,0表示不记
if_tj=1 '是否记录非法注入的提交方式,1表示记录,0表示不记
if_cs=1 '是否记录非法注入的提交参数,1表示记录,0表示不记
if_sj=1 '是否记录非法注入的提交数据,1表示记录,0表示不记

tofile=filesave_url&tofile
Set fso = CreateObject("Scripting.FileSystemObject")
function is_fso()
  On Error Resume Next
  IsObjInstalled = False
  Err = 0
  Dim xTestObj
  Set xTestObj = Server.CreateObject("Scripting.FileSystemObject")
  If 0 = Err Then is_fso = True
  Set xTestObj = Nothing
  Err = 0
 ' Response.Write (IsObjInstalled)
end function

Function ReportFileStatus(FileName) 
'判断文件是否存在
Dim msg 
msg = -1 
If (fso.FileExists(FileName)) Then 
msg = 1 
Else 
msg = -1 
End If 
ReportFileStatus = msg 
End Function 

Function CreateAfile(FileName,TextStr)
    Set fso= CreateObject("Scripting.FileSystemObject")
    Set a = fso.CreateTextFile(FileName, True)
    a.WriteLine(TextStr)
    a.Close
End function

Function WriteTxtFile(FileName,TextStr,WriteORAppendType) 
Const ForReading = 1, ForWriting = 2 , ForAppending = 8 
Dim f, m 
select Case WriteORAppendType 
Case 1: '文件进行写操作 
Set f = fso.OpenTextFile(FileName, ForWriting, True) 
f.Write TextStr 
f.Close 
If ReportFileStatus(FileName) = 1 then 
WriteTxtFile = 1 
Else 
WriteTxtFile = -1 
End if 
Case 2: '文件末尾进行写操作 
If ReportFileStatus(FileName) = 1 then 
Set f = fso.OpenTextFile(FileName,ForAppending) 
f.Write TextStr 
f.Close 
WriteTxtFile = 1 
Else 
WriteTxtFile = -1 
End if 
End select 
End Function 

function write_file(TextStr)
    if is_fso=true then
        if ReportFileStatus(server.MapPath(tofile))=1 then
            WriteTxtFile server.MapPath(tofile),TextStr,2
        else
            CreateAfile server.MapPath(tofile),TextStr
        end if
    end if
end function

function writefile()
if is_fso=true and iftofile=1 then
    Set fso = CreateObject("Scripting.FileSystemObject")
    TextStr="<br><font color=#ff0000>非法操作!本站已经给大侠您做了如下记录↓</font><br>"
    if if_ip=1 then TextStr=TextStr&"操作IP:"&Request.ServerVariables("REMOTE_ADDR")&"<br>"
    if if_time=1 then TextStr=TextStr&"操作时间:"&Now&"<br>"
    if if_wz=1 then TextStr=TextStr&"操作网址:"&Request.ServerVariables("Http_Host")&"<br>"
    if if_ym=1 then TextStr=TextStr&"操作页面:http://"&Request.ServerVariables("Http_Host")&Request.ServerVariables

("URL")&"?"&Request.ServerVariables("Query_String")&"<br>"
    if if_tj=1 then
        If Request.Form<>"" Then
            TextStr=TextStr&"提交方式:POST<br>"
        else
            TextStr=TextStr&"提交方式:GET<br>"
        end if
    end if
    if if_sj=1 then
        If Request.Form<>"" Then
            TextStr=TextStr&"提交数据:"&Request.Form(kelife_Post)&"<br>"
        else
            TextStr=TextStr&"提交数据:"&Request.QueryString(kelife_Get)&"<br>"
        end if
    end if
    if if_cs=1 then
        If Request.Form<>"" Then
            TextStr=TextStr&"提交参数:"&kelife_Post&"<br>"
        else
            TextStr=TextStr&"提交参数:"&kelife_Get&"<br>"
        end if
    end if
    write_file(TextStr)
end if
end function

If Request.Form<>"" Then
For Each kelife_Post In Request.Form
For kelife_Xh=0 To Ubound(kelife_Inf)
If Instr(LCase(Request.Form(kelife_Post)),kelife_Inf(kelife_Xh))<>0 Then
Response.Write "<Script Language=javascript>alert('站长友情提示黑客大侠↓请不要在参数中包含非法字符尝试注入攻击本站,本站做起

来很不容易的.俺是菜鸟,好怕怕,放俺一马吧!有话好话,请给俺留言:http://www.030904.com/gbook');</Script>"
Response.Write "非法操作!本站已经给大侠您做了如下记录↓<br>"
Response.Write "操作IP:"&Request.ServerVariables("REMOTE_ADDR")&"<br>"
Response.Write "操作时间:"&Now&"<br>"
Response.Write "操作网址:"&Request.ServerVariables("Http_Host")&"<br>"
Response.Write "操作页面:http://"&Request.ServerVariables("Http_Host")&Request.ServerVariables("URL")

&"?"&Request.ServerVariables("Query_String")&"<br>"
Response.Write "提交方式:POST<br>"
Response.Write "提交参数:"&kelife_Post&"<br>"
Response.Write "提交数据:"&Request.Form(kelife_Post)
writefile()
Response.End
End If
Next
Next
End If
If Request.QueryString<>"" Then
For Each kelife_Get In Request.QueryString
For kelife_Xh=0 To Ubound(kelife_Inf)
If Instr(LCase(Request.QueryString(kelife_Get)),kelife_Inf(kelife_Xh))<>0 Then
Response.Write "<Script Language=javascript>alert('站长友情提示黑客大侠↓请不要在参数中包含非法字符尝试注入攻击本站,本站做起

来很不容易的.俺是菜鸟,好怕怕,放俺一马吧!有话好话,请给俺留言:http://www.030904.com/gbook');</Script>"
Response.Write "非法操作!本站已经给大侠您做了如下记录↓<br>"
Response.Write "操作IP:"&Request.ServerVariables("REMOTE_ADDR")&"<br>"
Response.Write "操作时间:"&Now&"<br>"
Response.Write "操作网址:"&Request.ServerVariables("Http_Host")&"<br>"
Response.Write "操作页面:http://"&Request.ServerVariables("Http_Host")&Request.ServerVariables("URL")

&"?"&Request.ServerVariables("Query_String")&"<br>"
Response.Write "提交方式:GET<br>"
Response.Write "提交参数:"&kelife_Get&"<br>"
Response.Write "提交数据:"&Request.QueryString(kelife_Get)
writefile()
Response.End
End If
Next
Next
End If
%>
点击下载此文件

暂时没有评论
   发表评论 - 不要忘了输入验证码哦!
作者: 用户:  密码:  我要注册 验证码: 
为防止广告注册机程序,验证码不会自动显示,请点击此处显示或者(刷新)验证码!
评论:

禁止表情
禁止UBB
禁止图片
识别链接
识别关键字
确定发布?
最多可以输入200个字,目前你已经输入了0个字;你今日还可以发表10条评论!
 
   

CopyRight © 2008-2010 广东金融学院030904班 All Rights Reserved
Powered by www.030904.com