Added MAC OUI lookup

This commit is contained in:
Daniel Dayley 2020-07-21 16:11:42 -06:00
parent e6baf29c7c
commit e7ba7ee2ef

19
plugins/mac.py Normal file
View File

@ -0,0 +1,19 @@
from servicebase import ServiceBase
import requests
import json
class ServiceDelegate(ServiceBase) :
def get_arguments(cls) :
"""Returns an array of information used to construct an argumentparser argument."""
return [ '-m', '--mac', 'store_true', 'Return vendor OUI from a MAC address (mac)' ]
def lookup(self,subject) :
response = requests.get('https://macvendors.co/api/' + subject + '/json',headers={'User-Agent' : "API Browser"})
if response.status_code == 200 :
result = json.loads(response.text)['result']
if 'error' in result :
self._error.append(result['error'])
return None
return result
return None