获得相应端口的IP
时间:2008-11-27 来源:lengyuzlg
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()
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()
相关阅读 更多 +