import sys
import socket
import pyfiglet


bannerscanner = pyfiglet.figlet_format(".DAVIDxBANNER.   .PORTxSCANNER.")
print(bannerscanner)

#translate to IPv4 in case hostname was input in a foolish way
target = socket.gethostbyname(sys.argv[1])

print("READING TARGET...")
print("*WHIRR*... BEEP...YES")
print("I FIND THE TARGET ACCEPTABLE. PORT MOLESTATION MAY NOW BEGIN.")

#CHECKIN ALL THEM PORTS , quick - stick - n - we skip (to the next one)
for port in range(1,65535):
	s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
	#and so we not hanging forever...
	socket.setdefaulttimeout(1)
	result = s.connect_ex((target,port))
	if result == 0:
		print("PORT {} IS OPEN".format(port))
		s.close()

