Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/haimkastner/local-network-scan
A lightweight library to quickly scan local network.
https://github.com/haimkastner/local-network-scan
Last synced: about 1 month ago
JSON representation
A lightweight library to quickly scan local network.
- Host: GitHub
- URL: https://github.com/haimkastner/local-network-scan
- Owner: haimkastner
- License: mit
- Created: 2021-10-02T19:03:48.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-10T21:55:39.000Z (over 3 years ago)
- Last Synced: 2024-04-25T02:02:52.752Z (10 months ago)
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/local-network-scan
- Size: 19.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# local-network-scan
A lightweight library to quickly scan local network.
[](https://github.com/haimkastner/local-network-scan/actions/workflows/nodejs.yml)
> The library uses `arp` tool, in case of Linux machine, make sur it's installed on run-time (or install it by `apt-get install net-tools`).
The library ping all network IP's in parallel to make the scan faster should take ~10 seconds or less.
## Install via NPM:
```bash
npm install local-network-scan
```
## Examples
```typescript
import { scanLocalNetwork } from 'local-network-scan';(async () => {
// Scan default network, with default option
const res1 = await scanLocalNetwork();
console.log(res1); // [{ ip: '192.168.1.1', mac: '11aa22bb33cc' }, { ip: '192.168.1.2', mac: '12ab23bc34cd' }]// Scan specific network
const res2 = await scanLocalNetwork({ localNetwork: '192.168.2' });
console.log(res2); // [{ ip: '192.168.2.1', mac: '11aa22bb33cc' }, { ip: '192.168.2.2', mac: '12ab23bc34cd' }]// Query device vendor (using https://macvendors.com/ API) - OFF by default
const res3 = await scanLocalNetwork({ queryVendor: true });
console.log(res3); // [{ ip: '192.168.2.1', mac: '11aa22bb33cc', vendor: 'some vendor' }, { ip: '192.168.2.2', mac: '12ab23bc34cd', vendor: '' }]
})()```