Hi, I would like to know why this part of my code doesnt do anything, no error messages!!, why doesnt list me the open ports? what could be the problem?
Thanks
Code:
def port(self):
try:
t = tkSimpleDialog.askstring('INGRESO DE DATOS',
'Ingrese la IP o HOST:',
parent=self.TextBox)
host = t[1]
maxport = int(t[2]) + 1
for port in xrange(1, maxport):
s = socket(AF_INET, SOCK_STREAM)
try:
s.connect((host, port))
self.TextBox.insert(Tkinter.END,"Port %d is open" % port)
except error:
continue
except IndexError:
self.TextBox.insert(Tkinter.END, "Usage: %s <ip address> <max port>" % t[0])
except ValueError:
self.TextBox.insert(Tkinter.END, "Port must be a valid integer")
except Exception, e:
print e