fport.vbs for XP/2003

博客涉及shell脚本相关内容,虽未给出具体内容,但标签显示与shell脚本有关,可能会围绕shell脚本在xp系统中的使用等信息技术方面展开。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本文作者:eva
文章出处:未知
文章性质:转载
阅读次数:16
发布日期:2004-11-04
 
fport.vbs for XP/2003
XP和2003下的netstat有-o选项,所以可以容易地实现fport。

vbs脚本版:
Codz:
with new regexp
    .pattern="(..Ps+S+s+S+s+[A-Z]*)s*([0-9]+)"
    .global=true
    set ms=.execute(createobject("wscript.shell").exec("netstat -ano").stdout.readall)
end with
for each ps in getobject("winmgmts:/./rootcimv2:win32_process").instances_
    f=0
    for each m in ms
        if m.submatches(1)=ps.handle then
            if f=0 then f=1:wscript.echo ">"&ps.handle&vbtab&ps.name&vbtab&ps.executablepath
            wscript.echo " "&m.submatches(0)
        end if
    next
next



照例给出echo版,方便在远程shell中使用。
@echo with new regexp:.pattern="(..P/s+/S+/s+/S+/s+[A-Z]*)/s*([0-9]+)":.global=true>fp.vbs
@echo set ms=.execute(createobject("wscript.shell").exec("netstat -ano").stdout.readall)>>fp.vbs
@echo end with:for each ps in getobject("winmgmts:/./root/cimv2:win32_process").instances_>>fp.vbs
@echo f=0:for each m in ms:if m.submatches(1)=ps.handle then _>>fp.vbs
@echo if f=0 then f=1:wscript.echo ">"^&ps.handle^&vbtab^&ps.name^&vbtab^&ps.executablepath:end if:_>>fp.vbs
@echo wscript.echo " "^&m.submatches(0):end if:next:next>>fp.vbs
@cscript //nologo fp.vbs&del fp.vbs
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值