node-network-scan

1.0.9 • Public • Published

Node Network Scanner

This library is for scan local network and find available devices.

Installation

npm install node-network-scanner
# or
yarn add node-network-scanner
# or
pnpm add node-network-scanner

Usage

Find all available devices on local network.

const networkScanner = new NetworkScanner();
networkScanner.getAllDevices().then((res) => console.log(res));

Find all available devices on specific network interface by interface address.

const networkScanner = new NetworkScanner();
networkScanner
  .getAllDevicesByFilter({ interfaceAddress: "192.168.1.86" })
  .then((res) => {
    console.log(res);
  });

Find all available devices on specific network interface by interface address and with specific TCP port.

const networkScanner = new NetworkScanner();
networkScanner
  .getAllDevicesByFilter({ interfaceAddress: "192.168.1.86" }, 433)
  .then((res) => {
    console.log(res);
  });

Find all available devices on specific network interface by mac address.

const networkScanner = new NetworkScanner();
networkScanner
  .getAllDevicesByFilter({ mac: "xx-xx-xx-xx-xx-xx" })
  .then((res) => {
    console.log(res);
  });

Output

[
  { "ipAddress": "192.168.1.1", "macAddress": "..." },
  { "ipAddress": "192.168.1.20", "macAddress": "..." },
  { "ipAddress": "192.168.1.21", "macAddress": "..." },
  { "ipAddress": "192.168.1.27", "macAddress": "..." },
  { "ipAddress": "192.168.1.86", "macAddress": "..." },
  { "ipAddress": "192.168.1.136", "macAddress": "..." }
]

Test

npm run test

I am still trying to optimize the performance of pinging devices.

Package Sidebar

Install

npm i node-network-scan

Weekly Downloads

13

Version

1.0.9

License

MIT

Unpacked Size

16.5 kB

Total Files

7

Last publish

Collaborators

  • ynyakali