diff --git a/monkey/monkey_island/cc/app.py b/monkey/monkey_island/cc/app.py index 46dd8543a..74d51fd2a 100644 --- a/monkey/monkey_island/cc/app.py +++ b/monkey/monkey_island/cc/app.py @@ -30,6 +30,7 @@ from monkey_island.cc.resources.exploitations.monkey_exploitation import MonkeyE from monkey_island.cc.resources.island_configuration import IslandConfiguration from monkey_island.cc.resources.island_logs import IslandLog from monkey_island.cc.resources.island_mode import IslandMode +from monkey_island.cc.resources.local_ips import LocalIps from monkey_island.cc.resources.local_run import LocalRun from monkey_island.cc.resources.log import Log from monkey_island.cc.resources.monkey import Monkey @@ -171,6 +172,7 @@ def init_api_resources(api: FlaskDIWrapper): api.add_resource(TelemetryFeed) api.add_resource(Log) api.add_resource(IslandLog) + api.add_resource(LocalIps) # API Spec: These two should be the same resource, GET for download and POST for upload api.add_resource(PBAFileDownload) diff --git a/monkey/monkey_island/cc/resources/local_ips.py b/monkey/monkey_island/cc/resources/local_ips.py new file mode 100644 index 000000000..ae99458f9 --- /dev/null +++ b/monkey/monkey_island/cc/resources/local_ips.py @@ -0,0 +1,18 @@ +from monkey_island.cc.resources.AbstractResource import AbstractResource +from monkey_island.cc.resources.request_authentication import jwt_required +from monkey_island.cc.services.utils.network_utils import local_ip_addresses + + +class LocalIps(AbstractResource): + urls = ["/api/island/local-ips"] + + @jwt_required + def get(self): + """ + Gets the local ip address from the Island + + :return: a list of local ips + """ + local_ips = local_ip_addresses() + + return {"local_ips": local_ips}