def __init__(self, ap_bssid, jamming_interface):
        """
        Setup the class with all the given arguments.

        :param self: A Deauthentication object.
        :param ap_bssid: The MAC address of the selected access point.
        :param jamming_interface: The interface to be used for jamming.
        :type self: Deauthentication
        :type ap_bssid: string
        :type jamming_interface: string
        :return: None
        :rtype: None
        """

        self._observed_clients = list()
        self._deauthentication_packets = list()
        self._ap_bssid = ap_bssid
        self._should_continue = True
        self._jamming_interface = jamming_interface
        self._non_client_addresses = constants.NON_CLIENT_ADDRESSES

        # create a socket for sending packets
        self._socket = linux.L2Socket(iface=self._jamming_interface)

        # craft and add deauthentication packet to broadcast address
        self._craft_and_add_packet(self._ap_bssid, constants.WIFI_BROADCAST)
Exemple #2
0
    def _channel_hop(self):
        """
        Change the interface's channel every three seconds

        :param self: An AccessPointFinder object
        :type self: AccessPointFinder
        :return: None
        :rtype: None
        .. note: The channel range is between 1 to 13
        """

        # if the stop flag not set, change the channel
        while self._should_continue:
            for channel in self._channels_to_hop:
                if self._current_channel != channel:
                    self._current_channel = channel
                    # added this check to reduce shutdown time
                    if self._should_continue:
                        try:
                            self._socket.close()
                            self._nm.set_interface_channel(
                                self._interface, int(self._current_channel))
                            self._socket = linux.L2Socket(
                                iface=self._interface)
                            # extends the channel hopping time to sniff more frames
                            time.sleep(3)
                        except BaseException:
                            continue
                    else:
                        break
Exemple #3
0
    def set_interface(self, interface):
        """
        Sets interface for EM.

        :param interface: Interface name
        :type interface: String
        :return: None
        :rtype: None
        """

        self._interface = interface
        self._socket = linux.L2Socket(iface=self._interface)
Exemple #4
0
    def set_interface(self, interface):
        """
        Sets interface for EM.

        :param self: An ExtensionManager object
        :type self: ExtensionManager
        :param interface: Interface name
        :type interface: String
        :return: None
        :rtype: None
        """

        self._interface = interface
        self._socket = linux.L2Socket(iface=self._interface)