How to send both 802.11 management frames and data frames using RAW sockets in linux

别说谁变了你拦得住时间么 提交于 2019-12-08 05:40:07

问题


I am trying to build an application that will send 802.11 management frames and data frames together from the userspace using raw sockets. I am being able to send data frames using the the sendto() function, but I need to send management frames as well, where I am mostly stuck. Is there any possible way of doing it?


回答1:


In order to send management, data or any type of pure raw packet from a wireless interface you have to do the following:

  1. Make sure the wireless interface hardware supports packet injection in monitor mode.
  2. Set the wireless interface in monitor mode. e.g.

sudo ifconfig wlan0 down
sudo iwconfig wlan0 mode monitor

Or you can also create a new virtual monitor interface.

sudo iw dev wlan0 interface add mon0 type monitor

  1. Now open a raw socket to this monitor mode interface.

  2. Finally, Build and append at the beginning, the appropriate radiotap header while building your wireless 802.11 packet for management and control frames. Since you are basically bypassing all lower lever wireless drivers (which handles management and control frames), it becomes your job to include the radiotap header.



来源:https://stackoverflow.com/questions/48271119/how-to-send-both-802-11-management-frames-and-data-frames-using-raw-sockets-in-l

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!