Quick Network Scanner

Rust library for scanning network hosts asynchronously.

Currently only TCP connect scan is supported.

NOTE: you may need to increase the maximum allowed open files. E.g.:

bash ulimit -n 10000

See the library on crates.io.

Usage

Dependencies (Carglo.toml):

bash [dependencies] qscan = "0.2.0" futures = "0.3.21"

and then (src/main.rs):

```rust use qscan::QScanner; use futures::executor::block_on;

pub fn main() { let scanner = QScanner::new( "127.0.0.1,8.8.8.8", "53,443,8000-9000", 2000, 2000, 1); let res = blockon(scanner.scantcp_connect(false));

for sa in &res { println!("{}", sa); } } ```

tcp_cs

The project provides a simple scanner binary called tcp_cs that can be build and used as follow:

bash cargo build --release --features build-binary --bin tcp_cs ./target/release/tcp_cs --ips "8.8.8.8" --ports "1-1000"

Print the help to see all the available options:

```bash ./target/debug/tcp_cs -h qscan 0.2.0 0xor0ne Quick async network scan library

USAGE: tcp_cs [OPTIONS] --ips --ports

OPTIONS: --batch Parallel scan [default: 2500] -h, --help Print help information --ips IP to scan. E.g., '8.8.8.8', '192.168.1.0/24' --nortprint Do not print open ports as soon as they are found --ports Ports to scan for each ip. E.g., '80', '1-1024' --timeout Timeout in ms [default: 2000] --tries #re-tries [default: 1] -V, --version Print version information

```

Docker Image

It's possible to build and use a Docker image configured for running tcp_cs.

NOTE: currently only Linux has been tested for building the Docker image.

Assuming Docker is installed on your machine and configured to run without sudo (if not, see here and here), proceed by building the image:

bash ./scripts/docker_build.sh

Then you can use the 0xor0ne/qscan Docker image for running the scanner:

bash docker run --rm -it 0xor0ne/qscan --ips "8.8.8.8" --ports "1-1024"

Or the same thing using the helper script:

bash ./scripts/docker_run_scan.sh --ips "8.8.8.8" --ports "1-1024"

Docker Image from hub.docker.com

Alternatively, it is possible to download and run a precompiled image from hub.docker.com:

bash docker run --rm 0xor0ne/qscan:latest --ips "8.8.8.8" --ports "1-1024"

Build Docker Image on MacOS (Experimental)

bash rustup target add x86_64-unknown-linux-gnu brew tap SergioBenitez/osxct brew install x86_64-unknown-linux-gnu CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-unknown-linux-gnu-gcc ./scripts/docker_build.sh

Related Projects