2006-02-17 22:39:48 by: h4x0r

用vbs保护我们的系统日志

Font Size: Large | Medium | Small
我在浅谈网站的安全应急响应的日志里说了 4.日志被删除了。。。。。并不可怕

说有个叫数据恢复大师的软件特别牛b ,但是那个操作复杂 而且万一修复不回来呢?

难道我们就 没有一种好的办法来保护我们的系统日志?

呵呵当然有
我们不妨换个方向来思考问题:
既然病毒能把自己作为附件发送到邮箱里,
我们为什么不能用病毒把日志发送到我们的邮箱里?
我就不信 他能把163.com或者21cn or 263.com一块黑了来删除日志
说干就干
经过一天的不吃不喝。几经修改,拼凑了下面的代码
代码很简单,又有注释 就不多费口水了
dim min,mfrom,mto,uname,upass,file,totime,lenth,len2,smtpser,nDate,uDate
uDate=Date+1
min=inputbox("每隔多长时间发送一次?",,20)
if(IsNumeric(min)=False or min="") then
wscript.quit
end if
mfrom=inputbox("发信地址 :",,"@163.com")
if(InStrRev(mfrom,"@")="" or mfrom="") then
wscript.echo "发信地址不正确"
wscript.quit
end if
upass=inputbox("发送信箱的密码")
lenth=InStrRev(mfrom,"@")
uname=left(mfrom,lenth-1)
mto=inputbox("接受邮箱:")
if(InStrRev(mfrom,"@")="" or mto="") then
wscript.echo "收信地址不正确"
wscript.quit
end if
path1=inputbox("请输入今天的日志名称",,"c:\\wwwroot\\ex050917.log")
path2=inputbox("请输入第二天日志的名称:",,"c:\\wwwroot\\ex050918.log")
len2=len(mfrom)-lenth
smtpser="smtp."&right(mfrom,len2)
totime=inputbox("截止到第二天:",,"8:30 PM/AM")
stime=cDate(totime) '转换为截止时间
while(1)
if(ReportFileStatus(path2)="N") then '如果存在最新的日志就发送最新的日志
file=path1
else file=path2
end if
NameSpace = "http://schemas.microsoft.com/cdo/configuration/"
Set Email = CreateObject("CDO.Message")
Email.From = mfrom
Email.To = mto
Email.Subject = "请看日志"
Email.Textbody = "今天的日志"
Email.AddAttachment path,true '添加附件,如果有多个就另写一行 也可以手工添加
With Email.Configuration.Fields
.Item(NameSpace&"sendusing") = 2
.Item(NameSpace&"smtpserver") = smtpser '发信服务器
.Item(NameSpace&"smtpserverport") = 25
.Item(NameSpace&"smtpauthenticate") = 1
.Item(NameSpace&"sendusername") = uname'发信人的姓名
.Item(NameSpace&"sendpassword") = upass '发信邮箱密码
.Update
End With
Email.Send
wscript.sleep min*60*1000 '每搁min分钟发送一次
MyTime = Time '获得当前时间
if(Date=uDate and MyTime-stime>0) then
wscript.quit
end if
wend
Function ReportFileStatus(filespec)
 Dim fso, msg
 Set fso = CreateObject("Scripting.FileSystemObject")
 If (fso.FileExists(filespec)) Then
 msg ="Y"
 Else
 msg = "N"
 End If
 ReportFileStatus = msg
End Function

使用的时候要注意发送邮箱和接收邮箱不要相同(尤其是密码)
如果网站访问量比较大,邮箱有可能被撑暴
最好是下班的时间打开,上班了就关闭。
并且每天看一次邮件 清理一次邮箱(不过分吧)
---
如果还觉得不过瘾
那就装个sniffer吧 把嗅探得到的数据也发过去
这样的话他的一举一动都跑不了了
呵呵 希望大虾们多多指教

作者:不详
forum:21o.net
Comments Feed Comments Feed: http://www.4evil.org/feed.asp?q=comment&id=593

There is no comment on this article.

Post Comment
Smilies
[smile] [confused] [cool] [cry]
[eek] [angry] [wink] [sweat]
[lol] [stun] [razz] [redface]
[rolleyes] [sad] [yes] [no]
[heart] [star] [music] [idea]
Enable UBB Codes
Auto Convert URL
Show Smilies
Hidden Comment
Username:   Password:   Register Now?
Security Code * Please Enter the Security Code