>>> import socket
>>> def isOpen(ip,port):
... s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
... try:
... s.connect((ip, int(port)))
... s.shutdown(2)
... return True
... except:
... return False
...
>>> isOpen('atotclic.es',443)
True
>>> isOpen('atotclic.es',444)
False
Check open ports with python
Categorías: