forked from p15670423/monkey
Agent: Change powershell client to work with Path not str
This commit is contained in:
parent
7c504d220d
commit
7001977a88
|
@ -191,7 +191,7 @@ class PowerShellExploiter(HostExploiter):
|
|||
|
||||
try:
|
||||
logger.info(f"Attempting to copy the monkey agent binary to {self.host.ip_addr}")
|
||||
self._client.copy_file(temp_monkey_binary_filepath, str(monkey_path_on_victim))
|
||||
self._client.copy_file(temp_monkey_binary_filepath, monkey_path_on_victim)
|
||||
except Exception as ex:
|
||||
raise RemoteAgentCopyError(f"Failed to copy the agent binary to the victim: {ex}")
|
||||
finally:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import abc
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
import pypsrp
|
||||
|
@ -63,7 +64,7 @@ class IPowerShellClient(Protocol, metaclass=abc.ABCMeta):
|
|||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def copy_file(self, src: str, dest: str) -> bool:
|
||||
def copy_file(self, src: str, dest: Path) -> bool:
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
|
@ -101,7 +102,8 @@ class PowerShellClient(IPowerShellClient):
|
|||
output, _, _ = self._client.execute_cmd(cmd)
|
||||
return output
|
||||
|
||||
def copy_file(self, src: str, dest: str):
|
||||
def copy_file(self, src: str, dest: Path):
|
||||
dest = str(dest)
|
||||
try:
|
||||
self._client.copy(src, dest)
|
||||
logger.debug(f"Successfully copied {src} to {dest} on {self._ip_addr}")
|
||||
|
|
Loading…
Reference in New Issue