文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>获得相应端口的IP

获得相应端口的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()
相关阅读 更多 +
排行榜 更多 +
找茬脑洞的世界安卓版

找茬脑洞的世界安卓版

休闲益智 下载
滑板英雄跑酷2手游

滑板英雄跑酷2手游

休闲益智 下载
披萨对对看下载

披萨对对看下载

休闲益智 下载