I am familiar with python although it's been years since I've used it since I have taken more senior roles where my scripting skills have diminished from non-use. I have received the following error and supplied the code in use below. Grateful for any insight shared.
./portscan1.py
File "/home/kali/pythonprograms/scanning/./portscan1.py", line 12 print "Port %d is closed" % (port) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
#! /usr/bin/python
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = "10.10.1.23"
port = 443
def portscanner(port):
if sock.connect_ex((host,port)):
print "Port %d is closed" % (port)
else:
print "Port %d is opened" % (port)
portscanner(port)
I attempted to add parenthesis () as the error output suggested with no luck...