def _getNetworksNetstatProto(self, proto) :
if(proto == "tcp") :
current_list = self.networks_netstat.list_tcp
argproto = "-t"
elif(proto == "udp") :
current_list = self.networks_netstat.list_udp
argproto = "-u"
i, o = os.popen2("/bin/netstat -an " + argproto)
j = o.readline()
j = o.readline()
j = o.readline()
while(j != ""):
liste = j.split()
if(proto == "tcp") :
current_list.append([liste[3], liste[4], liste[5]])
elif(proto == "udp") :
current_list.append([liste[3], liste[4], None])
j = o.readline()
o.close()
i.close()
评论列表
文章目录