Exemple #1
0
    def onItemSelected(self, event):
        """"""
	AA = netstatus.netstat()
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
	s.connect(("8.8.8.8",80))
	ip = (s.getsockname()[0])
	s.close()

	list_split= []
        currentItem = event.m_itemIndex
	for i in  self.cur_view[currentItem]:
		list_split.append(i)
        if ip ==  list_split[4].lstrip('dst='):
		ipa = list_split[3].lstrip('scr=')
        else:
		ipa = list_split[4].lstrip('dst=')
	for tcp_id,details1 in AA.iteritems():
		 if ipa  in details1:
			 dd =  details1[4]
                         dd1 = details1[5]
			 break
		 else:
		    	 dd = "Unkonwn"
	try:  
		ipaa = socket.gethostbyaddr(ipa)
		ipaa = ipaa[0]
	except:
		ipaa = 'Unknown'
      
        self.host11.SetLabel(ipaa)		 
        self.host1.SetLabel(dd)	
        self.host2.SetLabel(dd1)	 
    def onitemselected(self, event):
        """mouse click on rows"""
        my_netstat = netstatus.netstat()
        list_split = []
        currentitem = event.m_itemIndex
        for i in self.cur_view[currentitem]:
            list_split.append(i)
        if self.myhost == list_split[4].lstrip("dst="):
            my_ip = list_split[3].lstrip("scr=")
        else:
            my_ip = list_split[4].lstrip("dst=")
        for tcp_id, details1 in my_netstat.iteritems():
            if my_ip in details1:
                if details1[4] and details1[5]:
                    nameofprogram = details1[4]
                    pid = details1[5]
                else:
                    nameofprogram = "Unknown"
                    pid = "Unknown"
                break
            else:
                nameofprogram = "Unknown"
        try:
            my_host = socket.gethostbyaddr(my_ip)
            my_host = my_host[0]
        except:
            my_host = "Unknown"

        self.host11.SetLabel(my_host)
        self.host1.SetLabel(nameofprogram)
        self.host2.SetLabel(pid)
Exemple #3
0
    def onItemSelected(self, event):
        """"""
        AA = netstatus.netstat()
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.connect(("8.8.8.8", 80))
        ip = (s.getsockname()[0])
        s.close()

        list_split = []
        currentItem = event.m_itemIndex
        for i in self.cur_view[currentItem]:
            list_split.append(i)
        if ip == list_split[4].lstrip('dst='):
            ipa = list_split[3].lstrip('scr=')
        else:
            ipa = list_split[4].lstrip('dst=')
        for tcp_id, details1 in AA.iteritems():
            if ipa in details1:
                dd = details1[4]
                dd1 = details1[5]
                break
            else:
                dd = "Unkonwn"
        try:
            ipaa = socket.gethostbyaddr(ipa)
            ipaa = ipaa[0]
        except:
            ipaa = 'Unknown'

        self.host11.SetLabel(ipaa)
        self.host1.SetLabel(dd)
        self.host2.SetLabel(dd1)