获取路由器范围内设备的MAC地址

发布于 2024-08-21 18:06:10 字数 251 浏览 8 评论 0原文

路由器是否可以获取附近未连接的设备的MAC地址?我想编写一个应用程序,当特定的 MAC 地址进入我拥有的路由器的范围内时,它会以某种方式通知我(电子邮件或其他东西)(该应用程序比这更具体,所以我不能使用预构建的工具,但如果它们是开源的)他们可以提供帮助)。路由器将连接到互联网,设备是 iPhone,因此它会不断寻找 WiFi 接入点,所以我觉得所有的要素都在那里,但我不确定我所要求的是否可能。如果可能的话(即使只是重写路由器操作系统)需要什么? C 的水平与我希望的一样低......

Is it possible for a router to obtain the MAC address of nearby devices that have not connected to it? I want to write an app that notifies me somehow (email or something) when a specific MAC address comes within range of a router that I have (the app is much more specific than that so I cannot use prebuilt tools but if they are open source they could help). The router will be connected to the internet and the device is an iPhone so it is constantly looking for WiFi access points so I feel like all the ingredients are there but I am not sure if what I am asking is possible. If it is possible (even if only by rewriting the router OS) what will it take? C is as low level as I am hoping to go...

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

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

发布评论

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

评论(3

二货你真萌 2024-08-28 18:06:10

一台可以编程的基于 Linux 的路由器,这通常意味着运行 OpenWRT 或 DD-WRT 的路由器可以做到这一点;您可以将路由器置于监控模式,并让 tcpdump 或 tshark 侦听该特定 MAC 地址。如果需要,您可以编写自己的捕获应用程序,该应用程序将使用 libpcap 进行侦听。如果您只能扫描活动信道,则路由器可能会同时提供接入点。

您还可以监听标准路由器的日志,但问题在于,在路由器记录任何内容之前,手机至少必须尝试关联;使用 Linux 路由器,您只需侦听发出任何数据包的 MAC 地址即可。

我最喜欢的基于 Linux 的路由器来自 Ubiquiti,因为他们的 RouterStation Pro 是为运行 OpenWRT 而构建的,所以没有黑客攻击和完整的硬件文档。

A Linux-based router that you can program, which usually means one that runs OpenWRT or DD-WRT can do this; you can put the router in monitor mode, and have tcpdump or tshark listen for that particular MAC address. If you want, you could write your own capture application that would use libpcap to listen. If you can live with only scanning the active channel, the router could be providing an access point at the same time.

You could also listen to the logs of a standard router, but the issue there is that the phone would have to at least attempt association before the router would log anything; with a linux router, you can just listen for that MAC address emitting any packet at all.

My favourite Linux-based routers come from Ubiquiti, because their RouterStation Pro is built to run OpenWRT, so there is no hacking and complete hardware documentation.

感悟人生的甜 2024-08-28 18:06:10

取决于路由器。有些路由器具有完全开放的操作系统,例如 Linksys WRT54GL,其中存在 OpenWRT、DD-WRT 和 Tomato 操作系统。例如,您可以开发一个简单的 bash 脚本来解释日志文件并向您发送电子邮件。

您使用其他路由器的体验可能会有所不同。许多都有可通过 http 或 telnet 访问的日志文件,因此即使您无法在路由器上运行自己的代码,您也可以在外部解释此文件。

Depends on the router. There are routers out there which have completely open operating systems, such as the Linksys WRT54GL, for which the OpenWRT, DD-WRT and Tomato operating systems exist. You could (for example) develop a simple bash script to interpret the log files and email you.

You experience with other routers may vary. Many have log files which are accessible via http or telnet, so you may be able to interpret this externally even if you can't run your own code on the router.

段念尘 2024-08-28 18:06:10

我猜测路由器实际上是指 wifi 接入点(可能集成到家庭路由器中),并且您正在谈论 wifi 连接。那么不,这是不可能的。仅当设备至少尝试连接到其网络时,接入点才知道 MAC 地址。然而,设备显示的附近网络列表不需要与任何网络进行任何形式的连接。相反,它们监听接入点发出的信标。

I am guessing that by router you actually mean a wifi access point (which may be integrated into a home router) and you are talking about wifi connections. Then no, it is not possible. The access point only knows the MAC address when the device at least tried to connect to its network. The list of nearby networks that the device shows however does not require any form of connection to any of the networks. Instead, they listen for the beacons that the access points send out.

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