File: examples/accuracy.js

Recommend this page to a friend!
  Classes of Jason Gerfen  >  Node nmap  >  examples/accuracy.js  >  Download  
File: examples/accuracy.js
Role: Example script
Content type: text/plain
Description: Example script
Class: Node nmap
Scan a network for computers using nmap
Author: By
Last change: v0.4.17: Fix for examples regarding seconds to minutes math
v0.4.17: Version bump; dependencies, timeout docs & copywright
Date: 1 year ago
Size: 826 bytes


Class file image Download
 * libnmap
 * Copyright(c) 2013-2019 Jason Gerfen <>
 * License: MIT

'use strict'

const nmap = require('../');
const opts = {
  timeout: 900, // 900s = 15m and increases the reliability of scan results
  flags: [
    '-T0', // Paranoid scan type; very slow but accurate
    '--max-retries 10', // Don't give up on slow responding hosts
    '--ttl 200ms', // Accomodate for slow connections by setting the packets TTL value higher
    '--scan-delay 10s', // Account for host 'rate limiting'
    '--max-rate 30', // Slows down packet spewing to account for IDS protections
  range: ['', ''],

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

  for (let item in report) {
    console.log(JSON.stringify(report[item], null, 2));