forked from p15670423/monkey
Island: Add local_ips resource
This commit is contained in:
parent
ac172dc81f
commit
9444f1a9d7
|
@ -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)
|
||||
|
|
|
@ -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}
|
Loading…
Reference in New Issue