Skip to content

Instantly share code, notes, and snippets.

@tgrabiec
Created February 5, 2014 14:35
Show Gist options
  • Save tgrabiec/8824888 to your computer and use it in GitHub Desktop.
Save tgrabiec/8824888 to your computer and use it in GitHub Desktop.
def get_ip_for_mac(box, mac):
line = box.eval(['arp -n | grep ' + mac])
if line:
return line.split()[0]
return None
def get_guest_ip(box, mac):
while True:
ip = get_ip_for_mac(box, mac)
if ip:
return ip
time.sleep(0.5)
def new_random_mac():
return'de:ad:be:ef:%02x:%02x' % (randrange(256), randrange(256))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment