#port-scan #scan #service-discovery #cross-platform #security #networking #cli

app nscan

Cross-platform network scan tool for host and service discovery

17 releases (10 breaking)

0.18.0 Dec 24, 2023
0.16.0 Oct 24, 2023
0.15.0 Oct 16, 2023
0.10.3 Jul 16, 2023
0.6.0 Jun 27, 2021

#957 in Network programming

Download history 6/week @ 2023-12-24 6/week @ 2024-02-11 79/week @ 2024-02-18 31/week @ 2024-02-25 2/week @ 2024-03-10 99/week @ 2024-03-31

101 downloads per month

MIT license

1MB
3K SLoC

nscan Crates.io License

Cross-platform network scan tool for host and service discovery.
Aim to be simple and fast.

Features

  • Port Scan
  • Host Scan
  • Service detection
  • OS detection

Installation

Releases

You can download archives of precompiled binaries from the releases .

Cargo Install

cargo install nscan

Basic Usage

USAGE:
    nscan [OPTIONS]

OPTIONS:
    -p, --port <target>                 Scan ports of the specified host.
                                        Use default port list if port range omitted.
                                        Examples:
                                        --port 192.168.1.8 -S -O
                                        --port 192.168.1.8:1-1000
                                        --port 192.168.1.8:22,80,8080
                                        --port 192.168.1.8 -l custom-list.txt
    -n, --host <target>                 Scan hosts in specified network or host-list.
                                        Examples:
                                        --host 192.168.1.0
                                        --host 192.168.1.0/24
                                        --host custom-list.txt
                                        --host 192.168.1.10,192.168.1.20,192.168.1.30
    -e, --interfaces                    List network interfaces
    -i, --interface <interface_name>    Specify the network interface
    -s, --source <ip_addr>              Specify the source IP address
    -P, --protocol <protocol>           Specify the protocol
    -T, --scantype <scantype>           Specify the scan-type
    -t, --timeout <duration>            Set timeout in ms - Example: -t 10000
    -w, --waittime <duration>           Set wait-time in ms (default:100ms) - Example: -w 200
    -r, --rate <duration>               Set send-rate in ms - Example: -r 1
    -R, --random                        Don't randomize targets. By default, nscan randomizes the
                                        order of targets.
    -c, --count <count>                 Set number of requests or pings to be sent
    -S, --service                       Enable service detection
    -A, --async                         Perform asynchronous scan
    -l, --list <file_path>              Use list - Example: -l custom-list.txt
    -W, --wellknown                     Use well-known ports
    -j, --json                          Displays results in JSON format.
    -o, --save <file_path>              Save scan result in json format - Example: -o result.json
        --acceptinvalidcerts            Accept invalid certs (This introduces significant
                                        vulnerabilities)
    -h, --help                          Print help information
    -V, --version                       Print version information

Supported platforms

  • Linux
  • macOS
  • Windows

Privileges

nscan uses a raw socket which require elevated privileges. Execute with administrator privileges.

Note for Windows Users

If you are using Windows, please consider the following points before building and running the application:

  • Npcap or WinPcap Installation:
    • Ensure that you have Npcap or WinPcap installed on your system.
    • If using Npcap, make sure to install it with the "Install Npcap in WinPcap API-compatible Mode" option.
  • Build Dependencies:
    • Place the Packet.lib file from the Npcap SDK or WinPcap Developers pack in a directory named lib at the root of this repository.
    • You can use any of the locations listed in the %LIB% or $Env:LIB environment variables.
    • For the 64-bit toolchain, the Packet.lib is located in /Lib/x64/Packet.lib.
    • For the 32-bit toolchain, the Packet.lib is located in /Lib/Packet.lib.

This tool also serves as a test for my following projects.

  • default-net Cross-platform library for network interface and gateway
  • netscan Cross-platform network scan library
  • xenet Cross-platform networking library

Dependencies

~20–55MB
~875K SLoC