Icontem

File: test/scan.js

Recommend this page to a friend!
  Classes of Jason Gerfen  >  Node nmap  >  test/scan.js  >  Download  
File: test/scan.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.14: Fix for .match()
Date: 1 year ago
Size: 907 bytes
 

Contents

Class file image Download
/*!
 * libnmap
 * Copyright(c) 2013-2018 Jason Gerfen <jason.gerfen@gmail.com>
 * License: MIT
 */

'use strict'

const nmap = require('../');
const timeout = 1024 * 1024 * 3;
const chai = require('chai');
const should = chai.should();
const expect = chai.expect;
const opts = {
  range: [
    '127.0.0.1',
    'scanme.nmap.org',
    '::1'
  ],
  ports: '22,135'
};


describe('scan method', function () {

  context('reporting', function () {
    it('json', function (done) {
      this.timeout(timeout);

      nmap.scan(opts, function (err, report) {
        should.not.exist(err);

        report.should.be.a('object');
        done();
      });
    });

    it('xml', function (done) {
      this.timeout(timeout);
      opts.json = false;

      nmap.scan(opts, function (err, report) {
        should.not.exist(err);

        report.should.be.a('object');
        done();
      });
    });
  });
});