def getlinux():
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=string.split(l[4],':')
if len(m)<2:
pass
#else:
elif string.atoi(m[-1])>100 and string.atoi(m[-1])<7000:
print m[-1],m[-2]
def getwin():
s=os.popen('netstat -n')
for i in s.readlines():
l=string.split(i)
if len(l)<4:
pass
elif len(l)>4:
pass
else:
m=string.split(l[4],':')
if len(m)<2:
pass
elif string.atof(m[1])>100 and string.atof(m[1])<7000:
print m[1]
import os,string,re
#print "iiii"
if __name__=='__main__':
if os.name=='posix':
getlinux()
elif os.name=='nt':
getwin()
阅读(1375) | 评论(0) | 转发(0) |