Ejemplo n.º 1
0
	def response_alert(self, data):
		""" ALERT received from kismet """
		alert = kismet.parse(kismet.ALERT, data)
		gui.unlock()
		# better write it to statusbar
		log.write('Alert: ' + alert['text'])
		log.write_status('Alert: ' + alert['text'])
		gui.lock()
Ejemplo n.º 2
0
	def response_card(self, data):
		""" Current wireless CARD information """
		global card
		card = kismet.parse(kismet.CARD, data)
		gui.unlock()
		log.write_status('Received %s packets on channel %s (%s)' % (card['packets'],
				card['channel'], card['hopping'] == '1' and 'hopping' or 'locked'))
		gui.lock()
Ejemplo n.º 3
0
	def loop(self):
		""" Go into a loop and read from kismet """
		global pattern
		while self.run_flag:
			try:
				match = pattern.match(self.readline())
				result = self.functions[match.group(1)](match.group(2))
			except EOFError:
				break
			except Exception, e:
				print type(e), e
				gui.unlock()
				log.error('Socket error')
				gui.lock()
				break
Ejemplo n.º 4
0
	def __init__(self):
		self.functions = {
			'KISMET': self.response_kismet,
			'NETWORK': self.response_network,
			'ALERT': self.response_alert,
			'REMOVE': self.response_remove,
			'CARD': self.response_card,
			'ERROR': self.response_error,
			## Unimplemented yet/uninteresting
			'PROTOCOLS': self.response_noop,
			'CLIENT': self.response_noop,
			'STATUS': self.response_noop,
			'TIME': self.response_noop,
			'GPS': self.response_noop,
			'INFO': self.response_noop
		}
		
		self.run_flag = True
		# Check if we need to spawn kismet server
		if config.ExecuteKismet and sys.platform != 'win32':
			self.process = subprocess.Popen('kismet_server')
			# exit critical region first
			gui.lock()
			time.sleep(5)
			gui.unlock()
			# TODO: add progress bar
		else:
			self.process = None
			
		log.write('Started kismet server')
		# connect to server
		self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
		self.socket.connect(('localhost', 2501))
		self.sockfile = self.socket.makefile("rw")
		log.write('Connected to kismet server')
		self.command_initialize()		
		log.write_status('Connected to kismet instance')
Ejemplo n.º 5
0
	def response_network(self, data):
		""" NETWORK information from kismet """
		gui.unlock()
		gui.window.add_network(kismet.parse(kismet.NETWORK, data))
		gui.lock()