- 在线时间
- 0 小时
- 最后登录
- 2007-9-23
- 注册时间
- 2004-9-10
- 听众数
- 3
- 收听数
- 0
- 能力
- 0 分
- 体力
- 9975 点
- 威望
- 7 点
- 阅读权限
- 150
- 积分
- 4048
- 相册
- 0
- 日志
- 0
- 记录
- 0
- 帖子
- 1893
- 主题
- 823
- 精华
- 2
- 分享
- 0
- 好友
- 0

我的地盘我做主
该用户从未签到
 |
< >作者:zzzevazzz 来自:http://www.ph4nt0m.org</P> ~ u3 g8 X# z5 _& J4 T
< >XP和2003下的netstat有-o选项,所以可以容易地实现fport。
* s9 t; j. U. l8 \' \
+ U1 {1 t+ X8 z% x8 pvbs脚本版:4 b* M' z' T" ^6 B
Codz: 4 D) s3 {: U9 Y- m2 s8 A
0 d0 `& v- h1 i8 W3 b: ?9 `
with new regexp 6 h( Q# x4 b# V Y) B2 ], V, l
.pattern="(..Ps+S+s+S+s+[A-Z]*)s*([0-9]+)"
1 @% W6 `/ q1 X. y) k .global=true 8 }. Z6 G, ?% I" s6 H. @% T* F
set ms=.execute(createobject("wscript.shell").exec("netstat -ano").stdout.readall)
8 `6 v+ @! l% F7 e6 R2 A" Oend with : h5 ~( B4 V- ]& R# D1 }. {
for each ps in getobject("winmgmts:\.\rootcimv2:win32_process").instances_
) s* A$ U# M' q" P1 @/ p% R f=0 4 R9 [% l/ Z5 x% r- V7 _; I
for each m in ms
7 v# I" u+ M1 j+ D0 F# q9 Z2 ~( P if m.submatches(1)=ps.handle then ' N, q" s: C4 L/ V3 j' S
if f=0 then f=1:wscript.echo ">"&ps.handle&vbtab&ps.name&vbtab&ps.executablepath
6 [6 [$ p4 v. s0 I, M4 p0 O4 H6 m wscript.echo " "&m.submatches(0)
$ `+ ]% {) U, w8 z! V- x7 y end if % w g ^8 b3 p2 {: ]
next
8 T% o. f/ t$ i# ^) y- I" Onext
% l# ]1 ^- }) V( a, l3 A' A( w" A: S. g1 s( W% P5 F
, V2 J2 O, l( h- ?% j照例给出echo版,方便在远程shell中使用。0 u# O: u C4 V f# f# Z7 Z0 h
@echo with new regexp:.pattern="(..P\s+\S+\s+\S+\s+[A-Z]*)\s*([0-9]+)":.global=true>fp.vbs; K$ J2 K8 N; y% [2 k: [ l( Q
@echo set ms=.execute(createobject("wscript.shell").exec("netstat -ano").stdout.readall)>>fp.vbs
0 p9 h$ v' }4 f+ M4 c( J+ s@echo end with:for each ps in getobject("winmgmts:\\.\root\cimv2:win32_process").instances_>>fp.vbs
: ]7 }9 y3 Q9 I% l s& r4 G* z@echo f=0:for each m in ms:if m.submatches(1)=ps.handle then _>>fp.vbs" U- i \+ Q+ X7 `
@echo if f=0 then f=1:wscript.echo ">"^&ps.handle^&vbtab^&ps.name^&vbtab^&ps.executablepath:end if:_>>fp.vbs
: ?9 }2 h' Z# J e: ?1 q@echo wscript.echo " "^&m.submatches(0):end if:next:next>>fp.vbs
3 t' P! M1 g) Y) K( T. `$ N@cscript //nologo fp.vbs&del fp.vbs</P> |
zan
|