Q3-Send-deauth

  • In this section, you are going to learn

  • How to send de-authentication packet once every 30 seconds

#

Version

Ubuntu

Ubuntu 22.04 64 bit

Linux Kernel

6.9.2

Hostapd

hostapd 2.10

  • Send De-Authentication packet once every 30 seconds

  • Call flow for send de-authentication packet once every 30 seconds

nl80211_global_init ()
  wpa_driver_nl80211_init_nl_global ()
     i802_init ()
	wpa_driver_nl80211_drv_init ()
	   nl80211_init_bss ()
	      wpa_driver_nl80211_set_ap ()
		 send_and_recv_msgs_connect_handle ()
		    process_global_event ()
		      do_process_drv_event ()
			 mlme_event ()
			   mlme_event_mgmt_tx_status ()
			     process_bss_event ()
			       mlme_event ()
				  mlme_event_mgmt ()
				    wpa_supplicant_event ()
				       hostapd_mgmt_tx_cb ()
					 ieee802_11_mgmt_cb ()
					    handle_assoc_cb ()
					       ap_sta_set_authorized ()
						  ap_send_deauth ()

  • Download the below patch file

send_deauth_pkt_every_30sec.patch

test:~$ pwd
/home/test
  • Make sure internet is available in laptop to download hostapd package

test:~$ sudo wget http://w1.fi/releases/hostapd-2.10.tar.gz
  • Create a directory

test:~$ mkdir hostapd
  • Change directory to hostapd

test:~$ cd hostapd
  • Note : Your present working directory should be hostapd

test:~$ pwd
/home/test/hostapd/
  • Extract hostapd

test:~$ sudo tar -xvf ~/hostapd-2.10.tar.gz
  • Run the below command to apply patch

test:~$ patch -p1 < send_deauth_pkt_every_30sec.patch
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
patching file hostapd-2.10/src/ap/sta_info.c
patching file hostapd-2.10/src/utils/os.h
patching file hostapd-2.10/src/utils/os_unix.c
  • Change directory to hostapd

test:~$ cd hostapd-2.10/hostapd/
  • Check the current working directory using pwd command

  • Make sure your current working directory is hostapd

test:~$ pwd
/home/test/hostapd/hostapd-2.10/hostapd/
  • Copy the contents of defconfig file to .config file

test:~$ sudo cp defconfig .config
  • Compile hostapd

test:~$ sudo make
  • Create run_hostapd.conf

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
periodic_deauth=30
  • Run hostapd

test:~$ sudo ./hostapd ./run_hostapd.conf
  • Download file to check wireshark output

send_deauth_pkt_every_30sec.pcapng

  • Check for de-authentication packet

  • Apply display filter

  • wlan.addr == 02:00:00:00:01:00 && wlan.fc.type_subtype == 12

Diagram
  • Observe the de-authentication packets with 30 sec time interval

Diagram