#!/usr/bin/python

import socket

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

host = raw_input( "[*] host: " )
port = int(raw_input( "[*] port: " ))

def portscanner(port):
	if sock.connect_ex((host, port)):
		print 'Port %d is closed' % (port)
	else:
		print 'Port %d is open' % (port)
portscanner(port)

6cd37f0c481cdfa1ca2e4c8fcc3bdb7a26f4cb30
#!/usr/bin/python

import socket

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

host = raw_input( "[*] host: " )
port = int(raw_input( "[*] port: " ))

def portscanner(port):
	if sock.connect_ex((host, port)):
		print 'Port %d is closed' % (port)
	else:
		print 'Port %d is open' % (port)
portscanner(port)
