VOOZH about

URL: https://www.geeksforgeeks.org/python/threaded-port-scanner-using-sockets-in-python/

⇱ Threaded Port Scanner using Sockets in Python - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Threaded Port Scanner using Sockets in Python

Last Updated : 28 Aug, 2020

Port scanning can be really slow yet, in most cases, is not process intensive. Thus, we can use threading to improve our speed. There can be thousands of possible ports. If it takes 5-15 seconds per port to scan, then we might have a long wait ahead of us without the use of threading.

Threading

Threading is a complex topic, but it can be broken down and conceptualized as a methodology where we can tell the computer to do another task if the processor is experiencing idle time. In the case of port scanning, we are spending a lot of time just waiting on the response from the server. While we are waiting, we can do something else. That is what threading is used for. 

Example: In this program, we can scan a number of ports in a certain range.

Output: 

port is close 2
port is close port is close 4
port is closeport is close 1
 53

port is close 6port is close
 7
port is close 8
port is close 9
Comment
Article Tags: