forked from p15670423/monkey
Agent: Put timestamp before random string in log names
Putting the timestamp before the random string in the agent and dropper log names allows them to be sorted by time.
This commit is contained in:
parent
6c1a4faf3a
commit
753f00de65
|
@ -21,7 +21,7 @@ Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
- The process list collection system info collector to now be a post-breach action. #1697
|
- The process list collection system info collector to now be a post-breach action. #1697
|
||||||
- The "/api/monkey/download" endpoint to accept an OS and return a file. #1675
|
- The "/api/monkey/download" endpoint to accept an OS and return a file. #1675
|
||||||
- Log messages to contain human-readable thread names. #1766
|
- Log messages to contain human-readable thread names. #1766
|
||||||
- The log file name to `infection-monkey-agent-<random_string>-<timestamp>.log`. #1761
|
- The log file name to `infection-monkey-agent-<TIMESTAMP>-<RANDOM_STRING>.log`. #1761
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- VSFTPD exploiter. #1533
|
- VSFTPD exploiter. #1533
|
||||||
|
|
|
@ -7,8 +7,9 @@ from pathlib import Path
|
||||||
# Cache the result of the call so that subsequent calls always return the same result
|
# Cache the result of the call so that subsequent calls always return the same result
|
||||||
@lru_cache(maxsize=None)
|
@lru_cache(maxsize=None)
|
||||||
def _get_log_path(monkey_arg: str) -> Path:
|
def _get_log_path(monkey_arg: str) -> Path:
|
||||||
prefix = f"infection-monkey-{monkey_arg}-"
|
timestamp = time.strftime("%Y-%m-%d-%H-%M-%S", time.gmtime())
|
||||||
suffix = f"-{time.strftime('%Y-%m-%d-%H-%M-%S', time.gmtime())}.log"
|
prefix = f"infection-monkey-{monkey_arg}-{timestamp}-"
|
||||||
|
suffix = ".log"
|
||||||
|
|
||||||
_, monkey_log_path = tempfile.mkstemp(suffix=suffix, prefix=prefix)
|
_, monkey_log_path = tempfile.mkstemp(suffix=suffix, prefix=prefix)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue