Commit 39558f10 authored by Janis Streib's avatar Janis Streib 🦉

ADD: oui-lookup

parent 7db5db56
Pipeline #130319 passed with stages
in 6 minutes and 24 seconds
......@@ -87,6 +87,12 @@ def poll(job_id):
return jsonify(s['macfinder_jobs'][job_id].poll(session, db, get_db_conn()))
@macfinder.route('/oui_lookup')
def oui_lookup():
mac = format_mac(request.args['mac'])
return jsonify({'mac': mac, 'vendor': OUI_DB.get(mac[:8], None)})
def format_mac(mac):
mac = mac.lower().strip()
mac = re.sub(r'(.*?)([0-9a-f]+|$|^)', lambda m: ('' * len(m.groups()[0]) + m.groups()[1]), mac)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment