Island: Add field `propagated` to node and rename image files

This commit is contained in:
Shreya Malviya 2022-03-09 17:00:33 +05:30 committed by Mike Salvatore
parent d6fe9c2ef2
commit 5e3829aab3
5 changed files with 18 additions and 1 deletions

View File

@ -128,8 +128,16 @@ class NodeService:
def get_node_group(node) -> str:
if "group" in node and node["group"]:
return node["group"]
node_type = "exploited" if node.get("exploited") else "clean"
if node.get("exploited"):
node_type = "exploited"
elif node.get("propagated"):
node_type = "propagated"
else:
node_type = "clean"
node_os = NodeService.get_node_os(node)
return NodeStates.get_by_keywords([node_type, node_os]).value
@staticmethod
@ -202,6 +210,7 @@ class NodeService:
"ip_addresses": [ip_address],
"domain_name": domain_name,
"exploited": False,
"propagated": False,
"os": {"type": "unknown", "version": "unknown"},
}
)
@ -288,6 +297,10 @@ class NodeService:
def set_node_exploited(node_id):
mongo.db.node.update({"_id": node_id}, {"$set": {"exploited": True}})
@staticmethod
def set_node_propagated(node_id):
mongo.db.node.update({"_id": node_id}, {"$set": {"propagated": True}})
@staticmethod
def update_dead_monkeys():
# Update dead monkeys only if no living monkey transmitted keepalive in the last 10 minutes

View File

@ -52,6 +52,8 @@ def update_network_with_exploit(edge: EdgeService, telemetry_json):
edge.update_based_on_exploit(new_exploit)
if new_exploit["exploitation_result"]:
NodeService.set_node_exploited(edge.dst_node_id)
if new_exploit["propagation_result"]:
NodeService.set_node_propagated(edge.dst_node_id)
def encrypt_exploit_creds(telemetry_json):

View File

@ -11,6 +11,8 @@ class NodeStates(Enum):
CLEAN_WINDOWS = "clean_windows"
EXPLOITED_LINUX = "exploited_linux"
EXPLOITED_WINDOWS = "exploited_windows"
PROPAGATED_LINUX = "propagated_linux"
PROPAGATED_WINDOWS = "propagated_windows"
ISLAND = "island"
ISLAND_MONKEY_LINUX = "island_monkey_linux"
ISLAND_MONKEY_LINUX_RUNNING = "island_monkey_linux_running"

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB