注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 负载均衡技术沙龙问答汇集
 帮助

列出所有到本机80端口ESTABLISHED连接的小脚本


2008-04-12 16:06:59
 标签:网络 端口 本机   [推送到技术圈]

Dim oShell
Dim oExec
Dim strOut
Dim oRegExp
Dim Matches
Dim Match
Dim Num
Set oShell = WScript.CreateObject("WScript.Shell")
Set oExec = oShell.Exec("netstat -an")
Set oRegExp = new RegExp
oRegExp.Pattern = "TCP[\s]+[\d\.]+:80[\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
     WScript.Echo Match.Value
     Num = Num + 1
Next
WScript.Echo "合计:共" & Num & "个连接"
Set Matches = Nothing
Set oRegExp = Nothing
Set oExec = Nothing
Set oShell = Nothing
 


上一篇 查找文件  下一篇 Cygwin的使用方法



    文章评论
 
 

发表评论

昵   称:
验证码:  点击图片可刷新验证码  博客过2级,无需填写验证码
内   容: