Port-Scanner

Basic Port Scanner with Verbose Mode

This Python script is a simple port scanner that can scan all ports, a specific range of ports, or specific ports on a target IP address. It also includes a verbose mode that provides detailed output for each port scanned.

Features


Prerequisites

Before using the script, make sure you have Python 3.x installed on your system.


Installation

  1. Download the script: Save the script as app.py.

  2. Make the script executable (Optional, for Linux/Mac):

    chmod +x app.py
    

Usage

You can use this script via the command line or terminal. The basic syntax is as follows:

python app.py -t <target_ip> -p <ports> [options]

Arguments:

Optional Flags:


Example Commands

1. Scan All Ports with Verbose Output

This command will scan all ports (1-65535) on the target IP 192.168.1.1 and print detailed messages for each port.

python app.py -t 192.168.1.1 -p all -v

Output:

Scanning 192.168.1.1...
[-] Port 1: CLOSED
[-] Port 2: CLOSED
[+] Port 22: OPEN
[+] Port 80: OPEN
...
Open ports on 192.168.1.1: [22, 80, 443]

2. Scan a Specific Range of Ports with Verbose Output

This command will scan ports from 20 to 80 on the target IP 192.168.1.1 and print detailed messages.

python app.py -t 192.168.1.1 -p 20-80 -v

Output:

Scanning 192.168.1.1...
[-] Port 20: CLOSED
[+] Port 22: OPEN
[+] Port 80: OPEN
...
Open ports on 192.168.1.1: [22, 80]

3. Scan Specific Ports without Verbose Output

This command will scan only ports 22, 80, and 443 on the target IP 192.168.1.1 and print only the list of open ports (no verbose output).

python app.py -t 192.168.1.1 -p 22,80,443

Output:

Scanning 192.168.1.1...
Open ports on 192.168.1.1: [22, 80, 443]

How It Works