Port-Scanner

Advanced Port Scanner

A powerful and efficient Python-based port scanner that supports concurrent scanning, service detection, and customizable scanning options.

Features

Installation

  1. Clone the repository:
    git clone https://github.com/yourusername/port-scanner.git
    cd port-scanner
    
  2. Install the required dependencies:
    pip install colorama
    

Usage

Basic usage:

python app.py -t <target_ip> -p <ports>

Command Line Arguments

Argument Description Example
-t, --target Target IP address (required) -t 192.168.1.1
-p, --ports Ports to scan (required) -p common
-v, --verbose Enable verbose output -v
-w, --workers Maximum number of concurrent workers (default: 100) -w 200
-to, --timeout Connection timeout in seconds (default: 1.0) -to 2.0

Port Range Options

The -p argument accepts several formats:

  1. Preset Port Ranges:
    • common: Most commonly used ports (21, 22, 23, 25, 53, 80, 110, 143, 443, 445, 3306, 3389, 5432, 8080)
    • web: Web server ports (80, 443, 8080, 8443)
    • database: Database server ports (1433, 1521, 3306, 5432, 27017)
    • mail: Email server ports (25, 110, 143, 465, 587, 993, 995)
    • remote: Remote access ports (22, 23, 3389, 5900)
  2. Custom Range:
    • start-end: Scan ports from start to end (inclusive)
    • Example: -p 80-100
  3. Specific Ports:
    • Comma-separated list of ports
    • Example: -p 80,443,8080
  4. All Ports:
    • all: Scan all ports (1-65535)

Examples

  1. Scan common ports on a target:
    python app.py -t 192.168.1.1 -p common
    
  2. Scan web ports with verbose output:
    python app.py -t 192.168.1.1 -p web -v
    
  3. Scan custom range with more workers and longer timeout:
    python app.py -t 192.168.1.1 -p 80-100 -w 200 -to 2.0
    
  4. Scan specific ports:
    python app.py -t 192.168.1.1 -p 80,443,8080
    

Output Format

The scanner provides color-coded output:

Example output:

Scanning 192.168.1.1...
Total ports to scan: 14
Progress: 100.0% (14/14)

Open ports on 192.168.1.1:
[+] Port 80: OPEN - http
[+] Port 443: OPEN - https

Error Handling

The scanner includes comprehensive error handling for:

Requirements

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Security Note

This tool is intended for legitimate network testing and security assessment purposes only. Always ensure you have proper authorization before scanning any network or system.