This commit is contained in:
Torma Kristóf 2021-04-26 23:27:17 +02:00
parent 098e279eb8
commit d66cd15ec9
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047

View File

@ -13,7 +13,7 @@ from netsim import network_interface
class NetWrapper: class NetWrapper:
def __init__(self, privateKey: RsaKey, clientAddress: str, username: str, serverPubKey: RsaKey, def __init__(self, privateKey: RsaKey, clientAddress: str, serverPubKey: RsaKey, username: str = "",
serverAddr: str = 'A'): serverAddr: str = 'A'):
self.network = network_interface('./../../netsim/network/', clientAddress) self.network = network_interface('./../../netsim/network/', clientAddress)
self.serverAddr = serverAddr self.serverAddr = serverAddr
@ -105,6 +105,10 @@ class NetWrapper:
print("Authentication error") print("Authentication error")
def connectToServer(self, password: str) -> None: def connectToServer(self, password: str) -> None:
if self.username == "":
raise Exception('Username is not initialized')
if password == "":
raise Exception('Passowrd may not be empty')
identStatus = self.identifyServer() identStatus = self.identifyServer()
if not identStatus: if not identStatus:
raise Exception('Server identification faliure') raise Exception('Server identification faliure')