Hi,
Can any one please suggest me commands for making port scan shell script.
Hi,
Can any one please suggest me commands for making port scan shell script.
port scan is not usually a good thing , why do you need this ?
Hi,
I need this for monitoring the server ports. If any of the port seems to be down then send the alert using mail or message
I got this little script from Ghostdog74 from our forum, modified it a bit to suit my needs :
#!/usr/bin/python
import socket
import sys
if ( len(sys.argv) != 2 ):
print "Usage: " + sys.argv[0] + " you must enter IP or FQDN as argument"
sys.exit(1)
remote_host = sys.argv[1]
for remote_port in [21,22,23,80,139,139,389,443,445,3128,3306,3389]:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(20)
try:
sock.connect((remote_host, remote_port))
except Exception,e:
print "%d closed " % remote_port
else:
print "%d open" % remote_port
sock.close()