An open API service indexing awesome lists of open source software.

https://github.com/theleopard65/port-scanner

This is a simple Python script designed to perform a TCP port scan on a specified target. It uses the socket module to establish connections with each port and reports whether each port is open or closed. The script also includes error handling for common exceptions such as host resolution failures and connection errors.
https://github.com/theleopard65/port-scanner

connection exceptional-handlling networking port python-script python3 scanner socket sys tcp

Last synced: 7 months ago
JSON representation

This is a simple Python script designed to perform a TCP port scan on a specified target. It uses the socket module to establish connections with each port and reports whether each port is open or closed. The script also includes error handling for common exceptions such as host resolution failures and connection errors.

Awesome Lists containing this project

README

          

# TCP Port Scanner
This is a simple Python script designed to perform a TCP port scan on a specified target. It uses the `socket` module to establish connections with each port and reports whether each port is open or closed. The script also includes error handling for common exceptions such as host resolution failures and connection errors.

### Usage
```
python3 scanner.py
```
Replace `` with the hostname or IP address of the target to scan. The `` option specifies the type of scan to perform:

- `full`: Scans all ports from 1 to 65535.
- `half`: Scans ports from 1 to 1024.

### Output
The script will display a banner with the target's hostname and IP address, followed by a list of open and closed ports. The output includes the scan type and the ports being scanned.