A beginner-friendly Python script for scanning ports on a specified IP address.
This project demonstrates basic cybersecurity and network concepts, such as TCP connections and port discovery.
This port scanner allows you to:
- Input a target IP or hostname.
- Specify a range of ports to scan.
- Determine which ports are open or closed by attempting TCP connections on each port.
Why is this useful?
Port scanning is a fundamental step in network reconnaissance for both ethical hacking and security assessments. By knowing which ports are open on a system, you can identify potential attack vectors or services running on those ports.
- Python 3.x installed on your system.
- A basic understanding of networking concepts is helpful but not mandatory.
-
Clone the Repository
git clone https://github.com/chetflowers/Port-Scanner-Project-with-Kali-and-Python.git cd Port-Scanner-Project-with-Kali-and-Python
-
Run the Script
python3 port_scanner.py
- When prompted, enter the target IP address (e.g.,
192.168.1.27
). - Then provide the starting and ending port numbers (e.g.,
20
to25
).
- When prompted, enter the target IP address (e.g.,
-
Observe the Output
The script will print whether each port in the specified range is OPEN or CLOSED.
-
"ip addr show" command: Verifies the target machine's IP address.
-
Ping command: Verifies the connection between host and target machines.
- Ethical Use Only: Please use this tool responsibly. Scanning ports without permission may violate laws or terms of service.
- You can experiment further by enabling various network services on your target machine (e.g., SSH, FTP, HTTP) and observing the scanner’s output.
- Enhancements to the script can include multithreading for faster scans, banner grabbing to identify running services, and command-line arguments for increased flexibility.
Contributions are welcome! Feel free to open an issue or submit a pull request.
This project is licensed under the MIT License. Please see the LICENSE file for more details.
Author: Chet Flowers
GitHub: chetflowers