forked from p15670423/monkey
Island: Modify all telemetry processing functions to accept an extra agent configuration argument
This commit is contained in:
parent
c70627c74b
commit
8daa6db81f
|
@ -5,7 +5,7 @@ from monkey_island.cc.models.monkey import Monkey
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def process_aws_telemetry(telemetry_json):
|
||||
def process_aws_telemetry(telemetry_json, _):
|
||||
relevant_monkey = Monkey.get_single_monkey_by_guid(telemetry_json["monkey_guid"])
|
||||
|
||||
if "instance_id" in telemetry_json["data"]:
|
||||
|
|
|
@ -14,7 +14,7 @@ from monkey_island.cc.services.telemetry.zero_trust_checks.machine_exploited imp
|
|||
)
|
||||
|
||||
|
||||
def process_exploit_telemetry(telemetry_json):
|
||||
def process_exploit_telemetry(telemetry_json, _):
|
||||
encrypt_exploit_creds(telemetry_json)
|
||||
edge = get_edge_by_scan_or_exploit_telemetry(telemetry_json)
|
||||
update_network_with_exploit(edge, telemetry_json)
|
||||
|
|
|
@ -32,7 +32,7 @@ POST_BREACH_TELEMETRY_PROCESSING_FUNCS = {
|
|||
}
|
||||
|
||||
|
||||
def process_post_breach_telemetry(telemetry_json):
|
||||
def process_post_breach_telemetry(telemetry_json, _):
|
||||
def convert_telem_data_to_list(data):
|
||||
modified_data = [data]
|
||||
if type(data["result"][0]) is list: # multiple results in one pba
|
||||
|
|
|
@ -34,7 +34,9 @@ def process_telemetry(telemetry_json, agent_configuration: AgentConfiguration):
|
|||
try:
|
||||
telem_category = telemetry_json.get("telem_category")
|
||||
if telem_category in TELEMETRY_CATEGORY_TO_PROCESSING_FUNC:
|
||||
TELEMETRY_CATEGORY_TO_PROCESSING_FUNC[telem_category](telemetry_json)
|
||||
TELEMETRY_CATEGORY_TO_PROCESSING_FUNC[telem_category](
|
||||
telemetry_json, agent_configuration
|
||||
)
|
||||
else:
|
||||
logger.info("Got unknown type of telemetry: %s" % telem_category)
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ from monkey_island.cc.services.telemetry.zero_trust_checks.segmentation import (
|
|||
)
|
||||
|
||||
|
||||
def process_scan_telemetry(telemetry_json):
|
||||
def process_scan_telemetry(telemetry_json, _):
|
||||
if not _host_responded(telemetry_json["data"]["machine"]):
|
||||
return
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import logging
|
||||
|
||||
from common.configuration import AgentConfiguration
|
||||
from monkey_island.cc.models import Monkey
|
||||
from monkey_island.cc.services.node import NodeService
|
||||
from monkey_island.cc.services.telemetry.zero_trust_checks.segmentation import (
|
||||
|
@ -9,7 +10,7 @@ from monkey_island.cc.services.telemetry.zero_trust_checks.segmentation import (
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def process_state_telemetry(telemetry_json):
|
||||
def process_state_telemetry(telemetry_json, agent_configuration: AgentConfiguration):
|
||||
monkey = NodeService.get_monkey_by_guid(telemetry_json["monkey_guid"])
|
||||
NodeService.add_communication_info(monkey, telemetry_json["command_control_channel"])
|
||||
if telemetry_json["data"]["done"]:
|
||||
|
|
|
@ -5,7 +5,7 @@ from monkey_island.cc.services.telemetry.zero_trust_checks.tunneling import (
|
|||
)
|
||||
|
||||
|
||||
def process_tunnel_telemetry(telemetry_json):
|
||||
def process_tunnel_telemetry(telemetry_json, _):
|
||||
check_tunneling_violation(telemetry_json)
|
||||
monkey_id = NodeService.get_monkey_by_guid(telemetry_json["monkey_guid"])["_id"]
|
||||
if telemetry_json["data"]["proxy"] is not None:
|
||||
|
|
Loading…
Reference in New Issue