how can I send raw packets over wifi without a network?

∥☆過路亽.° 提交于 2019-12-07 17:04:18

问题


I am trying to send some data between 2 raspberry pi's over wifi without them being connected to a network.

I want it to work similar to the way beacons and probe requests work, where a broadcast can be sent out the wireless interface.

the data I want to send will be the hostname of the device and the time the packet was sent.

I've been trying to figure this out for the last few days but I cannot get anything to work without them being on the same network.

Is anybody able to point me in the right direction? I'm not too fussed about what language I use. I have been trying python and C with little success.


回答1:


Note: This is not really an answer, just some ideas to research, so feel free to edit or comment with corrections.


There are 6 modes a wifi adapter can operate in. From wikipedia:

Master (acting as an access point), Managed (client, also known as station), Ad hoc, Mesh, Repeater, and Monitor mode.

But I believe not all wifi adapters support all modes, so make sure you have suitable hardware.

I would suggest adhoc or mesh would be the most suitable to your purpose. With adhoc mode at least the devices would need to be configured beforehand to use the same SSID and channel. This may not apply to mesh mode.

A quick search yields a few links in regards to using Raspberry Pis in a mesh network:

  • http://hackaday.com/2012/11/14/mesh-networking-with-multiple-raspberry-pi-boards/
  • Wireless mesh networking on Raspberry Pi using batman-adv protocol
  • http://www.netlore.co.uk/airmesh/?page=about

I would also look at using the Dot11* family of packets in the excellent Python Scapy library (not to be confused with Scrapy). You should be able to craft custom packets and transmit them if the interface is in the right mode. Here's a project that creates fake access points that probably contains good info: https://github.com/rpp0/scapy-fakeap



来源:https://stackoverflow.com/questions/31529495/how-can-i-send-raw-packets-over-wifi-without-a-network

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