Skip to content
项目

关于

Build & leverage nmap as a node.js module, no need to install an nmap binary.

系统与基础设施

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

libnmap

Build & leverage nmap as a node.js module, no need to install an nmap binary.

npm CI Downloads Known Vulnerabilities

install

npm install libnmap

To install npm install libnmap

The install gets the nmap and OpenSSL sources and compiles them. See build tools for details.

Some package managers (pnpm, yarn, bun, and npm with ignore-scripts) do not run install scripts unless you allow them. If a scan gives the error "the nmap module is not compiled", allow the install script of libnmap and run npm rebuild libnmap.

build tools

Example package requirements.

Debian, Ubuntu (apt)
sudo apt-get install build-essential perl python3 nodejs npm
Fedora, RHEL, CentOS, Rocky, AlmaLinux (dnf)
sudo dnf install gcc gcc-c++ make perl python3 diffutils tar nodejs npm
openSUSE (zypper)
sudo zypper install gcc gcc-c++ make perl python3 nodejs npm
Arch Linux, Manjaro (pacman)
sudo pacman -S --needed base-devel perl python nodejs npm
Gentoo (emerge)
sudo emerge --ask dev-lang/perl dev-lang/python net-libs/nodejs

The compiler and make are part of the base system.

Alpine (apk)
sudo apk add build-base linux-headers perl python3 nodejs npm
macOS
xcode-select --install
brew install node

The Xcode command line tools supply the compiler, make, perl and python3.

methods

  • scan Scans the ports of each host in the range
  • discover Finds the neighbors on the IPv4 network of each network interface

options

  • range {Array} Hostnames, IPv4/IPv6 addresses, CIDR or address ranges
  • ports {String} Ports to scan (default 1-1024)
  • timeout {Number} Number of seconds to wait for each host (default 120)
  • flags {Array} More nmap flags (default -T4)
  • udp {Boolean} Scan UDP ports (requires root)
  • json {Boolean} JSON object as output (default), false produces XML

examples

More examples are in the examples/ folder.

scan

scan report

const nmap = require('libnmap');
const opts = {
  range: [
    'scanme.nmap.org',
    '10.0.2.0/25',
    '192.168.10.80-120',
    'fe80::42:acff:fe11:fd4e/64'
  ],
  ports: '22,80,443'
};

nmap.scan(opts, function(err, report) {
  if (err) throw err;

  console.log(JSON.stringify(report, null, 2));
});

discover

discover report

const nmap = require('libnmap');

nmap.discover(function(err, report) {
  if (err) throw err;

  console.log(JSON.stringify(report, null, 2));
});

tests

To test npm test

license

This software is licensed under the Nmap Public Source License, the same license as nmap. See LICENSE.

Copyright Jason Gerfen, 2013.

探索相关项目

加载中…