Compare commits

..

No commits in common. "022ab724a995d1ef69d6c5df2357910222a2b7fc" and "253102b5c95a50deaebb212133ef67b9d0e5a495" have entirely different histories.

View File

@ -40,7 +40,6 @@ def loadPrivateKey(passphrase: str) -> RsaKey:
return rsaKey return rsaKey
def loadAddress() -> str: def loadAddress() -> str:
with open(CONFIG_LOCATION) as json_file: with open(CONFIG_LOCATION) as json_file:
data = json.load(json_file) data = json.load(json_file)
@ -122,32 +121,32 @@ while True:
if separatedCommand[0] == 'LOUT' and len(separatedCommand) == 1: if separatedCommand[0] == 'LOUT' and len(separatedCommand) == 1:
network.sendMessage(command.encode('UTF-8')) network.sendMessage(command.encode('UTF-8'))
print(network.recieveMessage().decode('UTF-8')) print(network.recieveMessage())
continue continue
if separatedCommand[0] == 'MKD' and len(separatedCommand) == 2: if separatedCommand[0] == 'MKD' and len(separatedCommand) == 2:
network.sendMessage(command.encode('UTF-8')) network.sendMessage(command.encode('UTF-8'))
print(network.recieveMessage().decode('UTF-8')) print(network.recieveMessage())
continue continue
if separatedCommand[0] == 'RMD' and len(separatedCommand) == 2: if separatedCommand[0] == 'RMD' and len(separatedCommand) == 2:
network.sendMessage(command.encode('UTF-8')) network.sendMessage(command.encode('UTF-8'))
print(network.recieveMessage().decode('UTF-8')) print(network.recieveMessage())
continue continue
if separatedCommand[0] == 'GWD' and len(separatedCommand) == 1: if separatedCommand[0] == 'GWD' and len(separatedCommand) == 1:
network.sendMessage(command.encode('UTF-8')) network.sendMessage(command.encode('UTF-8'))
print(network.recieveMessage().decode('UTF-8')) print(network.recieveMessage())
continue continue
if separatedCommand[0] == 'CWD' and len(separatedCommand) == 2: if separatedCommand[0] == 'CWD' and len(separatedCommand) == 2:
network.sendMessage(command.encode('UTF-8')) network.sendMessage(command.encode('UTF-8'))
print(network.recieveMessage().decode('UTF-8')) print(network.recieveMessage())
continue continue
if separatedCommand[0] == 'LST' and len(separatedCommand) == 1: if separatedCommand[0] == 'LST' and len(separatedCommand) == 1:
network.sendMessage(command.encode('UTF-8')) network.sendMessage(command.encode('UTF-8'))
print(network.recieveMessage().decode('UTF-8')) print(network.recieveMessage())
continue continue
if separatedCommand[0] == 'UPL' and len(separatedCommand) == 2: if separatedCommand[0] == 'UPL' and len(separatedCommand) == 2:
@ -159,8 +158,8 @@ while True:
network.sendMessage(file.readlines()) network.sendMessage(file.readlines())
network.sendMessage('EOF'.encode('UTF-8')) network.sendMessage('EOF'.encode('UTF-8'))
response = network.recieveMessage().decode('UTF-8') response = network.recieveMessage()
print(response) print(response.decode())
else: else:
print('Invalid argument for file upload: ' + separatedCommand[1]) print('Invalid argument for file upload: ' + separatedCommand[1])
@ -170,18 +169,18 @@ while True:
dnlFilename = separatedCommand[1].split(os.path.sep)[-1] dnlFilename = separatedCommand[1].split(os.path.sep)[-1]
cmd = 'DNL ' + dnlFilename cmd = 'DNL ' + dnlFilename
network.sendMessage(cmd.encode('UTF-8')) network.sendMessage(cmd.encode('UTF-8'))
file = network.recieveMessage().decode('UTF-8') file = network.recieveMessage()
response = network.recieveMessage().decode('UTF-8') response = network.recieveMessage()
if response == 'OK': if response == 'OK':
with open(DOWNLOAD_LOCATION + dnlFilename, "wb+") as file: with open(DOWNLOAD_LOCATION + dnlFilename, "wb+") as file:
file.writelines(file) file.writelines(file)
else: else:
print(response) print(response.decode())
continue continue
printCommand() printCommand()
except Exception as e: except Exception as e:
print('Error: ' + str(e)) print('Error: '+str(e))