如果使用 python / scapy 已知主机的 Mac 地址,如何获取主机的 IP 地址

发布于 2024-11-09 09:09:29 字数 60 浏览 0 评论 0原文

如果计算机的 mac 地址已知,我如何获取计算机的 IP 地址,使用 python 和 scapy 可能是

How can i get the IP address of a computer if its mac address is known , using python and scapy may be

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

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

发布评论

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

评论(2

删除→记忆 2024-11-16 09:09:29

您可以使用 arp 缓存中的信息:

> arp -a 
localhost (10.37.129.2) at 0:1c:42:0:0:9 on vnic1 ifscope permanent [ethernet]
localhost (10.37.129.255) at ff:ff:ff:ff:ff:ff on vnic1 ifscope [ethernet]
localhost (10.211.55.2) at 0:1c:42:0:0:8 on vnic0 ifscope permanent [ethernet]
localhost (10.211.55.255) at ff:ff:ff:ff:ff:ff on vnic0 ifscope [ethernet]
fritz.slwlan.box (192.168.0.1) at 0:4:e:2b:28:16 on en1 ifscope [ethernet]

您可以自己在 Unix 上解析“arp -a”的结果,或者查看

http://libdnet.sourceforge.net/dnet.html

提供从 Python 访问 ARP 缓存的权限。

You might use the information from the arp cache:

> arp -a 
localhost (10.37.129.2) at 0:1c:42:0:0:9 on vnic1 ifscope permanent [ethernet]
localhost (10.37.129.255) at ff:ff:ff:ff:ff:ff on vnic1 ifscope [ethernet]
localhost (10.211.55.2) at 0:1c:42:0:0:8 on vnic0 ifscope permanent [ethernet]
localhost (10.211.55.255) at ff:ff:ff:ff:ff:ff on vnic0 ifscope [ethernet]
fritz.slwlan.box (192.168.0.1) at 0:4:e:2b:28:16 on en1 ifscope [ethernet]

Either you parse the result of "arp -a" on Unix yourself or look at

http://libdnet.sourceforge.net/dnet.html

providing access to the ARP cache from Python.

沒落の蓅哖 2024-11-16 09:09:29

也许你可以使用 arp-scan,但是你必须以 root 身份运行 :

$ arp-scan --interface=eth0 --localnet
Interface: eth0, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.5.2 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)
192.168.1.1     00:c0:9f:09:b8:db       QUANTA COMPUTER, INC.
192.168.1.4     00:02:b3:bb:5c:09       Intel Corporation
192.168.1.3     00:02:b3:bb:66:98       Intel Corporation
192.168.1.5     00:02:a5:90:c3:e6       Compaq Computer Corporation
192.168.1.6     00:c0:9f:0b:91:d1       QUANTA COMPUTER, INC.
192.168.1.8     00:02:b3:3d:13:5e       Intel Corporation
...

34 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.5.2: 256 hosts scanned in 1.717 seconds (149.10 hosts/sec).  33 responded

Perhaps you could use arp-scan, but then you'd have to run as root:

$ arp-scan --interface=eth0 --localnet
Interface: eth0, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.5.2 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)
192.168.1.1     00:c0:9f:09:b8:db       QUANTA COMPUTER, INC.
192.168.1.4     00:02:b3:bb:5c:09       Intel Corporation
192.168.1.3     00:02:b3:bb:66:98       Intel Corporation
192.168.1.5     00:02:a5:90:c3:e6       Compaq Computer Corporation
192.168.1.6     00:c0:9f:0b:91:d1       QUANTA COMPUTER, INC.
192.168.1.8     00:02:b3:3d:13:5e       Intel Corporation
...

34 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.5.2: 256 hosts scanned in 1.717 seconds (149.10 hosts/sec).  33 responded
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文