forked from p15670423/monkey
Monkey: add launch time to the monkey collection
Launch time is needed if we want to tell the user when exactly the exploit occurred/monkey got run
This commit is contained in:
parent
52207c15b8
commit
91ca828c72
|
@ -0,0 +1,3 @@
|
||||||
|
# Default time format used in the application, follows European standard.
|
||||||
|
# Example: 1992-03-04 10:32:05
|
||||||
|
DEFAULT_TIME_FORMAT = "%Y-%m-%d %H:%M:%S"
|
|
@ -1,6 +1,7 @@
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import platform
|
import platform
|
||||||
|
from datetime import datetime
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
from socket import gethostname
|
from socket import gethostname
|
||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
|
@ -11,6 +12,7 @@ from requests.exceptions import ConnectionError
|
||||||
import infection_monkey.monkeyfs as monkeyfs
|
import infection_monkey.monkeyfs as monkeyfs
|
||||||
import infection_monkey.tunnel as tunnel
|
import infection_monkey.tunnel as tunnel
|
||||||
from common.common_consts.api_url_consts import T1216_PBA_FILE_DOWNLOAD_PATH
|
from common.common_consts.api_url_consts import T1216_PBA_FILE_DOWNLOAD_PATH
|
||||||
|
from common.common_consts.time_formats import DEFAULT_TIME_FORMAT
|
||||||
from common.common_consts.timeouts import (
|
from common.common_consts.timeouts import (
|
||||||
LONG_REQUEST_TIMEOUT,
|
LONG_REQUEST_TIMEOUT,
|
||||||
MEDIUM_REQUEST_TIMEOUT,
|
MEDIUM_REQUEST_TIMEOUT,
|
||||||
|
@ -60,6 +62,7 @@ class ControlClient(object):
|
||||||
"internet_access": has_internet_access,
|
"internet_access": has_internet_access,
|
||||||
"config": WormConfiguration.as_dict(),
|
"config": WormConfiguration.as_dict(),
|
||||||
"parent": parent,
|
"parent": parent,
|
||||||
|
"launch_time": str(datetime.now().strftime(DEFAULT_TIME_FORMAT)),
|
||||||
}
|
}
|
||||||
|
|
||||||
if ControlClient.proxies:
|
if ControlClient.proxies:
|
||||||
|
|
|
@ -40,6 +40,7 @@ class Monkey(Document):
|
||||||
hostname = StringField()
|
hostname = StringField()
|
||||||
internet_access = BooleanField()
|
internet_access = BooleanField()
|
||||||
ip_addresses = ListField(StringField())
|
ip_addresses = ListField(StringField())
|
||||||
|
launch_time = StringField()
|
||||||
keepalive = DateTimeField()
|
keepalive = DateTimeField()
|
||||||
modifytime = DateTimeField()
|
modifytime = DateTimeField()
|
||||||
# TODO make "parent" an embedded document, so this can be removed and the schema explained (
|
# TODO make "parent" an embedded document, so this can be removed and the schema explained (
|
||||||
|
|
|
@ -70,6 +70,7 @@ PbaResults # unused class (monkey/monkey_island/cc/models/pba_results.py:4)
|
||||||
internet_access # unused variable (monkey/monkey_island/cc/models/monkey.py:43)
|
internet_access # unused variable (monkey/monkey_island/cc/models/monkey.py:43)
|
||||||
config_error # unused variable (monkey/monkey_island/cc/models/monkey.py:53)
|
config_error # unused variable (monkey/monkey_island/cc/models/monkey.py:53)
|
||||||
pba_results # unused variable (monkey/monkey_island/cc/models/monkey.py:55)
|
pba_results # unused variable (monkey/monkey_island/cc/models/monkey.py:55)
|
||||||
|
launch_time # unused variable (monkey/monkey_island/cc/models/monkey.py)
|
||||||
command_control_channel # unused variable (monkey/monkey_island/cc/models/monkey.py:58)
|
command_control_channel # unused variable (monkey/monkey_island/cc/models/monkey.py:58)
|
||||||
meta # unused variable (monkey/monkey_island/cc/models/zero_trust/finding.py:37)
|
meta # unused variable (monkey/monkey_island/cc/models/zero_trust/finding.py:37)
|
||||||
meta # unused variable (monkey/monkey_island/cc/models/monkey_ttl.py:34)
|
meta # unused variable (monkey/monkey_island/cc/models/monkey_ttl.py:34)
|
||||||
|
|
Loading…
Reference in New Issue