Bunny Rabbit
Bunny Rabbit

Reputation: 8411

how to get IP adress of a Host if its Mac address is known using python / scapy

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

Upvotes: 0

Views: 2081

Answers (2)

unutbu
unutbu

Reputation: 879281

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

Upvotes: 0

user2665694
user2665694

Reputation:

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.

Upvotes: 2

Related Questions