#!/usr/bin/python3
import socket
ip = input('Enter the IP address: ')
port = input('Enter the Port: ')
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if s.connect_ex((ip,port)):
print ('Port', port, 'is closed')
else:
print ('Port', port, 'is open')
As you can see, it is a very simply port scanner that I have attempted to run (currently learning some Penetration Testing).
This is the error I get:
Traceback (most recent call last):
File "./python.py", line 9, in <module>
if s.connect_ex((ip,port)):
TypeError: an integer is required (got type str)
I assume that I need to set line 9 as an integer - how do I do this?
Cheers in advance.