OK
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
DESKTOP-DPA61F8\Benedek 2021-04-26 23:25:53 +02:00
parent 92c0f4a90a
commit 863a42e982

View File

@ -89,6 +89,7 @@ if not os.path.isfile(CONFIG_LOCATION) or os.stat(CONFIG_LOCATION).st_size == 0:
SERVER_PUBLIC_KEY = loadPublicKey() SERVER_PUBLIC_KEY = loadPublicKey()
CLIENT_PRIVATE_KEY = loadPrivateKey(PASSPHRASE) CLIENT_PRIVATE_KEY = loadPrivateKey(PASSPHRASE)
CLIENT_ADDRESS = loadAddress() CLIENT_ADDRESS = loadAddress()
LOGGED_IN = False
while True: while True:
command = input("Type a command:") command = input("Type a command:")
@ -99,21 +100,25 @@ while True:
print("Invalid command format!") print("Invalid command format!")
continue continue
if separatedCommand[0] == 'LIN' and len(separatedCommand) == 3: if not LOGGED_IN:
network = NetWrapper(CLIENT_PRIVATE_KEY, CLIENT_ADDRESS, separatedCommand[1], SERVER_PUBLIC_KEY) if separatedCommand[0] == 'LIN' and len(separatedCommand) == 3:
try: network = NetWrapper(CLIENT_PRIVATE_KEY, CLIENT_ADDRESS, separatedCommand[1], SERVER_PUBLIC_KEY)
network.connectToServer(separatedCommand[2]) try:
response = network.recieveMessage().decode('UTF-8') network.connectToServer(separatedCommand[2])
print(response) response = network.recieveMessage().decode('UTF-8')
if response == 'OK': print(response)
LOGGED_IN = True if response == 'OK':
else: LOGGED_IN = True
else:
LOGGED_IN = False
except Exception as e:
print("Error: "+str(e))
LOGGED_IN = False LOGGED_IN = False
except Exception as e: continue
print("Error: "+str(e))
LOGGED_IN = False
continue continue
continue else:
print('You are already logged in!')
if separatedCommand[0] == 'EXIT': if separatedCommand[0] == 'EXIT':
sys.exit(1) sys.exit(1)