Skip to content

Mac Address manufacturer OUI lookup for node.js

Notifications You must be signed in to change notification settings

cuteboi/mac-lookup

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mac-lookup

NPM

Build Status Dependencies StatusNPM 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

// Config is optional
var config = {
  sql: './oui.db',
  txt: './oui.txt',
  url: 'http://linuxnet.ca/ieee/oui.txt'
}

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

// if defining a custom config, make sure to rebuild at least once to generate sqlite3 db
mac.rebuild();

// ...

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);

About

Mac Address manufacturer OUI lookup for node.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%