forked from p34709852/monkey
Agent: Return agent/dropper log path as a Path instead of str
This commit is contained in:
parent
96069d3ae6
commit
17c3fa02b3
|
@ -289,7 +289,7 @@ class InfectionMonkey:
|
|||
@staticmethod
|
||||
def _send_log():
|
||||
monkey_log_path = get_agent_log_path()
|
||||
if os.path.exists(monkey_log_path):
|
||||
if monkey_log_path.is_file():
|
||||
with open(monkey_log_path, "r") as f:
|
||||
log = f.read()
|
||||
else:
|
||||
|
|
|
@ -3,12 +3,13 @@ import sys
|
|||
import tempfile
|
||||
import time
|
||||
from functools import lru_cache, partial
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
# Cache the result of the call so that subsequent calls always return the same result
|
||||
@lru_cache(maxsize=None)
|
||||
def _get_log_path(monkey_arg: str) -> str:
|
||||
return (
|
||||
def _get_log_path(monkey_arg: str) -> Path:
|
||||
return Path(
|
||||
os.path.expandvars(_generate_random_log_filepath(monkey_arg))
|
||||
if sys.platform == "win32"
|
||||
else _generate_random_log_filepath(monkey_arg)
|
||||
|
|
Loading…
Reference in New Issue