Created
February 5, 2014 14:35
-
-
Save tgrabiec/8824888 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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