首页 电脑 电脑学堂 查看内容

有人登陆就注销脚本

2009-10-19 09:51 538 0

摘要: on error resume next set arg=wscript.arguments If arg.count=0 then wscript.echo “use:// cscript.exe ...
关键词: oRegExp set wscript oShell oExec Nothing Matches strOut Num Tport

on error resume next set arg=wscript.arguments If arg.count=0 then wscript.echo “use:// cscript.exe FS.vbs port” sleep 1000 wscript.quit End If Tport=arg(0) Runs=false While runs=false Dim oShell,oExec,strOut,oRegExp,Matches,Match,Num,Tport Set oShell = WScript.CreateObject(”WScript.Shell”) Set oExec = oShell.Exec(”netstat -an”) Set oregExp = new RegExp oregExp.Pattern = “TCP[\s]+[\d\.]+:”&Tport&”[\s]+[\d\.]+:[\d]+[\s]+ESTABLISHED” oregExp.IgnoreCase = True oregExp.Global = True Do While Not oExec.StdOut.AtEndOfStream strOut = strOut & oExec.StdOut.ReadLine() & Chr(13) & Chr(10) Loop Set Matches = oregExp.Execute(strOut) Num = 0 For Each Match In Matches Num = Num + 1 Next if num > 1 then Runs=true oShell.run “logoff” end if Set Matches = Nothing Set oregExp = Nothing Set oExec = Nothing Set oShell = Nothing wend
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论

返回顶部