forked from p15670423/monkey
Island: Add INetMapRepository.py and a mock entities for it
This commit is contained in:
parent
f2a4be8de0
commit
ec4af2cc57
|
@ -0,0 +1,17 @@
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from typing import Mapping, Sequence
|
||||||
|
|
||||||
|
|
||||||
|
# This is the most concise way to represent a graph:
|
||||||
|
# Machine id as key, Arch list as a value
|
||||||
|
# Not sure how compatible this will be with ORM objects though,
|
||||||
|
# might require more complex casting logic
|
||||||
|
@dataclass
|
||||||
|
class Netmap:
|
||||||
|
nodes: Mapping[str, Sequence[Arch]]
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Arch:
|
||||||
|
dst_machine: Machine
|
||||||
|
status: str
|
|
@ -1,30 +0,0 @@
|
||||||
from abc import ABC
|
|
||||||
from typing import Optional, Sequence
|
|
||||||
|
|
||||||
from monkey_island.cc.models.edge import Edge
|
|
||||||
|
|
||||||
|
|
||||||
class IEdgeRepository(ABC):
|
|
||||||
def get_all_edges(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def get_edges(self, src_machine_id: str, dst_machine_id: str) -> Sequence[Edge]:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def save_edge(self, edge: Edge):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def get_by_dst(self, dst_machine_id: str) -> Sequence[Edge]:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# If tunnel is None then it gets all edges, if True/False then gets only
|
|
||||||
# tunneling/non-tunneling edges
|
|
||||||
def get_by_src(self, src_machine_id: str, tunnel: Optional[bool] = None) -> Sequence[Edge]:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def get_by_id(self, edge_id: str) -> Edge:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Scan telemetries might change the label once we know more about the target system
|
|
||||||
def set_label(self, edge_id: str, label: str):
|
|
||||||
pass
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
from abc import ABC
|
||||||
|
|
||||||
|
|
||||||
|
class INetMapRepository(ABC):
|
||||||
|
|
||||||
|
# TODO Define NetMap object
|
||||||
|
def get_map(self) -> NetMap:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def save_netmap(self, netmap: NetMap):
|
||||||
|
pass
|
Loading…
Reference in New Issue