harryhorton / node-nmap

NPM package for interfacing with local NMAP installation
MIT License
67 stars 26 forks source link

npm test - different tests fail depends on time and permissions #31

Open alundiak opened 6 years ago

alundiak commented 6 years ago

npm test:

  NmapScan
    1) runs NMAP
    ✓ accepts space separated command
    ✓ accepts multiple hosts (84ms)
    ✓ returns failure data for bad requests (55ms)

  quickScan
    ✓ scans range of hosts (85ms)
    ✓ returns failure data for bad requests

  osAndPortScan
    2) scans hosts for open ports and OS data
    ✓ returns failure data for bad requests (295ms)

  6 passing (11s)
  2 failing

  1) NmapScan runs NMAP:
     Error: timeout of 10000ms exceeded. Ensure the done() callback is being called in this test.

  2) osAndPortScan scans hosts for open ports and OS data:
     Uncaught Error: Unhandled "error" event. (TCP/IP fingerprinting (for OS scan) requires root privileges.
QUITTING!
)
      at ChildProcess.child.on (index.js:194:14)
      at maybeClose (internal/child_process.js:925:16)
      at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

when I run sudo npm test it goes ok.

My npm ls --depth=1

├─┬ chai@3.5.0
│ ├── assertion-error@1.1.0
│ ├── deep-eql@0.1.3
│ └── type-detect@1.0.0
├─┬ mocha@2.5.3
│ ├── commander@2.3.0
│ ├── debug@2.2.0
│ ├── diff@1.4.0
│ ├── escape-string-regexp@1.0.2
│ ├── glob@3.2.11
│ ├── growl@1.9.2
│ ├── jade@0.26.3
│ ├── mkdirp@0.5.1
│ ├── supports-color@1.2.0
│ └── to-iso-string@0.0.2
├── queued-up@2.0.2
└─┬ xml2js@0.4.19
  ├── sax@1.2.4
  └── xmlbuilder@9.0.4

MacOS v10.13.2 Node v8.9.4 npm v5.6.0 nmap 7.60