Skip to content

Instantly share code, notes, and snippets.

@belyaev-pa
Created July 10, 2019 15:12
Show Gist options
  • Save belyaev-pa/0628c5c91fcd34a31d86cbec74a2e5f1 to your computer and use it in GitHub Desktop.
Save belyaev-pa/0628c5c91fcd34a31d86cbec74a2e5f1 to your computer and use it in GitHub Desktop.
def mac_in_range(first_mac, last_mac, checking_mac):
first_int = int(first_mac.translate(None, ":.- "), 16)
last_int = int(last_mac.translate(None, ":.- "), 16)
checking_int = int(checking_mac.translate(None, ":.- "), 16)
if checking_int > first_int and checking_int < last_int:
return True
else:
return False
print(mac_in_range('02:50:68:00:00:02', '02:50:68:00:00:FF', '02:50:68:00:00:14'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment