Skip to content

native implementation (when possible) of "arp -a"

Notifications You must be signed in to change notification settings

stickpin/node-arp-a-x

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-arp-a-x

A node.js native implementation (when possible) of "arp -a"

Why not use the arp module? I dislike parsing programmatic output (which can change at any time), and prefer using API-based approaches. That's possible for Linux and Mac OS.

Also, I wanted a node.js module that returns the entire ARP table.

Install

npm install -g --unsafe-perm arp-a-x

API

var arp = require('arp-a-x')
  , tbl = { ipaddrs: {}, ifnames : {} }
  ;

arp.table(function(err, entry) {
  if (!!err) return console.log('arp: ' + err.message);
  if (!entry) return;

  tbl.ipaddrs[entry.ip] = entry.mac;
  if (!tbl.ifnames[entry.ifname]) tbl.ifnames[entry.ifname] = {};
  tbl.ifnames[entry.ifname][entry.mac] = entry.ip;
});

Thanks

Thanks to everyone who's helped contribute code, feedback and support. In particular:

License

MIT license. Freely have you received, freely give.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

native implementation (when possible) of "arp -a"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 46.8%
  • JavaScript 45.6%
  • Python 7.6%