https://github.com/krystianity/mac-scanner
Monitor private network MAC address appearance, leaves and IP changes
https://github.com/krystianity/mac-scanner
address events ip mac mac-address monitor network private
Last synced: 12 months ago
JSON representation
Monitor private network MAC address appearance, leaves and IP changes
- Host: GitHub
- URL: https://github.com/krystianity/mac-scanner
- Owner: krystianity
- License: mit
- Created: 2017-12-10T16:30:08.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-11T14:08:37.000Z (over 8 years ago)
- Last Synced: 2025-05-11T06:06:37.479Z (about 1 year ago)
- Topics: address, events, ip, mac, mac-address, monitor, network, private
- Language: JavaScript
- Size: 5.86 KB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MacScanner
## What does it do?
- with macscanner you can monitor mac-address appearances, leaves and ip address changes
- almost in real-time (depdening on configuration and network size)
- you can only monitor private networks, of which the host running the scanner is a client
- it works by calculating all hosts in the network, pinging them and grabbing the mac-address from an arp table
## What does it require?
- will not work on windows (tested on ubuntu only, but mac should work as well)
- requires `arp`
- requires access to `raw sockets`, there is a good chance that you need to start the app with elevated rights
- starting with elevated rights can work like this `sudo $(which node) index.js`
- requires node version >= 8
## How to use it?
- install via `npm -g mac-scanner`
- checkout the example [here](example/index.js)
```javascript
"use strict";
const {MacScanner} = require("mac-scanner");
const scanner = new MacScanner(config);
scanner.start();
scanner.on("entered", target => {
console.log("he is here", target.ip, target.mac);
});
scanner.on("left", target => {
console.log("he is gone", target.ip, target.mac);
});
scanner.on("changed", target => {
console.log("changed ip", target.mac, "from", target.oldIP, "to", target.newIP);
});
```