Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
port scanner
#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
  Use Barcode Scanner With Python Extra 2 1,595 Jul-14-2022, 09:52 AM
Last Post: Gribouillis
  is there a way to mention port range or search for port dynamically with qConnection Creepy 0 1,477 Sep-09-2021, 03:15 PM
Last Post: Creepy
  Python BLE Scanner not detecting device alexanderDennisEnviro500 0 2,003 Aug-01-2021, 02:29 AM
Last Post: alexanderDennisEnviro500
  Windows Python Memory Scanner Awesometech 1 21,307 Oct-14-2020, 07:44 AM
Last Post: badengagen
  waiting for barcode scanner output, while main program continues to run lightframe109 3 4,641 Sep-03-2020, 02:19 PM
Last Post: DeaD_EyE
  keyboad scanner routine(linux and windows) 1885 0 1,908 Oct-26-2019, 03:34 PM
Last Post: 1885
  detect when scanner stops darter 1 2,398 Jun-29-2018, 10:07 PM
Last Post: Larz60+
  Brick Scanner Project DarkestShadowsX 2 3,288 Jan-08-2018, 01:36 PM
Last Post: DarkestShadowsX
  Port scanner needs review. RickyWilson 1 2,875 Dec-12-2017, 06:42 AM
Last Post: j.crater
  Need Help To Improve my Network Scanner cybrary 3 3,997 Oct-23-2017, 03:33 PM
Last Post: buran

Forum Jump:

User Panel Messages

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