A simple, fast, and concurrent port scanner written in Rust using Tokio for asynchronous networking.
- Scan individual IP addresses or CIDR ranges
- Concurrent scanning for maximum performance
- Customizable port ranges
- Clear terminal output with color formatting
# Clone the repository
git clone https://github.com/NabilKara/Simple_Rust_port_scanner.git
cd rust-port-scanner
# Build the project
cargo build --releaseThis project depends on:
clap- Command-line argument parsingtokio- Asynchronous runtimecolored- Terminal text coloringcidr- CIDR notation handling
# Scan a single IP address
./port-scanner 192.168.1.1 --port-start 1 --port-end 1000
# Scan a CIDR range
./port-scanner --cidr 192.168.1.0/24 --port-start 80 --port-end 443addr: Target IP address (required unless--cidris specified)--cidr: Target network in CIDR notation (conflicts withaddr)--port-start: Starting port number (default: 1)--port-end: Ending port number (default: 1024)
Scan common ports on a single host:
./port-scanner 192.168.1.1 --port-start 20 --port-end 100Scan a specific port across a network:
./port-scanner --cidr 10.0.0.0/24 --port-start 80 --port-end 81The scanner works by spawning a Tokio task for each port and target combination. Each task attempts to establish a TCP connection to the target port. If the connection succeeds, the port is marked as open.
MIT