Closed njbbaer closed 8 years ago
What happens when you run 'npm test'?
C:\Users\Nathaniel\node_modules\node-libnmap\examples>npm test
> node-libnmap@0.2.15 test C:\Users\Nathaniel\node_modules\node-libnmap
> mocha -R spec
nmap
discovery method
1) validate report
nmap
error handling
√ missing nmap binary
√ invalid host range (host)
√ invalid host range (range)
√ invalid host range (CIDR)
√ invalid port range
√ invalid flag options
nmap
scan method
2) default
3) xml report
6 passing (231ms)
3 failing
1) nmap discovery method validate report:
TypeError: undefined is not a function
at Object.tools.command (C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:253:16)
at block (C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:213:23)
at C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\async\lib\async.js:713:13
at replenish (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\async\lib\async.js:319:21)
at C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\async\lib\async.js:330:15
at _parallel (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\async\lib\async.js:712:9)
at Object.async.parallelLimit (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\async\lib\async.js:730:9)
at Object.tools.worker (C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:272:13)
at discover (C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:543:13)
at C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:95:16
at Object.validation.init (C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:471:49)
at Object.config.init (C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:76:18)
at nmap.discover (C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:536:12)
at Context.<anonymous> (C:\Users\Nathaniel\node_modules\node-libnmap\test\discover.js:17:12)
at callFnAsync (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runnable.js:306:8)
at Test.Runnable.run (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runnable.js:261:7)
at Runner.runTest (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runner.js:421:10)
at C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runner.js:528:12
at next (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runner.js:341:14)
at C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runner.js:351:7
at next (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runner.js:283:14)
at Immediate._onImmediate (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runner.js:319:5)
2) nmap scan method default:
TypeError: undefined is not a function
at Object.tools.command (C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:253:16)
at block (C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:213:23)
at C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\async\lib\async.js:713:13
at replenish (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\async\lib\async.js:319:21)
at C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\async\lib\async.js:330:15
at _parallel (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\async\lib\async.js:712:9)
at Object.async.parallelLimit (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\async\lib\async.js:730:9)
at Object.tools.worker (C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:272:13)
at discover (C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:572:13)
at C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:95:16
at Object.validation.init (C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:471:49)
at Object.config.init (C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:76:18)
at nmap.scan (C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:565:12)
at Context.<anonymous> (C:\Users\Nathaniel\node_modules\node-libnmap\test\scan.js:23:12)
at callFnAsync (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runnable.js:306:8)
at Test.Runnable.run (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runnable.js:261:7)
at Runner.runTest (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runner.js:421:10)
at C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runner.js:528:12
at next (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runner.js:341:14)
at C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runner.js:351:7
at next (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runner.js:283:14)
at Immediate._onImmediate (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runner.js:319:5)
3) nmap scan method xml report:
TypeError: undefined is not a function
at Object.tools.command (C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:253:16)
at block (C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:213:23)
at C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\async\lib\async.js:713:13
at replenish (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\async\lib\async.js:319:21)
at C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\async\lib\async.js:330:15
at _parallel (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\async\lib\async.js:712:9)
at Object.async.parallelLimit (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\async\lib\async.js:730:9)
at Object.tools.worker (C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:272:13)
at discover (C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:572:13)
at C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:95:16
at Object.validation.init (C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:471:49)
at Object.config.init (C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:76:18)
at nmap.scan (C:\Users\Nathaniel\node_modules\node-libnmap\lib\node-libnmap.js:565:12)
at Context.<anonymous> (C:\Users\Nathaniel\node_modules\node-libnmap\test\scan.js:35:12)
at callFnAsync (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runnable.js:306:8)
at Test.Runnable.run (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runnable.js:261:7)
at Runner.runTest (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runner.js:421:10)
at C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runner.js:528:12
at next (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runner.js:341:14)
at C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runner.js:351:7
at next (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runner.js:283:14)
at Immediate._onImmediate (C:\Users\Nathaniel\node_modules\node-libnmap\node_modules\mocha\lib\runner.js:319:5)
npm ERR! Test failed. See above for more details.
How did you install this? Using 'npm install libnmap' or some other way? I don't use Windows so attempting to recreate your issue is difficultie
Yes I did use npm. Though I think I've decided libnmap isn't suitable for what I need. I found I can scrape device information directly from the status page of my router.
Or because your on Windows you can query your systems arp traffic with arp -a ref: https://technet.microsoft.com/en-us/library/cc786759(v=ws.10).aspx
Technically your router is soliciting the same information because it is the active gateway on your subnet. The problem is if a system is quiet the arp table won't register on the router or your systems local arp table.
nmap scans for local systems with techniques described here which will be much more accurate than relying on the arp table. The arp table will pop and push entries continuously and will never provide an accurate total of systems on a class a or class b subnet
That's interesting, I had noticed devices appearing and disappearing from the arp table. I figured phones going to sleep and such, I didn't know if there was anything that could be done about it. In that case I'd prefer to use libnmap if possible.
I found I can perform a discovery by specifying a range, which should be everything on my home network.
var nmap = require('libnmap');
var opts = {
range: ['localhost', '192.168.1.0/99'],
}
nmap.scan(discovery, function(err, report) {
if (err) throw new Error(err);
for (var item in report) {
console.log(JSON.stringify(report[item]));
}
});
But this doesn't return me what I want, which is a list of all MAC addresses (or other identifying feature) currently connected to my home network.
The arp table is the only way to remotely retrieve the hardware (Mac) address of the remote system short of sniffing the layer two traffic src address. If the is a route you want to go I think there are some other npm packages that might have the ability to put the network adapter in promiscuous mode
Unless there's a good out of the box solution here, I think I'd be out of my depth. Though I'll look into it if you have a package in mind.
The arp tables could still work, albeit delayed. Devices seem to show up at least every ten minutes or so, so it would take about that long to realize something left the network.
Here is microsofts arp protocol information https://technet.microsoft.com/en-us/library/cc758357(v=ws.10).aspx
I am trying to discover devices on my local network, but running the discover.js example seems to fail.