#coding:utf8
import os
import socket
import sys
def IsOpen(ip,port):
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
try:
s.connect((ip,int(port)))
s.shutdown(1)
print '%d is open' % port
return True
except:
print '%d is down' % port
return False
if __name__ == '__main__':
mip=sys.argv[1]
mport=sys.argv[2]
print mip,mport
IsOpen(mip,int(mport))
端口扫描-->衍生