码迷,mamicode.com
首页 > 其他好文 > 详细

监视系统3389的VBS脚本

时间:2015-03-07 13:48:00      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:

Title: 监视系统3389的VBS脚本 --2010-10-27 19:56

从网上找的,不知道是不是NP写的那个

-----------------------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------------------

用法

cscript.exe ?.vbs 3389

//用时候还注意当前的系统环境

监视系统3389的VBS脚本

标签:

原文地址:http://www.cnblogs.com/TeaIng-Index/p/4320117.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!