Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Create checkports.sh

  • Loading branch information...
commit b569b034352fe80ee9be6a77d67535cc9e2f795c 1 parent 4d49a38
Adam authored
Showing with 21 additions and 0 deletions.
  1. +21 −0 checkports.sh
View
21 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()
Please sign in to comment.
Something went wrong with that request. Please try again.