eviltik / evilscan

NodeJS Simple Network Scanner
https://github.com/eviltik/evilscan
MIT License
546 stars 63 forks source link
port-scanner scanner security-scanner security-tools

evilscan

Node.js CI npm version MIT Licence Depfu

Nodejs Simple Network Scanner

Features

Install

npm install -g evilscan

Usage: in your code, using events only

const Evilscan = require('evilscan');

const options = {
    target:'127.0.0.1',
    port:'21-23',
    status:'TROU', // Timeout, Refused, Open, Unreachable
    banner:true
};

const evilscan = new Evilscan(options);

evilscan.on('result',data => {
    // fired when item is matching options
    console.log(data);
});

evilscan.on('error', err => {
    throw new Error(data.toString());
});

evilscan.on('done', () => {
    // finished !
});

evilscan.run();

Usage: in your code, using callback and events

const Evilscan = require('evilscan');

const options = {
    target:'127.0.0.1',
    port:'21-23',
    status:'TROU', // Timeout, Refused, Open, Unreachable
    banner:true
};

new Evilscan(options, (err, scan) => {

    if (err) {
        console.log(err);
        return;
    }

    scan.on('result', data => {
        // fired when item is matching options
        console.log(data);
    });

    scan.on('error', err => {
        throw new Error(data.toString());
    });

    scan.on('done', () => {
        // finished !
    });

    scan.run();
});

Usage: command line

Usage: evilscan <fqdn|ipv4|cidr> [options]

Example:

evilscan 192.168.0.0/24 --port=21-23,80

Options

  --port          port(s) you want to scan, examples:
                  --port=80
                  --port=21,22
                  --port=21,22,23,5900-5902

  --reverse       display DNS reverse lookup

  --reversevalid  only display results having a valid reverse dns, except if
                  ports specified

  --geo           display geoip (free maxmind)

  --banner        display banner

  --bannerlen     set banner length grabing
                  default 512

  --bannerraw     display raw banner (as a JSON Buffer)

  --progress      display progress indicator each seconds

  --status        ports status wanted in results (example --status=OT)
                  T(timeout)
                  R(refused)
                  O(open, default)
                  U(unreachable)

  --scan          scan method
                  tcpconnect (full connect, default)
                  tcpsyn (half opened, not yet implemented)
                  udp (not yet implemented)

  --concurrency   max number of simultaneous socket opened
                  default 500

  --timeout       maximum number of milliseconds before closing the connection
                  default 2000

  --display       display result format (json,xml,console)
                  default console

  --infile        fetch fqdn/ipv4/ipv6 target from a file

  --outfile       dump result in a file

  --json          shortcut for --display=json

  --xml           shortcut for --display=xml

  --console       shortcut for --display=console

  --help          display help

  --about         display about

  --version       display version number

Samples output

Tips :

Concurrency and fast scan

By default, concurrency is 100. Which is slow when you are scanning large ip range or large port range. You can pass a bigger value using --concurrency option. 1000 is fast by example. On some linux, only 1024 opened sockets are allowed in the same time. To break this limit, you have to update ulimit parameter of your linux first :

ulimit -u unlimited

In all cases, due to #25, you will not be able to scan more than 16580355 ipv4 addresses at the moment.

Pause/unpause

You can pause/unpause a running scan by sending SIGUSR2 signal. First time it will pause the process, second time it will unpause it.

kill -SIGUSR2 19859 # where 19859 is the pid of nodejs process running evilscan