Q4-Deauth after auth request =========================================== .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow Topics in this section, * :ref:`Learnings in this section ` * :ref:`Version Info ` * :ref:`Problem Statement ` * :ref:`Approach and code flow ` * :ref:`Actual change and Patch ` * :ref:`Wireshark capture ` .. _wifi_ldd_wi-fi_dev_ap_ques4_step_1: .. tab-set:: .. tab-item:: Learnings in this section * In this section, you are going to learn .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * How to send de-authentication packet on reception of authentication request packet from STA .. _wifi_ldd_wi-fi_dev_ap_ques4_step_2: .. tab-set:: .. tab-item:: Version Info =============================== ======================================= # Version =============================== ======================================= Ubuntu Ubuntu 22.04 64 bit Linux Kernel 6.9.2 Hostapd hostapd 2.10 =============================== ======================================= .. _wifi_ldd_wi-fi_dev_ap_ques4_step_3: .. tab-set:: .. tab-item:: Problem Statement .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * Send de-authentication packet on reception of authentication request packet from STA * Add a configuration parameter called "deauth_on_auth_request_rx" in hostapd conf file * If "deauth_on_auth_request_rx=0", then this feature is disabled * If "deauth_on_auth_request_rx=1", then this feature is enabled .. _wifi_ldd_wi-fi_dev_ap_ques4_step_4: .. tab-set:: .. tab-item:: Approach and code flow * Call flow for send de-authentication packet on reception of authentication request packet from STA .. literalinclude:: send_deauth_after_auth_req_callflow.txt .. _wifi_ldd_wi-fi_dev_ap_ques4_step_5: .. tab-set:: .. tab-item:: Actual change and Patch * Download the below patch file :download:`send_deauth_after_auth_req.patch ` .. dropdown:: See the full content of patch file .. literalinclude:: send_deauth_after_auth_req.patch .. code-block:: shell test:~$ pwd /home/test * Make sure internet is available in laptop to download hostapd package .. code-block:: shell test:~$ sudo wget http://w1.fi/releases/hostapd-2.10.tar.gz * Create a directory .. code-block:: shell test:~$ mkdir hostapd * Change directory to hostapd .. code-block:: shell test:~$ cd hostapd * Note : Your present working directory should be hostapd .. code-block:: shell test:~$ pwd /home/test/hostapd/ * Extract hostapd .. code-block:: shell test:~$ sudo tar -xvf ~/hostapd-2.10.tar.gz patching file hostapd-2.10/hostapd/config_file.c patching file hostapd-2.10/src/ap/ap_config.h patching file hostapd-2.10/src/ap/ieee802_11.c * Run the below command to apply patch .. code-block:: shell test:~$ patch -p1 < send_deauth_after_auth_req.patch * Change directory to hostapd .. code-block:: shell test:~$ cd hostapd-2.10/hostapd/ * Check the current working directory using pwd command * Make sure your current working directory is hostapd .. code-block:: shell test:~$ pwd /home/test/hostapd/hostapd-2.10/hostapd/ * Copy the contents of defconfig file to .config file .. code-block:: shell test:~$ sudo cp defconfig .config * Compile hostapd .. code-block:: shell test:~$ sudo make * Create run_hostapd.conf .. code-block:: shell test:~$ sudo vim ./run_hostapd.conf ctrl_interface=/run/hostapd interface=wlan0 driver=nl80211 ssid=test_open hw_mode=g channel=6 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 deauth_on_auth_request_rx=1 * Run hostapd .. code-block:: shell test:~$ sudo ./hostapd ./run_hostapd.conf .. _wifi_ldd_wi-fi_dev_ap_ques4_step_6: .. tab-set:: .. tab-item:: Wireshark capture * Download file to check wireshark output :download:`deauth_after_auth_req.pcapng ` .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * Check for de-authentication packet * Check packet No.119 and 120 * Observe 119 is authentication request packet and 120 is deauthentication packet .. image:: deauth_after_auth_req.png :alt: Diagram :width: 800 :height: 400