Created
December 2, 2018 18:24
-
-
Save NGenetzky/976f14f260208f8407b0b34ab09397d3 to your computer and use it in GitHub Desktop.
Python Mac address vendor lookup
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
#!/usr/bin/env python | |
# References: | |
# [Python Mac address vendor lookup](https://macvendors.co/api/python) | |
# [@wichert](https://twitter.com/coding_wiggy) | |
import pprint | |
import requests | |
def mac_info(mac): | |
mac_url = 'http://macvendors.co/api/{0}'.format(mac) | |
r = requests.get(mac_url) | |
return r.json()['result'] | |
def main(args): | |
pprint.pprint(mac_info(args[0])) | |
if __name__ == "__main__": | |
import sys | |
sys.exit(main(sys.argv[1:])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment