| 
					
				 | 
			
			
				@@ -85,7 +85,7 @@ class Client: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _subprocess = await asyncio.create_subprocess_shell( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 "openssl enc -aes-256-cbc " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 "-md sha512 -pbkdf2 -iter 100000 -salt " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                f"-in {input_file} -out {output_file} " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                f"-in \"{input_file}\" -out \"{output_file}\" " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 f"-pass pass:{self.password}" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             stdout, stderr = await _subprocess.communicate() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -105,14 +105,18 @@ class Client: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         file_path = self.file_path 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if self.password: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             file_path = self.file_path + '.enc' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            # Remove already-encrypted file if present (salt would differ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if os.path.isfile(file_path): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                os.remove(file_path) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             asyncio.ensure_future( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 self.encrypt_file( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     input_file=self.file_path, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     output_file=file_path 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            # Give encryption an edge 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             while not os.path.isfile(file_path): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                await asyncio.sleep(0.1)  # Let the encryption begin 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                await asyncio.sleep(.5) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         logging.info("Sending file...") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         with open(file_path, 'rb') as file_to_send: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             while not self.stopping: 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -146,6 +150,7 @@ class Client: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     async def receive(self, reader: asyncio.StreamReader): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         self._working = True 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         file_path = self.file_path 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        logging.info("Receiving file...") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if self.password: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             file_path += '.enc' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         with open(file_path, 'wb') as file_to_receive: 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -154,6 +159,7 @@ class Client: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if not input_data: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     break 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 file_to_receive.write(input_data) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        logging.info("File received.") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if self.password: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             logging.info("Decrypting file...") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             stdout, stderr = ''.encode(), ''.encode() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -161,7 +167,7 @@ class Client: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 _subprocess = await asyncio.create_subprocess_shell( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     "openssl enc -aes-256-cbc " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     "-md sha512 -pbkdf2 -iter 100000 -salt -d " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    f"-in {file_path} -out {self.file_path} " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    f"-in \"{file_path}\" -out \"{self.file_path}\" " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     f"-pass pass:{self.password}" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 stdout, stderr = await _subprocess.communicate() 
			 |