some more login rework
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-04-26 13:18:50 +02:00
parent 772a9e6d2c
commit ae743cde15
3 changed files with 10 additions and 14 deletions

View File

@@ -22,6 +22,7 @@ class NetWrapper:
self.network = network_interface('./../../netsim/network/', 'A')
self.clientAddr = ""
self.currentUser = ""
self.homeDirectory = ""
self.authenticationInstance = authenticationInstance
def serverIdentify(self, msg: bytes) -> None:
@@ -80,8 +81,9 @@ class NetWrapper:
retciphertext = b64decode(b64['message'])
retcipher = ChaCha20.new(key=self.cipherkey, nonce=retnonce)
plaintext = retcipher.decrypt(retciphertext).decode('UTF-8').split(' ')
self.homeDirectory = self.authenticationInstance.login(plaintext[1], plaintext[2])
linsuccess = (not (len(plaintext) != 3 or plaintext[0] != "LIN" or plaintext[
1] != self.currentUser)) and self.authenticationInstance.login(plaintext[1], plaintext[2])
1] != self.currentUser)) and self.homeDirectory
if linsuccess:
message = "OK".encode('UTF-8')
else:
@@ -132,6 +134,7 @@ class NetWrapper:
self.cipherkey = "".encode('UTF-8')
self.currentClientPublicKey = "".encode('UTF-8')
self.currentUser = ""
self.homeDirectory = ""
def recieveEncryptedMessage(self, msg: bytes) -> bytes:
try: