Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello, I have created my port scanner as shown in my code below. It has the ability to scan multiple ports, but they are only
Hello, I have created my port scanner as shown in my code below. It has the ability to scan multiple ports, but they are only limited to TCP. if there is anyone who can help me configure it to have UDP scans, please do! I would appreciate
import socket from ipaddress import ip_network import pyfiglet from datetime import datetime banner = pyfiglet.figlet_format("MY PORT SCANNER") print(banner) print("Welcome, this is a simple host scanner developed by Dylan Haddad. Have Fun!") print("Bugs? Questions? Comments? Contact me! =..4@depaul.edu" + " ") print("MyPortScanner v.1.0") print("=======================================================================") final_ports = [] host = input("Enter the IP to your Target:") ##n = int(input("Enter number of ports you want to scan:")) ##for i in range(0, n + 1): ## # ele = int(input()) ## final_ports.append(i) #Uncomment these if you want the input for port to be a range. Example, you want to scan port 25 to 30. Input will be 25 30 lp, hp = input("Enter number of port range you want to scan:").split() for i in range(int(lp), int(hp) + 1): final_ports.append(i) print("-" * 50) print("Scanning Target: " + host) print("Scanning started at:" + str(datetime.now())) print("-" * 50) def MyPortScanner(final_ports): for ip_add in list(ip_network(host).hosts()): for item in final_ports: print(ip_add, item) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.settimeout(1) if s.connect_ex((str(ip_add), item)): print(str(item) + "The port is closed...:(") else: print(str(item) + "The port is open!") s.close() MyPortScanner(final_ports)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started