Skip to content

chris-spencer/mac-to-oui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

mac-to-oui

A simple MAC Address to Manufacturer Information json response.

Requirements

PHP based webserver

Usage

On first run the script will download the latest oui.txt file from the IEEE OUI registry (the source can be changed within the script).

To receive a JSON reply with the MAC address manufacturer, pass the MAC address in the query string.

For example: ?mac=08:00:20

would return

{
    "query": "08:00:20",
    "hex": "08-00-20",
    "base16": "080020",
    "company": "Oracle Corporation",
    "data_source": "November 27 2019 20:08",
    "querytime": "0.0522ms",
    "peakmemory": "379KB"
}

Note: you can see the data_source date in the response.

Refresh the OUI data file

Periodically you may wish to update the oui.txt file from the original source.

To achieve this include &refresh=yes on the end of a request. This request will take longer as it will re-download the oui.txt file before responding. For safety, refreshes are rate-limited (default: once per 10 minutes).

For example: ?mac=08:00:20&refresh=yes

Error responses

Errors are returned as JSON with appropriate HTTP status codes (e.g. 400 for invalid input, 404 for no match).


Disclaimer: Use at your own peril. Basic error checking is present, and improvements are welcome via PRs.

About

MAC Address to Manufacturer Information

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages