import os,string
m=[]
n={}
s=os.popen('netstat -n')
for i in s.readlines():
l=string.split(i)
if len(l)>6:
pass
elif len(l)<6:
pass
else:
m.append(l[4])
for elen in m:
if m.count(elen)==1:
pass
else:
n[elen]=(m.count(elen))
t=sorted(n.items(),key=lambda d: d[1],reverse=True)
#for i,k in t:
# print i,k
for i in t:
print i[0],i[1]
阅读(1424) | 评论(0) | 转发(0) |