2011-05-21 70 views
0

我怎样才能得到,如果它的MAC地址被称为计算机的IP地址已知的,使用Python和Scapy的可能如何获取主机的IP地址,如果其MAC地址使用python/Scapy的

+0

如果您在路由器(如http://192.168.1.1),请将Web浏览器,可以浏览到一个网页,其中有你想要的信息?如果你能找到这样一个页面,那么你应该能够使用python来抓取所需信息的页面。 – unutbu 2011-05-21 14:00:44

+0

是的,这是一种可能的方式,但不是没有网络协议从mac获取IP? – 2011-05-21 14:08:45

+0

MAC地址可以与多个IP地址关联。 – tzot 2011-05-21 17:27:16

回答

1

也许你可以使用arp-scan,不过最后你都会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 
2

你可能利用这些信息从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

PR拒绝从Python访问ARP缓存。

+0

@sntinel无法使用scapy完成? – 2011-05-21 13:44:49

+0

和arp -a只提供我连接的路由器的地址,而不是通过路由器连接的另一个ppl – 2011-05-21 13:52:28