npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-nmap-vulners

v1.0.2

Published

Interfaces with locally installed NMAP and Vulners script

Downloads

9

Readme

Node-NMAP-Vulners

NPM package enabling your [NodeJs] application to interface with the features of [NMAP].
This package requires that [NMAP] is installed and available to the running node application. If [VULNERS] script is installed, this package is able to parse the output to [NodeJs].

UPDATE 1.0.2

  • Edited README.MD

UPDATE 1.0.1

  • Improved Service and Vulnerabilities integration

UPDATE 1.0.0 (Tommaso Pezzi)

  • Forked the [node-nmap] NPM package to read and parse the Vulners script output.
    • Vulners.nse must be installed.(https://github.com/vulnersCom/nmap-vulners)

Installation

npm install node-nmap-vulners

Scan Types

  • NmapScan - This is the core of the package and runs the NMAP command.

Scan instance variables, methods, and events

  • scanResults : Array of host objects - contains the results of the scan.
  • scanTime : number in ms - duration of scan.
  • scanTimeout : number in ms - scan will cancel if timeout is reached.
  • startScan() - begins the NMAP scan.
  • cancelScan() - kills the NMAP process.
  • 'complete' : event - returns array of host objects
  • 'error' : event - returns string with error information

Usage

NmapScan is the core function of the package. It emits two events: 'complete' and 'error'. Both of these events return data. All methods are easy to set up. Simply define a variable as one of the methods, and that variable will become a new instance of NmapScan with appropriately set commands. All input accepts either a space separated string, or an array of strings to make it easier to work with a complex set of hosts. All methods return an array of JSON objects containing information on each host. Any key without information provided from NMAP is filled as null.

The return structure is:

[  
    {  
       "hostname":"theHostname",
       "ip":"127.0.0.1",
       "mac":null,
       "openPorts":[  
          {  
             "port":80,
             "service":"http"
	     "vulners":[
  			'CVE-2011-4130',
  			'CVE-2010-3867',
  			'CVE-2010-4652',
  			'CVE-2009-0543',
			]
          },...  
        ],
       "osNmap":null, //note that osNmap is not guaranteed to be correct.
    },...]

Examples

var nmap = require('node-nmap');

nmap.nmapLocation = "nmap"; //default

//    Accepts array or comma separarted string for custom nmap commands in the second argument.
var nmapscan = new nmap.NmapScan('127.0.0.1 google.com', '-sn');

nmapscan.on('complete',function(data){
  console.log(data);
});
nmapscan.on('error', function(error){
  console.log(error);
});

nmapscan.startScan();

// returns
// [  
//    {  
//       "hostname":"localhost",
//       "ip":"127.0.0.1",
//       "mac":null,
//       "openPorts":[  

//       ],
//       "osNmap":null
//    },
//    {  
//       "hostname":"google.com",
//       "ip":"74.125.21.113",
//       "mac":null,
//       "openPorts":[  
//			"vulners":[
// 					'CVE-2011-4130',
//  					'CVE-2010-3867',
//  					'CVE-2010-4652',
//  					'CVE-2009-0543',
//				]
//       ],
//       "osNmap":null
//    }
// ]

//    Accepts array or comma separarted string for nmap vulners script.
var nmapscan = new nmap.NmapScan('127.0.0.1 --script vulners');

nmapscan.on('complete',function(data){
  console.log(data);
});
nmapscan.on('error', function(error){
  console.log(error);
});

nmapscan.startScan();

// returns
// [  
//    {  
//       "hostname":"localhost",
//       "ip":"127.0.0.1",
//       "mac":null,
//       "openPorts":[  
//			"vulners":[
//  					'CVE-2011-4130',
//  					'CVE-2010-3867',
//  					'CVE-2010-4652',
//  					'CVE-2009-0543',
//				],
//       ],
//       "osNmap":null
//    },
//    {  
//       "hostname":"google.com",
//       "ip":"74.125.21.113",
//       "mac":null,
//       "openPorts":[  

//       ],
//       "osNmap":null
//    }
// ]

Please open an issue if you have any questions, concerns, bugs, or critiques.

[NMAP]: <https://nmap.org/>
[NPM]: <https://www.npmjs.com/package/node-nmap-vulners>
[NodeJs]: <https://nodejs.org/en/>