Skip to content

Commit

Permalink
v0.4.14: Fix for .match()
Browse files Browse the repository at this point in the history
  • Loading branch information
jas- committed Sep 16, 2018
1 parent f515153 commit 6e79738
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/classes/validation.js
Expand Up @@ -131,7 +131,7 @@ class validation {
errors.push(new Error(scope.messages.port));

if (opts.ports) {
result = scope.patterns.ports.match(opts.ports).join(",");
result = opts.ports.match(scope.patterns.ports).join(",");
if (result == "")
return cb(scope.messages.port);
}
Expand Down
19 changes: 11 additions & 8 deletions test/discover.js
Expand Up @@ -7,35 +7,38 @@
'use strict'

const nmap = require('../');
const timeout = 1024 * 1024;
const timeout = 1024 * 1024 * 3;
const chai = require('chai');
const should = chai.should();
const expect = chai.expect;
const ifaces = require('os').networkInterfaces();

describe('nmap', function() {
context('discovery method', function() {
describe('nmap', function () {
context('discovery method', function () {

this.timeout(timeout);

it('validate report', function(done) {
it('validate report', function (done) {

nmap.discover(function(err, report) {
nmap.discover(function (err, report) {

/* If 'subnet' doesn't exist in os.networkInterfaces() expect errors */
for (let adapter in ifaces) {
if (!ifaces[adapter][0].internal) {
if (!ifaces[adapter][0].hasOwnProperty('subnet')) {
try {
done();
} catch(error) {
}
catch (error) {
done(error);
}
} else {
}
else {
try {
should.not.exist(err);
should.exist(report);
} catch(error) {
}
catch (error) {
done(error);
}
}
Expand Down
14 changes: 7 additions & 7 deletions test/scan.js
Expand Up @@ -7,7 +7,7 @@
'use strict'

const nmap = require('../');
const timeout = 1024 * 1024;
const timeout = 1024 * 1024 * 3;
const chai = require('chai');
const should = chai.should();
const expect = chai.expect;
Expand All @@ -21,25 +21,25 @@ const opts = {
};


describe('scan method', function() {
describe('scan method', function () {

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

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

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

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

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

report.should.be.a('object');
Expand Down

0 comments on commit 6e79738

Please sign in to comment.