Feb-01-2022, 12:24 PM
Hi, I am learning about cybersecurity and networking by following this Youtube video. For this project I am making a simple port scanner. However, when I went to run my Python script using an IP address on a website that I created it shows all ports are open. But this is not the case, because only port 80 (http) and port 443 (https) should be open, and the rest should be close. But I am not sure why it's showing up as all "Open". Is there something wrong with my code or is this simply a back-end server issue?
#port_scanner import socket from IPy import IP def scan_port(ipaddress, port): try: sock = socket.socket() sock.settimeout(0.5) sock.connect((ipaddress, port)) print('[+] Port' + str(port) + ' is Open') except: print('[-] Port' + str(port) + ' is Closed') ipaddress = input('[+] Enter Target to Scan: ') for port in range(75, 85): scan_port(ipaddress, port)