Python Forum
question regarding my Python port scanner script
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
question regarding my Python port scanner script
#1
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)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Your p“Timeout !!!!” when I enter a known good IP address when running port scanner James2000k 8 2,815 Aug-06-2022, 10:42 AM
Last Post: Larz60+
  Help with socket library for a port scanner? xanderv 1 2,324 Jan-03-2021, 10:48 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020