Python Port Scanner

Sebenarnya susah banyak seh port scanner yang beredar seperti nmap , dan beberapa tool berbasis GUI , cuman sekedar mau share aja mungkin berguna :) , source nya masih dasar bgt mungkin perlu banyak perbaikan

#!/usr/bin/env python
#######################
# Python Port Scanner #
# By : kuc3ng         #
# www.kucing.asia     #
#######################

import socket, sys

# set timeout , sesuaikan dengan koneksi dan server target
timeout = 3
hasil = 0

def scan_server(address, port):
    s = socket.socket()
    s.settimeout(timeout)
    try:
	global hasil
        s.connect((address, port))
   	print "Port %s is Open  <-- W00t " %(port)
	hasil = 1
        return True
    except socket.error, e:
	return False
    s.close()

try :
	host = sys.argv[1]
	awal = int(sys.argv[2])
	akhir = int(sys.argv[3])
	print "Scanning...."
	for nport in range(awal, akhir+1):
			scan_server(host,nport)
	if hasil == 0 :
		print "Nothing Found"
except:
	print "Usage portscan.py <host> <port_awal> <port_akhir>"
	sys.exit(1)