A simple and efficient TCP port scanner written in Elixir.
- Concurrent port scanning using Elixir's
Task.async_stream - Customizable port range
- Command-line interface (CLI) with escript
- Timeout handling for each port connection
- Configurable concurrency level
- Elixir 1.19.5 or later
- Clone this repository:
git clone https://github.com/wildandhya/port-scanner.git
cd port_scanner- Build the executable:
mix escript.buildThis will create an executable named pscan in the project directory.
./pscan --host <hostname> --start-port <port> --end-port <port>./pscan -h <hostname> -s <start_port> -e <end_port>Scan common ports on localhost:
./pscan -h localhost -s 1 -e 1024Scan full port range:
./pscan -h example.com -s 1 -e 65535Scan specific range:
./pscan -h scanme.nmap.org -s 20 -e 80| Option | Short | Description |
|---|---|---|
--host |
-h |
Target hostname or IP address |
--start-port |
-s |
Starting port number (1-65535) |
--end-port |
-e |
Ending port number (1-65535) |
- Concurrency: 10 concurrent connections (configurable in
lib/port_scanner.ex:42) - Timeout: 500ms per port connection (configurable in
lib/port_scanner.ex:40) - Stream Timeout: 1000ms total timeout for the async stream
- Invalid port range (must be 1-65535)
- Start port must be less than or equal to end port
- Missing required arguments
MIT