def _craft_packet(sender, receiver, bssid): """ Return a list with disassociation packet followed by a deauthentication packet :param sender: The MAC address of the sender :param receiver: The MAC address of the receiver :param bssid: The MAC address of the AccessPoint :type sender: str :type receiver: str :type bssid: str :return: list :rtype: A list with disassociation followed by deauthentication packet """ # craft disassociation packet disassoc_part = dot11.Dot11( type=0, subtype=10, addr1=receiver, addr2=sender, addr3=bssid) disassoc_packet = ( dot11.RadioTap() / disassoc_part / dot11.Dot11Disas()) # craft deauthentication packet deauth_part = dot11.Dot11( type=0, subtype=12, addr1=receiver, addr2=sender, addr3=bssid) deauth_packet = (dot11.RadioTap() / deauth_part / dot11.Dot11Deauth()) return [disassoc_packet, deauth_packet]
def _craft_packet(sender, receiver, bssid): """ Craft a deauthentication and a disassociation packet and add them to the list of deauthentication packets :param self: A Deauthentication object :param sender: The MAC address of the sender :param receiver: The MAC address of the receiver :param bssid: The MAC address of the AccessPoint :type self: Deauthentication :type sender: string :type receiver: string :type bssid: string :return: None :rtype: None """ deauth_packet = (dot11.RadioTap() / dot11.Dot11( type=0, subtype=12, addr1=receiver, addr2=sender, addr3=bssid) / dot11.Dot11Deauth()) disassoc_packet = (dot11.RadioTap() / dot11.Dot11( type=0, subtype=10, addr1=receiver, addr2=sender, addr3=bssid) / dot11.Dot11Disas()) return [disassoc_packet, deauth_packet]
def _craft_and_add_packet(self, sender, receiver): """ Craft a deauthentication and a disassociation packet and add them to the list of deauthentication packets :param self: A Deauthentication object :param sender: The MAC address of the sender :param receiver: The MAC address of the receiver :type self: Deauthentication :type sender: string :type receiver: string :return: None :rtype: None """ deauth_packet = (dot11.RadioTap() / dot11.Dot11(type=0, subtype=12, \ addr1=receiver, addr2=sender, addr3=self._ap_bssid) \ / dot11.Dot11Deauth()) disassoc_packet = (dot11.RadioTap() / dot11.Dot11(type=0, subtype=10, \ addr1=receiver, addr2=sender, addr3=self._ap_bssid) \ / dot11.Dot11Disas()) self._deauthentication_packets.append(disassoc_packet) self._deauthentication_packets.append(deauth_packet)
def test_is_packet_valid_packet_not_beacon(): """ Test is_packet_valid function with an packet that is not Dot11Beacon """ address = "FF:FF:FF:FF:FF:FF" packet = (dot11.RadioTap() / dot11.Dot11(type=0, subtype=10, addr3=address) / dot11.Dot11Disas()) assert recon.is_packet_valid(packet) == False