New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

node-nmap-hosts

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-nmap-hosts

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

Node Nmap Hosts

This Node.js module provides a simple interface to run detailed nmap scans on a given IP range or specific IP and returns structured host information.

Installation

npm install node-nmap-hosts

yarn add node-nmap-hosts

Usage

import { runNmapScan } from "./runNmap";
import { writeFileSync } from 'fs';

runNmapScan('192.168.1.1/24', [22, 80, 443, 8080])
    .then(data => {
        console.log("Nmap Scan Data:", data);

    })
    .catch(error => {
        console.error("Error during Nmap Scan:", error);
    });

runNmapScan

runNmapScan(target: string, ports: number[]): Promise<HostInfo[]>

Runs a detailed nmap scan on a given IP range or specific IP and returns structured host information.

target: The target IP range or specific IP for the nmap scan.

ports: Array of ports to scan.

Returns a Promise that resolves with a detailed list of host information.

HostInfo

The HostInfo interface represents the structured information about a host.

interface HostInfo { 
	ip: string;
	mac?: string;
	vendor?: string;
	hostname?: string;
	ports: { 
		port: number;
		state: string;
		serviceName?: string;
		serviceProduct?: string;
	}[];
	os?: string;
}

Dependencies

This module requires nmap to be installed on the system where it's being used. You can download nmap from here: https://nmap.org/download.html.

This module depends on the following packages:

child_process: Used to execute the nmap command.

xml2js: Used to parse the XML output of the nmap command.

License - Apache 2.0

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Keywords

nmap

FAQs

Package last updated on 31 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts