Skip to content

wildandhya/pscan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Port Scanner

A simple and efficient TCP port scanner written in Elixir.

Features

  • 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

Requirements

  • Elixir 1.19.5 or later

Installation

  1. Clone this repository:
git clone https://github.com/wildandhya/port-scanner.git
cd port_scanner
  1. Build the executable:
mix escript.build

This will create an executable named pscan in the project directory.

Usage

Basic Usage

./pscan --host <hostname> --start-port <port> --end-port <port>

Short Options

./pscan -h <hostname> -s <start_port> -e <end_port>

Examples

Scan common ports on localhost:

./pscan -h localhost -s 1 -e 1024

Scan full port range:

./pscan -h example.com -s 1 -e 65535

Scan specific range:

./pscan -h scanme.nmap.org -s 20 -e 80

Options

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)

Configuration

  • 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

Error Handling

  • Invalid port range (must be 1-65535)
  • Start port must be less than or equal to end port
  • Missing required arguments

License

MIT

About

port scanner

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages