发新话题
打印

[转载]fport.vbs for XP 2003

[转载]fport.vbs for XP 2003

文章作者:zzzevazzz
信息来源:http://www.ph4nt0m.org

XP和2003下的netstat有-o选项,所以可以容易地实现fport。

vbs脚本版:
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
qq310926是我唯一用号,除此之外有其他号码号自称邪八冰血封情,则非本人。

TOP

发新话题