#!/usr/bin/python
import socket
import sys
try:
HOST=sys.argv[1]
except:
HOST='127.0.0.1'
PORTS=[8, 21, 22, 23, 80, 135, 139, 445, 8080]
for PORT in PORTS:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.connect((HOST, PORT))
print "%s:%s is open!" % (HOST, PORT)
except:
print "%s:%s is close!" % (HOST, PORT)
s.close()
No comments:
Post a Comment