예제 #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)
    def decode(self, aBuffer):
        d = dot11.Dot11(aBuffer, self.__FCS_at_end)
        self.set_decoded_protocol(d)

        self.subtype = d.get_subtype()
        if self.subtype is dot11.Dot11Types.DOT11_SUBTYPE_CONTROL_CLEAR_TO_SEND:
            self.ctrl_cts_decoder = Dot11ControlFrameCTSDecoder()
            packet = self.ctrl_cts_decoder.decode(d.body_string)
        elif self.subtype is dot11.Dot11Types.DOT11_SUBTYPE_CONTROL_ACKNOWLEDGMENT:
            self.ctrl_ack_decoder = Dot11ControlFrameACKDecoder()
            packet = self.ctrl_ack_decoder.decode(d.body_string)
        elif self.subtype is dot11.Dot11Types.DOT11_SUBTYPE_CONTROL_REQUEST_TO_SEND:
            self.ctrl_rts_decoder = Dot11ControlFrameRTSDecoder()
            packet = self.ctrl_rts_decoder.decode(d.body_string)
        elif self.subtype is dot11.Dot11Types.DOT11_SUBTYPE_CONTROL_POWERSAVE_POLL:
            self.ctrl_pspoll_decoder = Dot11ControlFramePSPollDecoder()
            packet = self.ctrl_pspoll_decoder.decode(d.body_string)
        elif self.subtype is dot11.Dot11Types.DOT11_SUBTYPE_CONTROL_CF_END:
            self.ctrl_cfend_decoder = Dot11ControlFrameCFEndDecoder()
            packet = self.ctrl_cfend_decoder.decode(d.body_string)
        elif self.subtype is dot11.Dot11Types.DOT11_SUBTYPE_CONTROL_CF_END_CF_ACK:
            self.ctrl_cfendcfack_decoder = Dot11ControlFrameCFEndCFACKDecoder()
            packet = self.ctrl_cfendcfack_decoder.decode(d.body_string)
        else:
            data_decoder = DataDecoder()
            packet = data_decoder.decode(d.body_string)

        d.contains(packet)
        return d
예제 #3
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 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)
예제 #5
0
파일: wpsig.py 프로젝트: 5l1v3r1/WPSIG
    def send_probe_req_2(self, src, ssid):
        """Return 802.11 Probe Request Frame."""
        # Frame Control
        frameControl = dot11.Dot11()
        frameControl.set_version(0)
        frameControl.set_type_n_subtype(
            dot11.Dot11Types.DOT11_TYPE_MANAGEMENT_SUBTYPE_PROBE_REQUEST)
        # Frame Control Flags
        frameControl.set_fromDS(0)
        frameControl.set_toDS(0)
        frameControl.set_moreFrag(0)
        frameControl.set_retry(0)
        frameControl.set_powerManagement(0)
        frameControl.set_moreData(0)
        frameControl.set_protectedFrame(0)
        frameControl.set_order(0)
        # Management Frame
        sequence = random.randint(0, 4096)
        broadcast = [0xff, 0xff, 0xff, 0xff, 0xff, 0xff]
        mngtFrame = dot11.Dot11ManagementFrame()
        mngtFrame.set_duration(0)
        mngtFrame.set_destination_address(broadcast)
        mngtFrame.set_source_address(src)
        mngtFrame.set_bssid(broadcast)
        mngtFrame.set_fragment_number(0)
        mngtFrame.set_sequence_number(sequence)
        # Probe Request Frame
        probeRequestFrame = dot11.Dot11ManagementProbeRequest()
        probeRequestFrame.set_ssid(ssid)
        probeRequestFrame.set_supported_rates([0x02, 0x04, 0x0b, 0x16])
        # How is your daddy?
        mngtFrame.contains(probeRequestFrame)
        frameControl.contains(mngtFrame)
        # return frameControl.get_packet()

        # src = self.__getListFromAddress(self.args.source) if args.source is not None else self.__getListFromAddress(RandMAC())
        # probe = self.__getProbeRequest(src, ssid)
        return sendp(frameControl.get_packet(),
                     iface=self.args.interface,
                     verbose=0)
    def decode(self, aBuffer):
        d = dot11.Dot11(aBuffer, self.__FCS_at_end)
        self.set_decoded_protocol(d)

        type = d.get_type()
        if type == dot11.Dot11Types.DOT11_TYPE_CONTROL:
            dot11_control_decoder = Dot11ControlDecoder()
            packet = dot11_control_decoder.decode(d.body_string)
        elif type == dot11.Dot11Types.DOT11_TYPE_DATA:
            dot11_data_decoder = Dot11DataDecoder(self.key_manager)

            dot11_data_decoder.set_dot11_hdr(d)

            packet = dot11_data_decoder.decode(d.body_string)
        elif type == dot11.Dot11Types.DOT11_TYPE_MANAGEMENT:
            dot11_management_decoder = Dot11ManagementDecoder()
            dot11_management_decoder.set_subtype(d.get_subtype())
            packet = dot11_management_decoder.decode(d.body_string)
        else:
            data_decoder = DataDecoder()
            packet = data_decoder.decode(d.body_string)

        d.contains(packet)
        return d