Exemplo n.º 1
0
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)
Exemplo n.º 2
0
"""
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...')
Exemplo n.º 3
0
            none += 1
        elif 'WPA' in cryptstring:
            wpa += 1
        elif 'WEP' in cryptstring:
            wep += 1
        elif 'WPS' in cryptstring:
            wpa += 1
            wps += 1
        elif cryptstring == '':
            none += 1
        total = len(aps)


address = ('127.0.0.1', 2501)
k = Client(address)
k.register_handler('TRACKINFO', count_crypts)


def runKismet():
    kismet = subprocess.Popen(['ps -ef | grep kismet'],
                              stdout=subprocess.PIPE,
                              shell=True)
    (output, error) = kismet.communicate()
    if 'kismet_server' in output:
        kismet_stat = "1"
    else:
        print("Kismet Daemon not running!")


def runGPSD():
    gps = subprocess.Popen(['ps -ef | grep gpsd'],
Exemplo n.º 4
0
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,
Exemplo n.º 5
0
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:
    	r = requests.post(endpoint_AP, data=json.dumps(data), headers=headers)
#!/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...')
Exemplo n.º 7
0
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:
        k.listen()
except KeyboardInterrupt:
    print('Clients:')
    for i, client in enumerate(clients, start=1):
        print('%d. MAC: %s' % (i, client))
    print('%d unique clients have been seen.' % len(clients))
Exemplo n.º 8
0
"""
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...')
Exemplo n.º 9
0
    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
        elif cryptstring == '':
            none += 1
        total = len(aps)

k.register_handler('DEVICE', count_crypts)

# Listen for button presses
while True:
    k.listen()
    display.update_screens(wpa,wep,wps,none,total)
    b = lcd.buttons()
    if b is not prev:
        if lcd.buttonPressed(lcd.SELECT):
            tt = time.time() # Start time of button press
            while lcd.buttonPressed(lcd.SELECT): # Wait for button release
                if (time.time() - tt) >= HOLD_TIME: # Extended hold?
                    shutdown() # We're outta here
            display.backlightStep()
        elif lcd.buttonPressed(lcd.LEFT):
                display.scrollRight()
Exemplo n.º 10
0
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):
    full_url = "http://www.hecko.net/" + url
    print "sending to url " + full_url
    resp, content = httplib2.Http().request(full_url)

k.register_handler('SSID', handle_ssid)
k.register_handler('CLIENT', handle_client)

try:
    while True:
        k.listen()
except KeyboardInterrupt:
    pprint(k.protocols)
    log.info('Exiting...')