Port Scanner w/Python

In todays highly connected world, network security is critical. It seems like every other month there is a huge data breach at a huge company. And each breach costs companies hundreds of thousands of dollars. According to a study by IBM Security, the average cost per incident for a company now is $4.24 million. Not to mention that this also hurts a company’s brand image/reputation, so the cost per incident could be a lot higher if you zoom out and take a look longer term.

In todays project, I will be building a port scanner with Python. (Although NMAP is the industry standard for things like this.)

This portion of code is responsible for scanning every single port on the specified target IP address the user has inputted. From 1 to 65535 (which is the maximum amount of ports any machine has.)
This portion of code returns all open ports on the given IP address. 
For Example: upon scanning my laptops IP, I found that Port 53 is open. Port 53 is used for DNS, which converts domain names to IP addresses and IP addresses to domain names.

While scanning my routers IP, I found that Port 53, 80, and 443 were open. Port 53 is DNS, 80 is HTTP, and 443 is HTTPS (the encrypted version of HTTP.)

Leave a Reply

Your email address will not be published. Required fields are marked *