I am trying to create a simple Python script to scan for open ports on a target machine for ethical hacking purposes (I have permission to test this network). My goal is to identify which ports are open using the socket library.
Here’s what I have so far:
python
When I run this script, it sometimes skips open ports or takes a long time to complete. How can I improve this script to make the scan more reliable and faster? Are there better libraries or techniques for port scanning in Python?