forked from p34709852/monkey
BB: Add MonkeyIslandClient.get_agents()
This commit is contained in:
parent
3db3df8bae
commit
b335601a05
|
@ -8,8 +8,10 @@ from bson import json_util
|
||||||
from common.credentials import Credentials
|
from common.credentials import Credentials
|
||||||
from envs.monkey_zoo.blackbox.island_client.monkey_island_requests import MonkeyIslandRequests
|
from envs.monkey_zoo.blackbox.island_client.monkey_island_requests import MonkeyIslandRequests
|
||||||
from envs.monkey_zoo.blackbox.test_configurations.test_configuration import TestConfiguration
|
from envs.monkey_zoo.blackbox.test_configurations.test_configuration import TestConfiguration
|
||||||
|
from monkey_island.cc.models import Agent
|
||||||
|
|
||||||
SLEEP_BETWEEN_REQUESTS_SECONDS = 0.5
|
SLEEP_BETWEEN_REQUESTS_SECONDS = 0.5
|
||||||
|
GET_AGENTS_ENDPOINT = "api/agents"
|
||||||
MONKEY_TEST_ENDPOINT = "api/test/monkey"
|
MONKEY_TEST_ENDPOINT = "api/test/monkey"
|
||||||
TELEMETRY_TEST_ENDPOINT = "api/test/telemetry"
|
TELEMETRY_TEST_ENDPOINT = "api/test/telemetry"
|
||||||
LOG_TEST_ENDPOINT = "api/test/log"
|
LOG_TEST_ENDPOINT = "api/test/log"
|
||||||
|
@ -157,6 +159,11 @@ class MonkeyIslandClient(object):
|
||||||
)
|
)
|
||||||
return MonkeyIslandClient.get_test_query_results(response)
|
return MonkeyIslandClient.get_test_query_results(response)
|
||||||
|
|
||||||
|
def get_agents(self) -> Sequence[Agent]:
|
||||||
|
response = self.requests.get(GET_AGENTS_ENDPOINT)
|
||||||
|
|
||||||
|
return [Agent(**a) for a in response.json()]
|
||||||
|
|
||||||
def find_log_in_db(self, query):
|
def find_log_in_db(self, query):
|
||||||
response = self.requests.get(
|
response = self.requests.get(
|
||||||
LOG_TEST_ENDPOINT, MonkeyIslandClient.form_find_query_for_request(query)
|
LOG_TEST_ENDPOINT, MonkeyIslandClient.form_find_query_for_request(query)
|
||||||
|
|
Loading…
Reference in New Issue