Compare commits

...

8 Commits

Author SHA1 Message Date
Jérémi N ‘EndMove’
d3b82db6b0 Merge pull request 'Merge oublié' (#1) from dev into main
Reviewed-on: #1
2022-08-09 10:20:11 +00:00
d0e4fdbf6c
Update with the good username 2022-03-15 09:56:35 +01:00
c44aa83c64
Default TLS//SSL enabled 2022-03-10 14:43:35 +01:00
Maximilien LEDOUX
d687732fad TLS : Changement hôte par défaut 2022-03-10 14:22:34 +01:00
Maximilien LEDOUX
9e2e2d7aa4 Merge branch 'dev' into maximilien 2022-03-10 13:51:45 +01:00
Maximilien LEDOUX
63772e7d11 TLS : Ajout fichier clés 2022-03-08 16:30:16 +01:00
ba002a4392
Add default login value 2022-03-05 15:05:52 +01:00
78196f209c
Update Python client (fix bugs) 2022-02-26 18:26:12 +01:00
3 changed files with 18 additions and 5 deletions

View File

@ -3,6 +3,7 @@ from model.Protocol import *
import traceback import traceback
import os.path import os.path
class AppController: class AppController:
def __init__(self, parser): def __init__(self, parser):
self.parser = parser self.parser = parser
@ -19,8 +20,8 @@ class AppController:
print("[AppController::on_sign]") print("[AppController::on_sign]")
try: try:
if not self.connection.is_connected: if not self.connection.is_connected:
print("[AppController::on_sign] connecting ... calling UnicastConnection::connect") print("[AppController::on_sign] connecting ... calling UnicastConnection::connect")
self.connect(host, port, tls) self.connect(host, port, tls)
if not register: if not register:
message = self.parser.build_SIGNIN(login, passw) message = self.parser.build_SIGNIN(login, passw)
else: else:
@ -31,9 +32,10 @@ class AppController:
if message_id == Protocol.PARSE_SIGNOK: if message_id == Protocol.PARSE_SIGNOK:
self.window_controller.switch_connected_mode() self.window_controller.switch_connected_mode()
self.show_message("Connection done", False) self.show_message("Connection done", False)
self.on_filelist()
elif message_id == Protocol.PARSE_SIGNERROR: elif message_id == Protocol.PARSE_SIGNERROR:
self.show_message("Error during SIGN_IN / SIGN_UP", True) self.show_message("Error during SIGN_IN / SIGN_UP", True)
self.on_filelist() self.connection.close()
except Exception as ex: except Exception as ex:
print(ex) print(ex)
traceback.print_exc() traceback.print_exc()
@ -41,7 +43,7 @@ class AppController:
def get_filename_size_from_item(self, item): def get_filename_size_from_item(self, item):
tokens = item.split('!') tokens = item.split('!')
if len(tokens) == 2: if len(tokens) == 2:
return (tokens[0],tokens[1]) return (tokens[0], tokens[1])
else: else:
return None return None
@ -117,7 +119,7 @@ class AppController:
elif message_id == Protocol.PARSE_REMOVEFILEERROR: elif message_id == Protocol.PARSE_REMOVEFILEERROR:
self.show_message("Error while erasing file.", True) self.show_message("Error while erasing file.", True)
def show_message(self,message, is_error): def show_message(self, message, is_error):
self.window_controller.show_message(message, is_error) self.window_controller.show_message(message, is_error)
def connect(self, host, port, tls): def connect(self, host, port, tls):

View File

@ -11,10 +11,15 @@ class MainWindow:
self.root.title("SecCon - © Louis SWINNEN 2022") self.root.title("SecCon - © Louis SWINNEN 2022")
self.root.config(bd=5) self.root.config(bd=5)
self.host = tk.StringVar() self.host = tk.StringVar()
self.host.set("ffe.labo.swilabus.com")
self.passw = tk.StringVar() self.passw = tk.StringVar()
self.passw.set("aaaaa")
self.login = tk.StringVar() self.login = tk.StringVar()
self.login.set("aaaaa")
self.tls = tk.BooleanVar() self.tls = tk.BooleanVar()
self.tls.set(True)
self.port = tk.IntVar() self.port = tk.IntVar()
self.port.set(8000)
self.draw_window() self.draw_window()
def start_main_loop(self): def start_main_loop(self):

View File

@ -107,5 +107,11 @@ class UnicastConnection:
def close(self): def close(self):
self.sock.close() self.sock.close()
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.is_connected = False
self.is_tls = False
self.ssock = None
self.ca_path = None
self.ssl_info = None