Revision: 63232
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 18, 2013 00:18 by someguy123
Initial Code
from subprocess import Popen, PIPE import re IP = "192.168.10.111" Popen(["ping", "-c 1", IP], stdout = PIPE) pid = Popen(["arp", "-n", IP], stdout = PIPE) s = pid.communicate()[0] mac = re.search(r"(([a-f\d]{1,2}\:){5}[a-f\d]{1,2})", s).groups()[0] print "%s--> %s" % (IP, mac)
Initial URL
Initial Description
This can be used to get arp mac address from a ip address. Remember that MAC addresses are in arp tables (volatile), that's why a ping is done first. But i don't know if timing between ping call and arp call is enought to make sense (of pinging).
Initial Title
Get ARP MAC from IP address
Initial Tags
mac, ip
Initial Language
Python