From a1203ccb343703ba5ae522254f75b6384a1831a7 Mon Sep 17 00:00:00 2001 From: jerome Date: Mon, 18 Dec 2023 00:02:09 +0100 Subject: =?UTF-8?q?dep=C3=B4t=20initial?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- connect.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 connect.py (limited to 'connect.py') diff --git a/connect.py b/connect.py new file mode 100644 index 0000000..858d82f --- /dev/null +++ b/connect.py @@ -0,0 +1,14 @@ +import sys +host=sys.argv[1] +port=int(sys.argv[2]) + +import socket +s=socket.socket(socket.AF_INET, socket.SOCK_STREAM) +addr_server=(host,port) +tentative=s.connect_ex(addr_server) #connect_ex renvoie 0 en cas de succès... +if tentative==0: + print("port 80 ouvert") +else: + print("Echec de connexion") +s.close() + -- cgit v1.2.3