在同一个Ad-Hoc模式下如何获取附近手机的RSSI和Mac地址?

发布于 2024-11-19 16:19:00 字数 628 浏览 4 评论 0原文

我已将一些 Android 手机更改为 ad-hoc 模式,并让它们具有相同的 essid(通过在每部手机上使用命令:“iwconfig .. essid XXX”)。通过这种方式,它们合并为一个ad-hoc 网络,并且可以在其中成功发送 udp 数据包。

接下来,我想在同一个 ad-hoc 网络中获取附近手机的 RSSI 和 Mac 地址。我尝试启动 wpa_supplicant 进程并意图通过扫描获取 rssi(不是通过 android 系统,因此 android API 例如 getRssi()、getScanResult()无法使用),但我只得到一个essid“XXX”,它代表这个adhoc网络(BSSID)和一个假Mac地址

然后我尝试修改命令“iwlist”在android上重新编译它,我得到了上面相同的结果..我不知道这种现象是由linux系统还是无线驱动程序决定的..

然后我尝试捕获信标数据包手机的,我得到了正确的mac和rssi,但是信标接收器处于监视模式而不是ad-hoc模式,因此无法将udp数据包发送到附近的手机..

那么我该怎么做才能获得每个手机的 RSSI 和 Mac 地址在同一个 Ad-Hoc 网络中吗?

多谢!!

I have changed the some android phones to ad-hoc mode and let them have the same essid (by using command on each phone:"iwconfig .. essid XXX").In this way they merged in one ad-hoc network and can successfully send udp packets among them.

Next, I want to get nearby phones's RSSI and Mac address in the same ad-hoc network.I try to start wpa_supplicant process and intent to get rssi by scaning(not through android system so android API such as getRssi(), getScanResult() could not be used), but I only get one essid "XXX" which stand for this adhoc network(BSSID) and a fake Mac address .

then I try to modify the command "iwlist" to recompile it on android, I got the same results above..I don't know whether this phenomenon is determined by linux system or wireless driver..

then I try to catch the beacon packets of the phone, I get the correct mac and rssi, but the beacon receiver is under moniter mode not in the ad-hoc mode,thus could not send udp packets to nearby phones..

so what can I do to get each phone's RSSI and Mac address in the same Ad-Hoc network?

thanks a lot!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

溺ぐ爱和你が 2024-11-26 16:19:00

我不确定我完全理解你的问题,但我认为你对 WiFi 有一些误解。

首先,RSSI代表“接收信号强度指示”,意思是从接收器角度来看信号的强度。在您的情况下,一部电话了解另一部电话的 RSSI 的唯一方法是在更高层(即应用程序)传输有关 RSSI 的数据。

例如:

  1. 电话 A 向电话 B 发送无线消息 XYZ。
  2. 电话 B 可以以 -75dBm 听到来自电话 A 的消息 XYZ。
  3. 然后,电话 B 可以向电话 A 发送一条消息,告诉电话 A 它正在以 -75dBm 的频率听到电话 A 的声音。
  4. (电话 A 现在可以通过使用从电话 B 接收的消息的 RSSI 来实现与电话 B 相同的功能)

其次,我不完全了解 ad-hoc 网络如何处理 BSSID 等,但我相当清楚您肯定会遇到与上述 RSSI 类似的问题。即ad-hoc模式可能会选择使用哪个BSSID来建立WiFi网络。这不一定是任何设备的 MAC 地址(例如,它可以是假 MAC)。如果您想将一部手机自己的 MAC 传送到另一部手机,您必须将其放入应用程序层的消息中,然后将其发送到另一部手机上的接收应用程序。

例如:

  1. 电话 A 询问其自己的操作系统/网络接口并找到自己的 MAC 地址(注意:它可以找到多个!)
  2. 电话 A 将其放入应用程序消息(即您自己的 UDP 数据包)中并将其发送到电话 B 电话 B 收到消息,
  3. 解包消息并找出 MAC 电话 A 告诉它的内容。

简而言之,答案是:在应用程序层收集和共享信息,您无法从 wifi 堆栈中“嗅探/偷听”您想要的信息。

I am not sure I completely understand your question but I think you have a bit of a misunderstanding about WiFi.

First, RSSI stands for "Received Signal Strength Indication", which means the strength of the signal from the receiver's perspective. In your situation, the only way one phone can know the RSSI of another phone is if data about RSSI is communicated at a higher (i.e. application) layer.

For example:

  1. Phone A sends radio message XYZ to Phone B.
  2. Phone B can hear message XYZ from Phone A at -75dBm.
  3. Phone B could then send a message to Phone A to tell Phone A that it is hearing Phone A at -75dBm.
  4. (Phone A can now to the same thing as Phone B, by using the RSSI of the messages it is receiving from Phone B)

Second, I'm not completely aware of how ad-hoc networks handle BSSIDs etc, but I'm fairly sure you will face a similar problem to the RSSI one above. I.e. The ad-hoc mode probably chooses which BSSID to use for the establishment of the WiFi network. This does not have to be the MAC address of any of the devices (e.g. it can be a fake MAC). If you want to communicate a phone's own MAC to another phone you will have to put it in a message at the application layer and send it to a receiving application on another phone.

For example:

  1. Phone A interrogates its own OS/Network interfaces and finds its own MAC address (NB: it could find more than one!)
  2. Phone A puts this in an application message (i.e. your own UDP packet) and sends it to Phone B.
  3. Phone B receives the message, unpacks the message and finds out what MAC Phone A has told it.

So in short, the answer is: Collect and share the information at the application layer, you can't "sniffer/overhear" the information you are after from the wifi stack.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文