networks.py 文件源码

python
阅读 38 收藏 0 点赞 0 评论 0

项目:darkc0de-old-stuff 作者: tuwid 项目源码 文件源码
def _getNetworksProcProto(self, proto) :
                if(proto == "tcp") :
            current_list = self.networks_proc.list_tcp
        elif(proto == "udp") :
            current_list = self.networks_proc.list_udp

        try :
            fichier = open("/proc/net/" + proto, "r")
        except IOError :
            print "No such file /proc/net/" + proto 
            sys.exit(-1)

        liste = fichier.readlines()
        fichier.close()

        liste.pop(0)

        for i in liste :
            l = string.split(i)
            if(proto == "tcp") :
                current_list.append([self._iphexatodec(l[1]), self._iphexatodec(l[2]), self.tranlateState[l[3]]])
            elif(proto == "udp") :
                current_list.append([self._iphexatodec(l[1]), self._iphexatodec(l[2]), None])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号