Skip to content

Commit

Permalink
port-scanner: updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
iSkore committed May 22, 2020
1 parent 6bbf353 commit b3e96e1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 0 additions & 1 deletion packages/port-scanner/NOTES.md

This file was deleted.

12 changes: 10 additions & 2 deletions packages/port-scanner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,22 @@ port scanner utility

### Usage

*`connectionOpts` is a direct pass in to
[`net.createConnection(<opts>)`](https://nodejs.org/api/net.html#net_socket_connect_options_connectlistener)

```
import PortScanner from '@mi-sec/port-scanner';
const scan = new PortScanner( {
host: '192.168.1.0/24',
ports: [ 22 ],
timeout: 100,
attemptToIdentify: true
timeout: 1000, // optional
debug: false, // optional
onlyReportOpen: true, // optional
bannerGrab: true, // optional
identifyService: true, // optional
attemptToIdentify: true, // optional
connectionOpts: {} // optional*
} );
const data = [];
Expand Down
4 changes: 2 additions & 2 deletions packages/port-scanner/lib/port-scanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class PortScanner extends EventEmitter
Array.isArray( this.opts.ports ) ? this.opts.ports : [ this.opts.ports ] :
[ ...commonPorts.keys() ];

this.opts.timeout = this.opts.timeout || 500;
this.opts.timeout = this.opts.timeout || 1000;

this.opts.debug = this.opts.hasOwnProperty( 'debug' ) ? this.opts.debug : false;
this.opts.onlyReportOpen = this.opts.hasOwnProperty( 'onlyReportOpen' ) ? this.opts.onlyReportOpen : true;
Expand All @@ -273,7 +273,7 @@ class PortScanner extends EventEmitter
!this.opts.debug || console.log( ` debug: ${ this.opts.debug }` );
!this.opts.debug || console.log( ` onlyReportOpen: ${ this.opts.onlyReportOpen }` );
!this.opts.debug || console.log( ` bannerGrab: ${ this.opts.bannerGrab }` );
!this.opts.debug || console.log( ` attemptToIdentify: ${ this.opts.attemptToIdentify }` );
!this.opts.debug || console.log( ` identifyService: ${ this.opts.identifyService }` );

this.result = new LightMap();

Expand Down

0 comments on commit b3e96e1

Please sign in to comment.