In this article, we will learn how to program a port scanner using the ‘
nmap‘ module in Python. The program will take a range of port numbers as input and print the state (open or closed) of all the ports in that range.
Nmap: Nmap is a free and open-source network scanning tool. To run the program discussed in this article, you will need to have ‘nmap’ tool installed in your system. If it is not installed, visit Nmap download page.
We will be using the ‘
python-nmap‘ module to achieve this task. Install the package (if not already installed) by the following command –
pip install python-nmap
Note: Doing ‘nmap’ scans on a target without proper permission and authority is illegal. Use localhost (127.0.0.1) as your target
port 75 is closed. port 76 is closed. port 77 is closed. port 78 is closed. port 79 is closed. port 80 is open.
Note: The output can vary depending on the present status of the ports.
- Simple Port Scanner using Sockets in Python
- Threaded Port Scanner using Sockets in Python
- Port Scanner using Python
- Python - Simple Port Scanner with Sockets
- Network Scanner in Python
- Python | Create video using multiple images using OpenCV
- Python | Create a stopwatch using clock object in kivy using .kv file
- Circular (Oval like) button using canvas in kivy (using .kv file)
- Image resizing using Seam carving using OpenCV in Python
- Send mail from your Gmail account using Python
- Cartooning an Image using OpenCV - Python
- Using Iterations in Python Effectively
- Create a Website Alarm Using Python
- Whatsapp using Python!
- Downloading files from web using Python
- Mouse and keyboard automation using Python
- GET and POST requests using Python
- Real-Time Edge Detection using OpenCV in Python | Canny edge detection method
- Twitter Sentiment Analysis using Python
- Formatted text in Linux Terminal using Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.