Ejemplo n.º 1
0
    def main(self, parent, canvas, iface):
        self.parent = parent
        # assign  Wireless Interface
        self.iface = iface

        # Attempt to turn on the interface selected in case it has been down.
        try:
            os.system("sudo ifconfig %s up" % self.iface)
        except OSError:
            pass

        # Create the queue
        self.queue = Queue.Queue()

        # Set up Gui part
        self.list = ListResults(parent, canvas, self.queue)

        self.running = True
        # start a thread to run sniffer
        self.thread1 = threading.Thread(target=self.workerThread1)
        self.thread1.start()

        signal.signal(signal.SIGINT, self.stop_sniffer)
        # Start the periodic call in the GUI to check the queue
        self.periodicCall()
Ejemplo n.º 2
0
class ThreadSniffer(object):
    #def __init__(self, parent, iface,):
    def main(self, parent, canvas, iface):
        self.parent = parent
        # assign  Wireless Interface
        self.iface = iface

        # Attempt to turn on the interface selected in case it has been down.
        try:
            os.system("sudo ifconfig %s up" % self.iface)
        except OSError:
            pass

        # Create the queue
        self.queue = Queue.Queue()

        # Set up Gui part
        self.list = ListResults(parent, canvas, self.queue)

        self.running = True
        # start a thread to run sniffer
        self.thread1 = threading.Thread(target=self.workerThread1)
        self.thread1.start()

        signal.signal(signal.SIGINT, self.stop_sniffer)
        # Start the periodic call in the GUI to check the queue
        self.periodicCall()

    def periodicCall(self):
        """ Check every 200 ms if there is something new in the queue. """
        self.parent.after(200, self.periodicCall)
        self.list.processIncoming()
        if not self.running:
            try:
                self.thread1.join()
            except e:
                print e

    def workerThread1(self):
        while self.running:
            scan = Sniffer(self.queue, self.iface)

    def endApplication(self):
        self.running = False
        self.thread1.join()
        t = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
        print "Sniffer stopped at: %s" % t

    def stop_sniffer(self, signal, frame):
        self.endApplication()
Ejemplo n.º 3
0
class ThreadSniffer(object):
	#def __init__(self, parent, iface,):
	def main(self, parent, canvas, iface):
		self.parent = parent
		# assign  Wireless Interface
		self.iface = iface
		
		# Attempt to turn on the interface selected in case it has been down.
		try:
			os.system("sudo ifconfig %s up" % self.iface)
		except OSError:
			pass
			
		# Create the queue
		self.queue = Queue.Queue()
		
		# Set up Gui part
		self.list = ListResults(parent, canvas, self.queue)
		
		self.running = True
		# start a thread to run sniffer
		self.thread1 = threading.Thread(target=self.workerThread1)
		self.thread1.start()
		
		signal.signal(signal.SIGINT, self.stop_sniffer)
		# Start the periodic call in the GUI to check the queue
		self.periodicCall()
		
	def periodicCall(self):
		""" Check every 200 ms if there is something new in the queue. """
		self.parent.after(200, self.periodicCall)
		self.list.processIncoming()
		if not self.running:
			try:
			   	self.thread1.join()
			except e: print e
		
	def workerThread1(self):
		while self.running:
			scan = Sniffer(self.queue, self.iface)
		
	def endApplication(self):
		self.running = False
		self.thread1.join()
		t = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
		print "Sniffer stopped at: %s" %t
		
	def stop_sniffer(self,signal, frame):
		self.endApplication()
Ejemplo n.º 4
0
	def main(self, parent, canvas, iface):
		self.parent = parent
		# assign  Wireless Interface
		self.iface = iface
		
		# Attempt to turn on the interface selected in case it has been down.
		try:
			os.system("sudo ifconfig %s up" % self.iface)
		except OSError:
			pass
			
		# Create the queue
		self.queue = Queue.Queue()
		
		# Set up Gui part
		self.list = ListResults(parent, canvas, self.queue)
		
		self.running = True
		# start a thread to run sniffer
		self.thread1 = threading.Thread(target=self.workerThread1)
		self.thread1.start()
		
		signal.signal(signal.SIGINT, self.stop_sniffer)
		# Start the periodic call in the GUI to check the queue
		self.periodicCall()