Beispiel #1
0
    def process(self,  mac, frame):
        """
        It processes the received frame.
        """
        radio_tap = dot11.RadioTap(frame)
        buf = radio_tap.get_body_as_string()

        d11 = dot11.Dot11(buf)

        if d11.get_type() != dot11.Dot11Types.DOT11_TYPE_DATA:
            return 

        buf = d11.get_body_as_string()
        
        data = dot11.Dot11DataFrame(buf)
        data_str = data.get_body_as_string()
        
        wpa2 = dot11.Dot11WPA2(data_str)
        if wpa2.is_WPA2() == 1:
            self.add("WPA2", 0, 1)
        else:
            wap = dot11.Dot11WPA(data_str)
            if wap.is_WPA():
                self.add("WPA", 0, 1)
            else:
                wep = dot11.Dot11WEP(data_str)
                if wep.is_WEP():
                    self.add("WEP", 0, 1)
                else:
                    self.add("Open", 0, 1)
Beispiel #2
0
    def process(self,  mac, frame):
        """
        It processes the received frame.
        """
        radio_tap = dot11.RadioTap(frame)
        buf = radio_tap.get_body_as_string()

        d11 = dot11.Dot11(buf)
        if d11.get_type() != dot11.Dot11Types.DOT11_TYPE_MANAGEMENT:
            return
            
        if d11.get_subtype() != dot11.Dot11Types().DOT11_SUBTYPE_MANAGEMENT_BEACON:
            return

        buf = d11.get_body_as_string()
        mgt = dot11.Dot11ManagementFrame(buf)
        bssid = mgt.get_bssid()
        bssid_str = bssid.tostring()
        
        # Check if the access point was already counted.
        if self.bssids.has_key(bssid_str):
            return

        self.bssids[bssid_str] = ""

        channel = helpers.get_channel_from_frame(frame)
        if channel == -1:
            return
           
        self.add(channel, 0, 1)
    def decode(self, aBuffer):
        rt = dot11.RadioTap(aBuffer)
        self.set_decoded_protocol(rt)

        self.do11_decoder = Dot11Decoder()
        self.do11_decoder.set_key_manager(self.key_manager)
        flags = rt.get_flags()
        if flags is not None:
            fcs = flags & dot11.RadioTap.RTF_FLAGS.PROPERTY_FCS_AT_END
            self.do11_decoder.FCS_at_end(fcs)

        packet = self.do11_decoder.decode(rt.get_body_as_string())

        rt.contains(packet)
        return rt
Beispiel #4
0
def get_channel_from_frame(frame):
    """
    It returns the channel in which the frame was received.
    """
    rt = dot11.RadioTap(frame)
    channel_pair = rt.get_channel()
    if channel_pair == None:
        return -1

    freq = channel_pair[0]

    try:
        ch = dot11.frequency[freq]
    except KeyError:
        ch = -1
    return ch
    def process(self, mac, frame):
        """
        It processes the received frame.
        """
        radio_tap = dot11.RadioTap(frame)
        buf = radio_tap.get_body_as_string()
        d11 = dot11.Dot11(buf)

        if d11.get_type() != dot11.Dot11Types.DOT11_TYPE_DATA:
            return

        channel = helpers.get_channel_from_frame(frame)
        if channel == -1:
            return

        if not d11.is_QoS_frame():
            self.add(channel, 0, 1)
        else:
            self.add(channel, 1, 1)