Example #1
0
def handler(packet):
	"""
		Handler for probe requests.
	"""
	rssi = get_rssi(packet[0].notdecoded);

	if packet[0].addr2 in confg.CLS:
		confg.CLS[packet[0].addr2].mrssi = rssi;
	else:
		confg.CLS[packet[0].addr2] = Client(packet[0].addr2, '', rssi);

	confg.CLS[packet[0].addr2].mnoise += 1;
	return;
Example #2
0
def handler_probereq(packet):
    """
		Handler for probe requests.
	"""
    rssi = get_rssi(packet.notdecoded)

    if confg.CLS.has_key(packet.addr2):
        confg.CLS[packet.addr2].msig = rssi
        confg.CLS[packet.addr2].mnoise += 1

    elif misc.check_valid(packet.addr2):
        confg.CLS[packet.addr2] = Client(packet.addr2, '', rssi)
        confg.CLS[packet.addr2].mnoise += 1

        if confg.MyGui != "":
            confg.MyGui.add_client(confg.CLS[packet.addr2])

    return
Example #3
0
def handler_data(packet):
    """
		handler for data type frames
	"""
    a1 = packet.addr1
    a2 = packet.addr2

    rssi = get_rssi(packet.notdecoded)

    if a1 in confg.APS:
        if confg.CLS.has_key(a2):
            if confg.CLS[a2].mbssid != a1:
                confg.CLS[a2].update_network(a1)

            confg.CLS[a2].mnoise += 1
            confg.CLS[a2].msig = rssi

        elif misc.check_valid(a2):
            confg.CLS[a2] = Client(a2, a1, rssi)
            confg.CLS[a2].mnoise += 1
            if confg.MyGui != "":
                confg.MyGui.add_client(confg.CLS[a2])

    elif a2 in confg.APS:
        if confg.CLS.has_key(a1):
            if confg.CLS[a1].mbssid != a2:
                confg.CLS[a1].update_network(a2)

            confg.CLS[a1].mnoise += 1
            confg.CLS[a1].msig = rssi

        elif misc.check_valid(a1):
            confg.CLS[a1] = Client(a1, a2, rssi)
            confg.CLS[a1].mnoise += 1
            if confg.MyGui != "":
                confg.MyGui.add_client(confg.CLS[a1])

    return
Example #4
0
def handler_beacon(packet):
    """
		Handler for Beacon Frames.
	"""
    source = packet.addr2

    if source in confg.APS:
        confg.APS[source].msig = get_rssi(packet.notdecoded)
        confg.APS[source].mbeacons += 1

    else:
        destination = packet.addr1
        mac = packet.addr3
        confg.HANDSHAKES[mac] = []

        if u'\x00' in "".join(
            [x if ord(x) < 128 else ""
             for x in packet[0].info]) or not packet[0].info:
            confg.HIDDEN.append(mac)
            name = "<len: " + str(len(packet.info)) + ">"
        else:
            name = "".join([x if ord(x) < 128 else "" for x in packet[0].info])

        rssi = get_rssi(packet.notdecoded)

        p = packet[Dot11Elt]
        cap = packet.sprintf(
            "{Dot11Beacon:%Dot11Beacon.cap%}"
            "{Dot11ProbeResp:%Dot11ProbeResp.cap%}").split('+')

        sec = set()
        channel = "-"
        while isinstance(p, Dot11Elt):
            if p.ID == 3:
                try:
                    channel = ord(p.info)
                except:
                    pass
            elif p.ID == 48:
                sec.add('WPA2')
            elif p.ID == 61:
                if channel == "-":
                    channel = ord(p.info[-int(p.len):-int(p.len) + 1])
            elif p.ID == 221 and p.info.startswith('\x00P\xf2\x01\x01\x00'):
                if "WPA2" in sec:
                    pass
                else:
                    sec.add('WPA')
            p = p.payload

        if not sec:
            if 'privacy' in cap:
                sec.add('WEP')
            else:
                sec.add("OPEN")

        if '0050f204104a000110104400010210' in str(packet).encode('hex'):
            sec.add('WPS')

        try:
            oui = ((EUI(mac)).oui).registration().org
        except:
            oui = "UNKNOWN"

        confg.APS[source] = Access_Point(name, ':'.join(sec), channel, mac,
                                         unicode(oui), rssi)
        if confg.MyGui != "":
            confg.MyGui.add_wifi(confg.APS[source])
    return