Skip to content

Commit

Permalink
Create checkports.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam committed Jan 23, 2013
1 parent 4d49a38 commit b569b03
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions checkports.sh
@@ -0,0 +1,21 @@
#!/usr/bin/python

import socket
import sys

if ( len(sys.argv) != 2 ):
print "Usage: " + sys.argv[0] + " you must enter IP or FQDN"
sys.exit(1)

remote_host = sys.argv[1]

for remote_port in [22,80,8080,993]:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(60)
try:
sock.connect((remote_host, remote_port))
except Exception,e:
print "%d closed " % remote_port
else:
print "%d open" % remote_port
sock.close()

0 comments on commit b569b03

Please sign in to comment.