forked from p15670423/monkey
Merge pull request #1969 from guardicore/1967-fix-travis
Project: Fix travis build
This commit is contained in:
commit
b3710e4772
|
@ -52,4 +52,3 @@ repos:
|
|||
rev: v2.3
|
||||
hooks:
|
||||
- id: vulture
|
||||
exclude: "monkey/monkey_island/docs/source/conf.py"
|
||||
|
|
|
@ -57,7 +57,6 @@ jobs:
|
|||
# check python code
|
||||
## check syntax errors and fail the build if any are found.
|
||||
- flake8 .
|
||||
|
||||
## check import order
|
||||
- python -m isort ./monkey --check-only
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@ from typing import Mapping, Sequence
|
|||
# might require more complex casting logic
|
||||
@dataclass
|
||||
class NetworkMap:
|
||||
nodes: Mapping[str, Sequence[Arc]]
|
||||
nodes: Mapping[str, Sequence[Arc]] # noqa: F821
|
||||
|
||||
|
||||
@dataclass
|
||||
class Arc:
|
||||
dst_machine: Machine
|
||||
dst_machine: Machine # noqa: F821
|
||||
status: str
|
||||
|
|
|
@ -4,10 +4,10 @@ from typing import Optional, Sequence
|
|||
|
||||
class ILogRepository(ABC):
|
||||
# Define log object
|
||||
def get_logs(self, agent_id: Optional[str] = None) -> Sequence[Log]:
|
||||
def get_logs(self, agent_id: Optional[str] = None) -> Sequence[Log]: # noqa: F821
|
||||
pass
|
||||
|
||||
def save_log(self, log: Log):
|
||||
def save_log(self, log: Log): # noqa: F821
|
||||
pass
|
||||
|
||||
def delete_log(self, agent_id: str):
|
||||
|
|
|
@ -4,7 +4,7 @@ from typing import Optional, Sequence
|
|||
|
||||
class IMachineRepository(ABC):
|
||||
# TODO define Machine object(ORM model)
|
||||
def save_machine(self, machine: Machine):
|
||||
def save_machine(self, machine: Machine): # noqa: F821
|
||||
pass
|
||||
|
||||
# TODO define Machine object(ORM model)
|
||||
|
@ -14,7 +14,7 @@ class IMachineRepository(ABC):
|
|||
self,
|
||||
id: Optional[str] = None,
|
||||
ips: Optional[Sequence[str]] = None,
|
||||
state: Optional[MachineState] = None,
|
||||
state: Optional[MachineState] = None, # noqa: F821
|
||||
is_island: Optional[bool] = None,
|
||||
) -> Sequence[Machine]:
|
||||
) -> Sequence[Machine]: # noqa: F821
|
||||
pass
|
||||
|
|
|
@ -4,8 +4,8 @@ from abc import ABC
|
|||
class INetworkMapRepository(ABC):
|
||||
|
||||
# TODO Define NetMap object
|
||||
def get_map(self) -> NetMap:
|
||||
def get_map(self) -> NetMap: # noqa: F821
|
||||
pass
|
||||
|
||||
def save_netmap(self, netmap: NetMap):
|
||||
def save_netmap(self, netmap: NetMap): # noqa: F821
|
||||
pass
|
||||
|
|
|
@ -4,7 +4,7 @@ from abc import ABC
|
|||
class ISimulationRepository(ABC):
|
||||
# TODO define simulation object. It should contain metadata about simulation,
|
||||
# like start, end times, mode and last forced stop of all monkeys
|
||||
def save_simulation(self, simulation: Simulation):
|
||||
def save_simulation(self, simulation: Simulation): # noqa: F821
|
||||
pass
|
||||
|
||||
def get_simulation(self):
|
||||
|
|
|
@ -14,7 +14,7 @@ class ITelemetryRepository(ABC):
|
|||
def get_telemetries(
|
||||
self,
|
||||
id: Optional[str] = None,
|
||||
type: Optional[TelemetryType] = None,
|
||||
type: Optional[TelemetryType] = None, # noqa: F821
|
||||
monkey_id: Optional[str] = None,
|
||||
) -> Sequence[Telemetry]:
|
||||
pass
|
||||
|
|
|
@ -15,6 +15,7 @@ MAX_SAME_CATEGORY_TELEMS = 10000
|
|||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# TODO this will break with the IRepository implementation. Remove it
|
||||
class TestTelemStore:
|
||||
TELEMS_EXPORTED = False
|
||||
|
|
|
@ -188,15 +188,15 @@ class NodeService:
|
|||
tunnel_host_id = NodeService.get_monkey_by_ip(tunnel_host_ip)["_id"]
|
||||
NodeService.unset_all_monkey_tunnels(monkey_id)
|
||||
mongo.db.monkey.update(
|
||||
{"_id": monkey_id}, {"$set": {"tunnel": tunnel_host_id}}, upsert=False
|
||||
{"_id": monkey_id}, {"$set": {"tunnel": tunnel_host_id}}, upsert=False
|
||||
)
|
||||
monkey_label = NodeService.get_label_for_endpoint(monkey_id)
|
||||
tunnel_host_label = NodeService.get_label_for_endpoint(tunnel_host_id)
|
||||
tunnel_edge = EdgeService.get_or_create_edge(
|
||||
src_node_id=monkey_id,
|
||||
dst_node_id=tunnel_host_id,
|
||||
src_label=monkey_label,
|
||||
dst_label=tunnel_host_label,
|
||||
src_node_id=monkey_id,
|
||||
dst_node_id=tunnel_host_id,
|
||||
src_label=monkey_label,
|
||||
dst_label=tunnel_host_label,
|
||||
)
|
||||
tunnel_edge.tunnel = True
|
||||
tunnel_edge.ip_address = tunnel_host_ip
|
||||
|
@ -205,13 +205,13 @@ class NodeService:
|
|||
@staticmethod
|
||||
def insert_node(ip_address, domain_name=""):
|
||||
new_node_insert_result = mongo.db.node.insert_one(
|
||||
{
|
||||
"ip_addresses": [ip_address],
|
||||
"domain_name": domain_name,
|
||||
"exploited": False,
|
||||
"propagated": False,
|
||||
"os": {"type": "unknown", "version": "unknown"},
|
||||
}
|
||||
{
|
||||
"ip_addresses": [ip_address],
|
||||
"domain_name": domain_name,
|
||||
"exploited": False,
|
||||
"propagated": False,
|
||||
"os": {"type": "unknown", "version": "unknown"},
|
||||
}
|
||||
)
|
||||
return mongo.db.node.find_one({"_id": new_node_insert_result.inserted_id})
|
||||
|
||||
|
@ -252,7 +252,7 @@ class NodeService:
|
|||
@staticmethod
|
||||
def update_monkey_modify_time(monkey_id):
|
||||
mongo.db.monkey.update(
|
||||
{"_id": monkey_id}, {"$set": {"modifytime": datetime.now()}}, upsert=False
|
||||
{"_id": monkey_id}, {"$set": {"modifytime": datetime.now()}}, upsert=False
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
|
@ -268,7 +268,7 @@ class NodeService:
|
|||
@staticmethod
|
||||
def add_communication_info(monkey, info):
|
||||
mongo.db.monkey.update(
|
||||
{"guid": monkey["guid"]}, {"$set": {"command_control_channel": info}}, upsert=False
|
||||
{"guid": monkey["guid"]}, {"$set": {"command_control_channel": info}}, upsert=False
|
||||
)
|
||||
|
||||
# TODO this returns a mock island agent
|
||||
|
@ -343,7 +343,7 @@ class NodeService:
|
|||
@staticmethod
|
||||
def get_hostname_by_id(node_id):
|
||||
return NodeService.get_node_hostname(
|
||||
mongo.db.monkey.find_one({"_id": node_id}, {"hostname": 1})
|
||||
mongo.db.monkey.find_one({"_id": node_id}, {"hostname": 1})
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -25,5 +25,5 @@ norecursedirs = "node_modules dist"
|
|||
markers = ["slow: mark test as slow"]
|
||||
|
||||
[tool.vulture]
|
||||
exclude = ["monkey/monkey_island/cc/ui/", "monkey/tests/"]
|
||||
exclude = ["monkey/monkey_island/cc/ui/", "monkey/tests/", "monkey/monkey_island/docs/"]
|
||||
paths = ["."]
|
||||
|
|
Loading…
Reference in New Issue