Beispiel #1
0
                stdout=PIPE,
                stderr=PIPE)
threading.Thread(target=print_data).start()

for row in iter(process.stdout.readline, b''):
    groups = re.search(
        "Mb\/s (\d+) .* (-\d+)dBm signal .* SA:(\w{2}:\w{2}:\w{2}:\w{2}:\w{2}:\w{2}) .* Probe Request .(\w+\s?\w+).",
        row.strip())
    if groups != None:
        signal = signal_power(int(groups.group(2)))
        if not groups.group(4) in registered:
            registered[groups.group(4)] = []
        if not groups.group(3) in registered[groups.group(4)]:
            registered[groups.group(4)].append(groups.group(3))
            company = check_vendor(groups.group(3))
            wigle = Wigle.wigle_location(groups.group(4), wigle_flag)
            if wigle == 1:
                wigle_flag = True
            if wigle is 2 and not wigle_flag:
                loc = '-'
            elif wigle is None and not wigle_flag:
                loc = '?+'
            elif wigle_flag:
                loc = 'Disabled'
            else:
                loc = str(wigle['trilat']) + ', ' + str(wigle['trilong'])

            data.append([
                groups.group(1), signal,
                groups.group(3),
                groups.group(4), company, loc
    if groups != None:
        signal = signal_power(int(groups.group(2)))
        mac = groups.group(3)
        ssid = groups.group(4)
        company = check_vendor(mac)

        if args.debug:
            print("Hits from " + mac + " (" + company + ") for " + ssid)

        if not ssid in registered and not ssid in registeredSSID:
            registered[ssid] = []
            registered[ssid].append(mac)
            if args.debug:
                print("Looking for {}".format(ssid))
            wigle = Wigle.wigle_location(ssid, wigle_flag)
            adr = "~"
            if wigle is 1:
                loc = "API returned error"
                print("API returned error")
            elif wigle is 2 and not wigle_flag:
                loc = '-'
            elif wigle is 3 and not wigle_flag:
                loc = 'API limit reached - Loc faked'
                adr = OSM.OSM_location("53.7581", "-1.6363")
            elif wigle is None and not wigle_flag:
                loc = 'API call failed (nothing returned)'
            elif wigle_flag:
                loc = 'Wigle API Disabled'
            else:
                loc = str(wigle['trilat']) + ', ' + str(wigle['trilong'])