• Stars
    star
    140
  • Rank 261,473 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 8 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ”ฎ Find devices connected to the current local network.

Local Devices

version MIT License js-standard-style All Contributors PRs Welcome

Build Status Coverage Status Watch on GitHub Star on GitHub

Find all devices connected to the local network using arp -a. This module also pings all possible ip's in the local network to build the arp table.

Installation

Npm

npm install local-devices

Example

// Using a transpiler
import find from 'local-devices'
// Without using a transpiler
const find = require('local-devices');

// Find all local network devices.
find().then(devices => {
  devices /*
  [
    { name: '?', ip: '192.168.0.10', mac: '...' },
    { name: '...', ip: '192.168.0.17', mac: '...' },
    { name: '...', ip: '192.168.0.21', mac: '...' },
    { name: '...', ip: '192.168.0.22', mac: '...' }
  ]
  */
})

// Find a single device by ip address.
find({ address: '192.168.0.10' }).then(device => {
  device /*
  {
    name: '?',
    ip: '192.168.0.10',
    mac: '...'
  }
  */
})

// Find all devices within 192.168.0.1 to 192.168.0.25 range
find({ address: '192.168.0.1-192.168.0.25' }).then(devices => {
    devices /*
    [
      { name: '?', ip: '192.168.0.10', mac: '...' },
      { name: '...', ip: '192.168.0.17', mac: '...' },
      { name: '...', ip: '192.168.0.21', mac: '...' },
      { name: '...', ip: '192.168.0.22', mac: '...' }
    ]
    */
})

// Find all devices within /24 subnet range of 192.168.0.x
find({ address: '192.168.0.0/24' }).then(devices => {
    devices /*
    [
      { name: '?', ip: '192.168.0.10', mac: '...' },
      { name: '...', ip: '192.168.0.50', mac: '...' },
      { name: '...', ip: '192.168.0.155', mac: '...' },
      { name: '...', ip: '192.168.0.211', mac: '...' }
    ]
    */
})

// Find all devices without resolving host names (Uses 'arp -an') - this is more performant if hostnames are not needed 
// (This flag is ignored on Windows machines as 'arp -an' is not supported)
find({ skipNameResolution: true }).then(devices => {
    devices /*
    [
      { name: '?', ip: '192.168.0.10', mac: '...' },
      { name: '?', ip: '192.168.0.50', mac: '...' },
      { name: '?', ip: '192.168.0.155', mac: '...' },
      { name: '?', ip: '192.168.0.211', mac: '...' }
    ]
    */
})

// Find all devices, specifying your own path for the `arp` binary 
find({ arpPath: '/usr/sbin/arp' }).then(devices => {
    devices /*
    [
      { name: '?', ip: '192.168.0.10', mac: '...' },
      { name: '?', ip: '192.168.0.50', mac: '...' },
      { name: '?', ip: '192.168.0.155', mac: '...' },
      { name: '?', ip: '192.168.0.211', mac: '...' }
    ]
    */
})

Contributions

  • Use npm test to run tests.

Please feel free to create a PR!

Contributors

Thanks goes to these wonderful people (emoji key):

Dylan Piercey
Dylan Piercey

๐Ÿ’ป ๐Ÿ’ก ๐Ÿ‘€ ๐Ÿ“– ๐Ÿค” ๐Ÿ’ฌ
Stefan Natter
Stefan Natter

๐Ÿ’ป โš ๏ธ ๐Ÿ› ๐Ÿ“– ๐Ÿค”
kounelios13
kounelios13

๐Ÿ› ๐Ÿ“–
MarkusSuomi
MarkusSuomi

๐Ÿ’ป
Xavier Martin
Xavier Martin

๐Ÿ’ป
howel52
howel52

๐Ÿ’ป ๐Ÿ›
LucaSoldi
LucaSoldi

๐Ÿ’ป ๐Ÿ›
Miosame
Miosame

๐Ÿ’ป ๐Ÿ“– ๐Ÿ’ก
Tim Rogers
Tim Rogers

๐Ÿ’ป ๐Ÿ“– โš ๏ธ

This project follows the all-contributors specification. Contributions of any kind are welcome!

How to add Contributors

Contributors can be added with the all-contributors cli. The cli is already installed and can be used like this:

yarn all-contributors add <username> <emoji-keys>

LICENCE

MIT

More Repositories

1

auto-sni

๐Ÿ” Free, automated HTTPS for NodeJS made easy.
JavaScript
1,181
star
2

set-dom

๐Ÿ“‘ Lightweight dom diffing with plain old html.
JavaScript
185
star
3

vdo

๐Ÿท Minimal JSX compatible html focused templating engine.
JavaScript
82
star
4

tusk

UNMAINTAINED - A slim virtual dom implementation.
JavaScript
50
star
5

receptacle

๐Ÿช Multi purpose in memory lru cache with ttl support.
JavaScript
49
star
6

host-proxy

๐Ÿ™‹ Fast, lightweight and transparent http(s) proxy that supports dynamic hostnames.
JavaScript
16
star
7

toll

๐Ÿ™‹โ€โ™‚๏ธ Simple node hostname proxying and registration for micro-services.
JavaScript
16
star
8

parse-form

๐Ÿ“ƒ Utility to easily parse forms in the browser.
TypeScript
13
star
9

Syntux

Highlight.js optimized for browserify and react.
JavaScript
11
star
10

scroll-behaviour

๐Ÿ’ƒ Scroll Behavior polyfill http://iamdustan.com/smoothscroll for universal use.
JavaScript
9
star
11

require-ensure

๐Ÿค Proper require.ensure polyfill for node that is actually async.
JavaScript
9
star
12

set-page

๐Ÿ’† Framework agnostic, isomorphic <html>, <body and <head> rendering utility.
JavaScript
8
star
13

spawn-server-webpack-plugin

๐Ÿ•ดPlugin for automatically starting a node server from memory after building it with Webpack.
TypeScript
8
star
14

loading-tag

Maybefill for a `<loading>` tag which allows for client reordering of async html.
TypeScript
7
star
15

byte-length

๐Ÿ“ Get the real byte length of a string.
TypeScript
7
star
16

mini-querystring

๐ŸŽป Lightweight universal querystring parser.
TypeScript
6
star
17

mini-url

๐Ÿ“– Lightweight universal url parser.
TypeScript
6
star
18

join-url

๐Ÿ‘ฏโ€โ™‚๏ธ Like `path.join` but for urls.
JavaScript
6
star
19

q-flat

๐Ÿฝ Flatten a nested object using query string syntax.
TypeScript
6
star
20

the

โœ… Structured and testable schemas for JavaScript.
JavaScript
5
star
21

marko-vite-fastify-ssg

Marko example using vite, fastify & ssr-to-html to produce a static site.
Marko
5
star
22

as-html

๐Ÿ“„ HTML templating with es6 quasi literals.
JavaScript
5
star
23

htmljs-to-solid-jsx

This is purely an experiment of efficiently compiling Marko's syntax to solid compatible JSX.
TypeScript
5
star
24

is-local-ip

๐Ÿ‘จโ€๐ŸŒพ Check that a given ip address is private.
JavaScript
4
star
25

submit-form

๐Ÿ’พ Utility to easily submit forms in the browser.
JavaScript
4
star
26

benchmark-cli

๐Ÿ‹๏ธโ€โ™€๏ธ CLI application to benchmark JavaScript files.
JavaScript
4
star
27

mocha-snap

File based snapshotting for Mocha tests.
TypeScript
3
star
28

isbrowser

๐Ÿ•ธ A browserify transform to remove server-side code.
JavaScript
3
star
29

mocha-dom

Run Mocha tests in an isolated JSDOM environment.
TypeScript
2
star
30

a-task

๐Ÿ‘ฅ Easily run multiple parallel tasks with node.
JavaScript
2
star
31

fastify-marko-i18n-example

A basic example using Marko + Fastify with i18n
JavaScript
2
star
32

require-load

๐Ÿ—ฃ Asynchronously require files in node.
JavaScript
2
star
33

marko-vite-express-ssr-only

An example showing how to use Marko + Vite with SSR only.
Marko
2
star
34

q-set

๐Ÿด Set a query string style field on an object.
TypeScript
1
star
35

load-stripe

๐Ÿ’ต Load the promisified stripe api in the browser.
JavaScript
1
star
36

md-vars

๐Ÿ“‰ Parse variables from a markdown file in a clean and simple format.
JavaScript
1
star
37

is-typeof

๐Ÿ”ฌ A tool for better type checking in JavaScript.
TypeScript
1
star
38

vite-issue-resolve-id-repro

JavaScript
1
star
39

webpack-dev-server-issue-infinite-reload

https://github.com/webpack/webpack-dev-server/issues/3803
JavaScript
1
star
40

vite-ssr-optimize-deps-cjs-bug

JavaScript
1
star
41

host-to-port

๐Ÿ“ Converts a hostname into a unique valid port.
JavaScript
1
star
42

side-step

๐Ÿ‘€ Intercept Fetch and XHR requests.
JavaScript
1
star
43

vite-ssr-optimize-deps-internals-bug

Importing node internals that ultimately go into SSR optimized deps throws an error.
JavaScript
1
star
44

get-win

Gets the current window/global object in any runtime.
TypeScript
1
star
45

load-frame

Isomorphic browser testing using JSDOM and iframes.
TypeScript
1
star
46

on-event

๐ŸŽค Simpler in-line event delegation for html templates.
JavaScript
1
star