]> gitweb.pimeys.fr Git - NK2015_Client_Python_Alpha.git/commitdiff
plouf
authorVincent Le Gallic <legallic@crans.org>
Mon, 20 Feb 2012 23:26:38 +0000 (00:26 +0100)
committerVincent Le Gallic <legallic@crans.org>
Mon, 20 Feb 2012 23:26:38 +0000 (00:26 +0100)
client.py
client_config.py

index 65a62a140d7e557b50291664dc5e8592526985db..de8c71cfc4ceaf487874736f5629c30f7359d6f3 100755 (executable)
--- 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\""
index 26f848f7ba6dddc5ed6f74ff78d08723ca0701b5..a57b59a2d889d840ff977e50077e0d8179d22b61 100644 (file)
@@ -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