From d621c5224a44dc20bc2aaf661954fd1df65dd147 Mon Sep 17 00:00:00 2001 From: Vincent Le Gallic Date: Tue, 21 Feb 2012 00:26:38 +0100 Subject: [PATCH] plouf --- client.py | 18 ++++++++++-------- client_config.py | 5 +---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/client.py b/client.py index 65a62a1..de8c71c 100755 --- a/client.py +++ b/client.py @@ -19,12 +19,13 @@ from pprint import pprint sys.path.append(client_config.rsa_path) import monRSA -def connect(sock,where="ici"): - port=client_config.port - ip={"ici":"localhost","vent":"vent.crans.org","eva":"eva.crans.org"}[where] +def connect(sock,where="cerebro",port=None): + if port==None: + port=client_config.port + ip={"ici":"localhost","vent":"vent.crans.org","eva":"eva.crans.org","cerebro":"cerebro.crans.org"}[where] sock.connect((ip,port)) - return ssl.wrap_socket(sock,ca_certs=client_config.ca_certfile, - cert_reqs=ssl.CERT_OPTIONAL,ciphers="AES256-SHA") + return ssl.wrap_socket(sock,ca_certs=client_config.ca_certfile) +# cert_reqs=ssl.CERT_NONE,ciphers="AES256-SHA") def checkidentity(a): c=a.getpeercert() @@ -92,10 +93,11 @@ def challenge(a): print "Imposteur !" if __name__=="__main__": + #port=int(raw_input("port ? ")) a=socket.socket() - a=connect(a) - a.settimeout(0.5) - checkidentity(a) + a=connect(a,"cerebro") + a.settimeout(2) + #checkidentity(a) print hello(a,"Python Client alpha") print login(a,"20-100","mdp") print "Socket créée dans la variable \"a\"" diff --git a/client_config.py b/client_config.py index 26f848f..a57b59a 100644 --- a/client_config.py +++ b/client_config.py @@ -8,7 +8,4 @@ server_rsa_pub_key = clientdir + "keys/server_rsa_key.pub" # le module qui fait du rsa rsa_path = "/usr/scripts/Note_Kfet_2015/rsa_source/" -# parce que le port est pour l'instant aléatoire, ça disparaîtra après -portfile=open(basedir+"serveur/port.txt","r") -port = int(portfile.read()) -portfile.close() +port = 4242 -- 2.39.2