Compare commits

..

2 Commits

Author SHA1 Message Date
022ab724a9 Merge branch 'master' of https://git.kmlabz.com/BiztProtoBois/client
All checks were successful
continuous-integration/drone/push Build is passing
2021-04-25 18:29:37 +02:00
9bc3f14cd9 Decoding response! 2021-04-25 18:29:28 +02:00

View File

@ -40,6 +40,7 @@ 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)
@ -121,32 +122,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()) print(network.recieveMessage().decode('UTF-8'))
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()) print(network.recieveMessage().decode('UTF-8'))
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()) print(network.recieveMessage().decode('UTF-8'))
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()) print(network.recieveMessage().decode('UTF-8'))
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()) print(network.recieveMessage().decode('UTF-8'))
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()) print(network.recieveMessage().decode('UTF-8'))
continue continue
if separatedCommand[0] == 'UPL' and len(separatedCommand) == 2: if separatedCommand[0] == 'UPL' and len(separatedCommand) == 2:
@ -158,8 +159,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() response = network.recieveMessage().decode('UTF-8')
print(response.decode()) print(response)
else: else:
print('Invalid argument for file upload: ' + separatedCommand[1]) print('Invalid argument for file upload: ' + separatedCommand[1])
@ -169,14 +170,14 @@ 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() file = network.recieveMessage().decode('UTF-8')
response = network.recieveMessage() response = network.recieveMessage().decode('UTF-8')
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.decode()) print(response)
continue continue