ml

mac-lookup

mac address manufacturer lookup for [node](http://nodejs.org).

Showing:

Popularity

Downloads/wk

3

GitHub Stars

10

Maintenance

Last Commit

2yrs ago

Contributors

3

Package

Dependencies

1

License

BSD-2-Clause

Type Definitions

Tree-Shakeable

No?

Categories

Readme

mac-lookup

NPM

Build Status

NPM version NPM downloads

A node module to fetch, parse, and lookup entries from the IEEE's OUI database. Adapted from node-ieee-oui-lookup.

Install

npm install mac-lookup

Usage

Loading using Config:

// Config is optional
var config = {
  csv: './oui.csv'
}

var mac = require('mac-lookup')(config);

// if defining a custom config, make sure to rebuild at least once to generate sqlite3 db
mac.rebuild();
mac.load(done => {
  done();
});

// ...

Loading Using Promises:

'use strict';

const {promisify} = require('util');
const macLookup   = require('mac-lookup');

const asyncMacLookupLoad = promisify(macLookup.load).bind(macLookup);

(async function () {
    await asyncMacLookupLoad();
    const name = macLookup.lookup('000000')
    console.log(name);
}());

To lookup a MAC prefix:

mac.lookup('00:00:00', function (err, name) {
  if (err) throw err;
  // name will be null if not found.
  console.log('00:00:00 -> ' + name);
});

You can also look up the full mac address with or without full dash, dot, or colon notation:

mac.lookup('0000.0000.0000',function (err, name) {
  if (err) throw err;
  // name will be null if not found.
  console.log('0000.0000.0000 -> ' + name);
});)

If you think the internal DB is outdated, you can rebuild it from the latest file with:

mac.rebuild(function (err) {
  if (err) throw err;
  console.log('rebuild completed');
});

Iterate thru the entire db


function done() { console.log('done'); }

mac.each(function (err, result) {
  console.log('oui',  result.oui);
  console.log('name', result.name);
}, done);

Additional Notes

our csv file for ouis are obtained from here

wget https://standards.ieee.org/develop/regauth/oui/oui.csv

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial