From f5308e509f855cf78a1e1e2f5c4bf2e0f8b662d7 Mon Sep 17 00:00:00 2001 From: Nasir Hussain Date: Dec 18 2019 00:52:22 +0000 Subject: First Commit --- diff --git a/main.py b/main.py new file mode 100644 index 0000000..4e3eb50 --- /dev/null +++ b/main.py @@ -0,0 +1,16 @@ +import socket + +host = str(input("Enter host to scan: ")) +ip = socket.gethostbyname(host) +print(ip) +try: + port = int(input("Enter port: ")) + try: + sock = socket.socket() + res = sock.connect((ip, port)) + print("Port {}: Open".format(port)) + sock.close() + except: + print("Port {}: Closed".format(port)) +except ValueError: + print("please enter a valid port.") \ No newline at end of file