Giter Club home page Giter Club logo

local-devices's Introduction

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

local-devices's People

Contributors

dickydoouk avatar dylanpiercey avatar howel52 avatar kounelios13 avatar lucasoldi avatar markussuomi avatar miosame avatar natterstefan avatar timrogers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

local-devices's Issues

Can I make this work in Angular ?

I tried to implement and I get an error

ERROR in ./node_modules/mz/child_process.js
Module not found: Error: Can't resolve 'child_process' in 'C:\Users\NebojsaBalac\lan-scan\node_modules\mz'
ERROR in ./node_modules/local-devices/src/index.js
Module not found: Error: Can't resolve 'net' in 'C:\Users\NebojsaBalac\lan-scan\node_modules\local-devices\src'
ERROR in ./node_modules/ip/lib/ip.js
Module not found: Error: Can't resolve 'os' in 'C:\Users\NebojsaBalac\lan-scan\node_modules\ip\lib'
ERROR in ./node_modules/local-devices/src/index.js
Module not found: Error: Can't resolve 'os' in 'C:\Users\NebojsaBalac\lan-scan\node_modules\local-devices\src'

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

I got the current error on MacBook Air 2020 8GB macOS Monterrey 12.2.1
It use to work correctly
Is somebody else with a similar issue?
Apparently, this error happens just with large networks.

> require("local-devices")()

<--- Last few GCs --->

[40704:0x160008000]    38829 ms: Scavenge (reduce) 2047.0 (2076.7) -> 2046.7 (2077.5) MB, 49.9 / 0.0 ms  (average mu = 0.384, current mu = 0.398) allocation failure 
[40704:0x160008000]    40469 ms: Mark-sweep (reduce) 2047.9 (2077.7) -> 2047.4 (2078.2) MB, 1561.2 / 2.5 ms  (+ 117.5 ms in 30 steps since start of marking, biggest step 6.8 ms, walltime since start of marking 1757 ms) (average mu = 0.314, current mu = 0.

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0x10028446c node::Abort() [/usr/local/bin/node]
 2: 0x1002845f4 node::errors::TryCatchScope::~TryCatchScope() [/usr/local/bin/node]
 3: 0x1003d27b4 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
 4: 0x1003d2748 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
 5: 0x100555c08 v8::internal::Heap::GarbageCollectionReasonToString(v8::internal::GarbageCollectionReason) [/usr/local/bin/node]
 6: 0x100554728 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
 7: 0x10055fa04 v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
 8: 0x10055fa98 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
 9: 0x100532950 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/bin/node]
10: 0x100867d10 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
11: 0x100b7c2ec Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/bin/node]
12: 0x100bc2b48 Builtins_PromiseConstructor [/usr/local/bin/node]
13: 0x100b0d1b0 Builtins_JSBuiltinsConstructStub [/usr/local/bin/node]
14: 0x104d1bd24 
15: 0x100b98788 Builtins_ArrayMap [/usr/local/bin/node]
16: 0x100b0ff78 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
17: 0x100b0ff78 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
18: 0x100b0ff78 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
19: 0x100b0dd6c Builtins_JSEntryTrampoline [/usr/local/bin/node]
20: 0x100b0da04 Builtins_JSEntry [/usr/local/bin/node]
21: 0x1004e2488 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/usr/local/bin/node]
22: 0x1004e1b1c v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) [/usr/local/bin/node]
23: 0x1003da39c v8::Script::Run(v8::Local<v8::Context>) [/usr/local/bin/node]
24: 0x10027a894 node::contextify::ContextifyScript::EvalMachine(node::Environment*, long long, bool, bool, bool, std::__1::shared_ptr<v8::MicrotaskQueue>, v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
25: 0x10027a494 node::contextify::ContextifyScript::RunInThisContext(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
26: 0x10043f57c v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/usr/local/bin/node]
27: 0x10043f074 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
28: 0x10043e900 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
29: 0x100b7c42c Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/usr/local/bin/node]
30: 0x100b0ff78 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
31: 0x100b0ff78 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
32: 0x100b0ff78 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
33: 0x100b0ff78 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
34: 0x100b0ff78 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
35: 0x104ca1e78 
36: 0x104ca71b4 
37: 0x100b0ff78 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
38: 0x100b0ff78 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
39: 0x104ca5f28 
40: 0x104ca2ec8 
41: 0x104c9e77c 
42: 0x104ca1cd0 
43: 0x104ca71b4 
44: 0x104cac604 
45: 0x100b4174c Builtins_GeneratorPrototypeNext [/usr/local/bin/node]
46: 0x104ca097c 
47: 0x104ca1cd0 
48: 0x104ca71b4 
49: 0x104cbb940 
50: 0x104cca720 
51: 0x104caf660 
52: 0x104ccd458 
53: 0x104c94afc 
54: 0x100b0dd6c Builtins_JSEntryTrampoline [/usr/local/bin/node]
55: 0x100b0da04 Builtins_JSEntry [/usr/local/bin/node]
56: 0x1004e2488 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/usr/local/bin/node]
57: 0x1004e1b1c v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) [/usr/local/bin/node]
58: 0x1003ef0c0 v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) [/usr/local/bin/node]
59: 0x1001d4348 node::InternalMakeCallback(node::Environment*, v8::Local<v8::Object>, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context) [/usr/local/bin/node]
60: 0x1001e94ac node::AsyncWrap::MakeCallback(v8::Local<v8::Function>, int, v8::Local<v8::Value>*) [/usr/local/bin/node]
61: 0x10032a474 node::StreamBase::CallJSOnreadMethod(long, v8::Local<v8::ArrayBuffer>, unsigned long, node::StreamBase::StreamBaseJSChecks) [/usr/local/bin/node]
62: 0x10032c440 node::EmitToJSStreamListener::OnStreamRead(long, uv_buf_t const&) [/usr/local/bin/node]
63: 0x100330a60 node::LibuvStreamWrap::OnUvRead(long, uv_buf_t const*) [/usr/local/bin/node]
64: 0x100afb704 uv__stream_io [/usr/local/bin/node]
65: 0x100b03824 uv__io_poll [/usr/local/bin/node]
66: 0x100af1fa0 uv_run [/usr/local/bin/node]
67: 0x1001d4e00 node::SpinEventLoop(node::Environment*) [/usr/local/bin/node]
68: 0x1002bd638 node::NodeMainInstance::Run(int*, node::Environment*) [/usr/local/bin/node]
69: 0x1002bd304 node::NodeMainInstance::Run(node::EnvSerializeInfo const*) [/usr/local/bin/node]
70: 0x1002562ec node::Start(int, char**) [/usr/local/bin/node]
71: 0x104a6d0f4 
zsh: abort      node

Get device's name

My use case is the following: I'm trying to auto-detect my camera when it is connected to the local network. Working from a w10 computer.

In my physical router interface, I can see it displayed over the name of LUMIX, which is something I could definitely work with.

But when I run the package, the only name I get is "?". Actually in none of the examples I can find in this repository's issues a device name is ever shown. Why?

Is there a way to retrieve the LUMIX name somehow, so I can auto-select it? Any suggestion about that?

Thanks you very much,

Unclear documentation

Hello.I tried to use this module for a simple script.I tried to copy paste your code.However import statement is not supported.So I had to do the following:


const find = require('local-devices');

// Find all local network devices.
find().then(devices => {
    console.log('dev')
    console.log(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: '...' }
  ]
  */
})const find = require('local-devices');

// Find all local network devices.
find().then(devices => {
    console.log('dev')
    console.log(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: '...' }
  ]
  */
})

Would you accept a pull request for that?

Typescript Return Type for Single Result Missing

Hi, thanks for writing and maintaining this library :)

From what I can tell, the findLocalDevices function can either return a single device, or an array, depending on whether it is called with an ip parameter. This does not seem to be reflected in the type signature, which only includes the list version.

It would be great if the single device return type could be added ^_^

MAC address currently needs to be lowercase

After a quick look at the code I didn't immediately see where it would be best to add a quick .toLowerCase(); however, it would be beneficial to make input be not be case-specific.

NPM Publish to include windows support?

Hello, @DylanPiercey! thanks for this great module, I was about to send a PR to fix windows support only to see that you already merged a PR that fixes it ๐Ÿ˜„

Anyway, it seems the version that is on npm doesn't include this fix. Would you be willing to publish an update?

Normally I'm a mac user but happen to be working on an electron.js project where we want to use this module to scan for local network devices on both mac/windows.

Thanks again for this great tool โค๏ธ

Javascript Memory Heap issue on Large network

Hi, Team
I am using the local-devices node module to get the list active IPs list from the same network, It is working very well, But I had another challenge same module I am using in another network which is very large, and this local-device module shows shortly message related to Javascript Memory Heap issue and closed CMD window.

Here example:
Wi-Fi

{ networkAddress: '00.0.0.0',
firstAddress: '00.0.0.1',
lastAddress: '00.00.000.254',
broadcastAddress: '00.000.000.255',
subnetMask: '000.0.0.0',
subnetMaskLength: 8,
numHosts: 16999106,
length: 16999104
}

0 means one digit could be any number based on network
00 means two digits could be any number based on network
000 mean three digits could be any number based on network

App crashes after a while: `Error: Command failed: arp -a`

After about 40 seconds of not being in VSCode I get this error:

node:internal/errors:856
  const err = new Error(message);
              ^

Error: Command failed: arp -a

    at ChildProcess.exithandler (node:child_process:389:12)
    at ChildProcess.emit (node:events:537:28)
    at maybeClose (node:internal/child_process:1091:16)
    at ChildProcess._handle.onexit (node:internal/child_process:302:5) {
  code: null,
  killed: true,
  signal: 'SIGTERM',
  cmd: 'arp -a'
}

Node.js v18.5.0

OS: macOS Monterey, MacBook Air 2017
Node Version: v18.5.0

Any help would be greatly appreciated, since this project is very important!
Reagards, Alex

multiple async operations, same result

hi,

giving this example:

const find = require('local-devices');
var nets = ['192.168.172.1/24', '192.168.10.222/24', '192.168.152.1/24']
for (var n in nets)
{
  find({ address: nets[n] }).then(devices => {
    console.log(nets[n])
    console.log(devices)
  })
}

will return the different nets, but in all 3 returns the same devices. Seems like its not async compatible

regards

Error on airport wifi

I'm getting the following error when running find() on airport wifi. Works awesome at home/work.

I tried to wrap the find in try/catch and same error. Looking at the arp table I'm getting a lot of blank Mac addresses. Wonder if this could cause this error?

  try {
            find().then(devices => {
            
             }
        } catch { }

(node:68247) UnhandledPromiseRejectionWarning: RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length exceeded
at Socket.onChildStdout (child_process.js:357:14)
at Socket.emit (events.js:197:13)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:265:13)
at Socket.Readable.push (_stream_readable.js:224:10)
at Pipe.onStreamRead (internal/stream_base_commons.js:145:17)
(node:68247) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:68247) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Doesn't include host device

It would be great if it could also include details about the host device, as that device is also part of local devices..

App crashes after executing findLocalDevices

Hello everyone, I have app that scans devices in local network, and when i am trying to use this lib app crashes.
I found out that getServers() function returns too many servers. In my case:

[
  '25.0.0.2', '25.0.0.3', '25.0.0.4', '25.0.0.5', '25.0.0.6',
  '25.0.0.7', '25.0.0.8', '25.0.0.9', '25.0.0.10', '25.0.0.11',
  '25.0.0.12', '25.0.0.13', '25.0.0.14', '25.0.0.15', '25.0.0.16',
  '25.0.0.17', '25.0.0.18', '25.0.0.19', '25.0.0.20', '25.0.0.21',
  '25.0.0.22', '25.0.0.23', '25.0.0.24', '25.0.0.25', '25.0.0.26',
  '25.0.0.27', '25.0.0.28', '25.0.0.29', '25.0.0.30', '25.0.0.31',
  '25.0.0.32', '25.0.0.33', '25.0.0.34', '25.0.0.35', '25.0.0.36',
  '25.0.0.37', '25.0.0.38', '25.0.0.39', '25.0.0.40', '25.0.0.41',
  '25.0.0.42', '25.0.0.43', '25.0.0.44', '25.0.0.45', '25.0.0.46',
  '25.0.0.47', '25.0.0.48', '25.0.0.49', '25.0.0.50', '25.0.0.51',
  '25.0.0.52', '25.0.0.53', '25.0.0.54', '25.0.0.55', '25.0.0.56',
  '25.0.0.57', '25.0.0.58', '25.0.0.59', '25.0.0.60', '25.0.0.61',
  '25.0.0.62', '25.0.0.63', '25.0.0.64', '25.0.0.65', '25.0.0.66',
  '25.0.0.67', '25.0.0.68', '25.0.0.69', '25.0.0.70', '25.0.0.71',
  '25.0.0.72', '25.0.0.73', '25.0.0.74', '25.0.0.75', '25.0.0.76',
  '25.0.0.77', '25.0.0.78', '25.0.0.79', '25.0.0.80', '25.0.0.81',
  '25.0.0.82', '25.0.0.83', '25.0.0.84', '25.0.0.85', '25.0.0.86',
  '25.0.0.87', '25.0.0.88', '25.0.0.89', '25.0.0.90', '25.0.0.91',
  '25.0.0.92', '25.0.0.93', '25.0.0.94', '25.0.0.95', '25.0.0.96',
  '25.0.0.97', '25.0.0.98', '25.0.0.99', '25.0.0.100', '25.0.0.101',
  ... 16777364 more items
]

Maybe we should add limit to gerServers() response size?

I use electron 12.0.1 on windows 10, local-devices lib version: 3.1.0

getServers() never looks for subnet.firstAddress

in getServers(), the while loop post-increments current before pushing to result. This means the first address is never in the result list.

possibly add between lines 68 and 69:
result.push(ip.fromLong(current)

This would push the first address before it is post-incremented in the while test.

cp.exec is not a function

I just tried bringing this package into my Vue 2 app and received the following error:

Uncaught TypeError: cp.exec is not a function        node_modules/local-devices/src/index.js:85

I was using it like such:

import find from 'local-devices';

export default {
    ...
    data () {
        return {
            devices: []
        }
    },
    mounted () {
        this.findDevicesOnNetwork();
    },
    methods: {
        findDevicesOnNetwork () {
            find().then(devices => {
                this.devices = devices;
                console.log(devices);
            });
        },
    }
    ...
}

Any idea how to fix?

NodeJs app crash

Node crashes when trying to load the module.
I tried to install using the Global flag "-g" and it still crashes.
I cannot locate the module anywhere but it acts like it installs.
Ubuntu on a droplet (DigitalOcean)

Linux crontab can't find arp

My solution was to change these 2 lines in \local-devices\src\index.js lines 105 and 145

105
original: return cp.exec('arp -a', options).then(parseAll)
new: return cp.exec('/usr/sbin/arp -a', options).then(parseAll)

145
original: return cp.exec('arp -n ' + address, options).then(parseOne)
new: return cp.exec('/usr/sbin/arp -n ' + address, options).then(parseOne)

I'm guessing this was a simplistic approach and will not work on different OS

Can't find any (or correct amount of) devices. Instead got undefined on Raspberry Pi.

Hi @DylanPiercey,

as described on Twitter yesterday, I have issues getting results on my Raspberry Pi.

When I run arp -n I get the following 24 results. But running find(192.168.0.66) for instance returns undefined.

At the same time arp -n 192.168.0.66 returns something.

This is my demo snippet on the Pi:

const find = require('local-devices');
// Find all local network devices.

find().then(devices => {
  console.log('FIND ALL', devices);
})

// Find a single device by ip address.
find('192.168.0.66').then(device => {
  console.log('FIND ONE', device);
})

What am I missing? For the record, find() returns a list with 172 results (but I have only 24 devices in the network)

Thanks for your help!

Arp -a table for react-native?

Hi, i'm doing a RN project, and I want to create a arp table of the local network , this libary is perfect for me, but it works on react-native?
Sorry, I'm a layman in this regard

React-native support

Is it possible for this project to work with react-native on IOS and Android?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.