Skip to content

Instantly share code, notes, and snippets.

@kkirsche
Created August 7, 2016 12:00
Show Gist options
  • Select an option

  • Save kkirsche/354e491d85810e0467eaf8d0da40d8ef to your computer and use it in GitHub Desktop.

Select an option

Save kkirsche/354e491d85810e0467eaf8d0da40d8ef to your computer and use it in GitHub Desktop.
Python Port Checker — Detect a port opening
import socket;
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
openPort = False
while openPort == False:
result = sock.connect_ex(('10.10.10.136', 20))
if result == 0:
openPort = True
print 'FTP Port is open'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment