def worker(): while True: if Systemd.running('kismet'): try: address = ('127.0.0.1', 2501) kismet = KismetClient(address) kismet.register_handler('SSID', handle_ssid_data) kismet.register_handler('BSSID', handle_bssid_data) # kismet.register_handler('CLIENT', handlers.print_fields) while True: try: kismet.listen() except IntegrityError: pass except Exception as e: # only display error if service is running app.logger.error(traceback.format_exc()) eventlet.sleep(1)
""" This is a trivial example of how to use kismetclient in an application. """ from kismetclient import Client as KismetClient from kismetclient import handlers from pprint import pprint import logging log = logging.getLogger('kismetclient') log.addHandler(logging.StreamHandler()) log.setLevel(logging.DEBUG) address = ('127.0.0.1', 2501) k = KismetClient(address) k.register_handler('TRACKINFO', handlers.print_fields) def handle_ssid(client, ssid, mac): print 'ssid spotted: "%s" with mac %s' % (ssid, mac) k.register_handler('SSID', handle_ssid) try: while True: k.listen() except KeyboardInterrupt: pprint(k.protocols) log.info('Exiting...')
SW1 = 16 SW2 = 26 SW3 = 20 SW4 = 21 GPIO.setmode(GPIO.BCM) GPIO.setup(SW1, GPIO.IN) GPIO.setup(SW2, GPIO.IN) GPIO.setup(SW3, GPIO.IN) GPIO.setup(SW4, GPIO.IN) kismet_stat = gpsd_stat = 0 total = wpa = wep = none = wps = 0 aps = [] k = Client() # Check EPD_SIZE is defined EPD_SIZE = 0.0 if os.path.exists('/etc/default/epd-fuse'): exec(open('/etc/default/epd-fuse').read()) if EPD_SIZE == 0.0: print("Please select your screen size by running 'papirus-config'.") sys.exit() def count_crypts(client, name, macaddr, cryptstring): global aps, total, wpa, wep, none, wps pairing = (name, macaddr) if pairing not in aps: aps.append(pairing)
import json import requests import random log = logging.getLogger('kismetclient') log.addHandler(logging.StreamHandler()) log.setLevel(logging.DEBUG) endpoint_AP = "http://54.83.8.108:8080/AP/" endpoint_BT = "http://54.83.8.108:8080/BT/" headers = {'Content-type': 'application/json', 'Accept': 'text/plain'} maxentries = 0 address = ('127.0.0.1', 2501) k = KismetClient(address) k.register_handler('TRACKINFO', handlers.print_fields) def handle_ssid(client, ssid, mac): global maxentries maxentries = maxentries + 1 print 'bssid spotted: "%s" with mac %s' % (ssid, mac) lon = "-122.404" + str(random.randint(100, 999)) lat = "37.771" + str(random.randint(100, 999)) data = { "name": ssid, "LON": lon, "LAT": lat,
import json import requests import random log = logging.getLogger('kismetclient') log.addHandler(logging.StreamHandler()) log.setLevel(logging.DEBUG) endpoint_AP = "http://54.83.8.108:8080/AP/" endpoint_BT = "http://54.83.8.108:8080/BT/" headers = {'Content-type': 'application/json', 'Accept': 'text/plain'} maxentries = 0 address = ('127.0.0.1', 2501) k = KismetClient(address) k.register_handler('TRACKINFO', handlers.print_fields) def handle_ssid(client, ssid, mac): global maxentries maxentries=maxentries+1 print 'bssid spotted: "%s" with mac %s' % (ssid, mac) lon="-122.404" + str(random.randint(100,999)) lat="37.771" + str(random.randint(100,999)) data = {"name": ssid, "LON": lon, "LAT": lat, "essid": ssid, "type": "101"} #data to be send to the server print data if maxentries<90:
#!/usr/bin/env python from kismetclient import Client as KismetClient from kismetclient import handlers from pprint import pprint import logging log = logging.getLogger('kismetclient') log.addHandler(logging.StreamHandler()) log.setLevel(logging.DEBUG) address = ('127.0.0.1', 2501) k = KismetClient(address) def handle_BTBBDEV(client, lap, bdaddr): print 'bdaddr: %s - lap: %s' % (bdaddr, lap) k.register_handler('BTBBDEV', handle_BTBBDEV) try: while True: k.listen() except KeyboardInterrupt: pprint(k.protocols) log.info('Exiting...')
from kismetclient import Client as KismetClient # Connect to the Kismet server. address = ('127.0.0.1', 2501) k = KismetClient(address) # Sets are nice because they only keep unique data. try: from sets import Set clients = Set() except ImportError: # In python3 you don't have to explicitly import Sets clients = set() def handle_client(client, **fields): # 0: Access Point, 1: Ad-Hoc, 2: Probe request, 3: Turbocell, 4: Data if int(fields['type']) in (0, 1): return None global clients l = len(clients) clients.add(fields['mac']) if l != len(clients): print ('-' * 80) print('New device detected:') for k, v in fields.items(): print('%s: %s' % (k, v)) k.register_handler('CLIENT', handle_client) try: print('Logging wireless network clients.') while True:
#!/usr/bin/env python """ This is a trivial example of how to use kismetclient in an application. """ from kismetclient import Client as KismetClient from kismetclient import handlers from pprint import pprint import logging log = logging.getLogger('kismetclient') log.addHandler(logging.StreamHandler()) log.setLevel(logging.DEBUG) address = ('127.0.0.1', 2501) k = KismetClient(address) k.register_handler('TRACKINFO', handlers.print_fields) def handle_ssid(client, ssid, mac): print 'ssid spotted: "%s" with mac %s' % (ssid, mac) k.register_handler('SSID', handle_ssid) try: while True: k.listen() except KeyboardInterrupt: pprint(k.protocols) log.info('Exiting...')
HOLD_TIME = 3.0 REFRESH_TIME = 5.0 display = KismetDisplay() lcd = display.lcd prevCol = -1 prev = -1 lastTime = time.time() def shutdown(): lcd.clear() exit(0) total = wpa = wep = none = wps = 0 aps = [] k = Client() def count_crypts(client, name, macaddr, cryptstring): global aps, total, wpa, wep, none, wps pairing = (name, macaddr) if pairing not in aps: aps.append(pairing) if 'None' in cryptstring: none += 1 elif 'WPA' in cryptstring: wpa += 1 elif 'WEP' in cryptstring: wep += 1 elif 'WPS' in cryptstring: wpa += 1 wps += 1
""" This is a trivial example of how to use kismetclient in an application. """ from kismetclient import Client as KismetClient from kismetclient import handlers import httplib2 from pprint import pprint import logging log = logging.getLogger('kismetclient') log.addHandler(logging.StreamHandler()) # log.setLevel(logging.DEBUG) address = ('127.0.0.1', 2501) k = KismetClient(address) #k.register_handler('TRACKINFO', handlers.print_fields) def handle_ssid(client, ssid, mac, type): type_human = "unknown" if type == "0": type_human = 'ap' if type == "2": type_human = 'ap_probe' send_data('network/' + ssid + '/' + mac + '/' + type_human ) def handle_client(client, bssid, mac): send_data('client/' + mac + '/' + bssid) def send_data(url):