From 11e6b9e28140b8d8c4a5095e4daf469fe116d6b1 Mon Sep 17 00:00:00 2001 From: Shreya Date: Tue, 23 Feb 2021 17:06:36 +0530 Subject: [PATCH] Take IPs for Run Monkey -> Manual page from configuration --- .../components/pages/RunMonkeyPage/RunOptions.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/RunOptions.js b/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/RunOptions.js index bcfe7d66c..3a43f1a44 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/RunOptions.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/RunOptions.js @@ -10,6 +10,8 @@ import RunOnIslandButton from './RunOnIslandButton'; import AWSRunButton from './RunOnAWS/AWSRunButton'; import CloudOptions from './scoutsuite-setup/CloudOptions'; +const CONFIG_URL = '/api/configuration/island'; + function RunOptions(props) { const [currentContent, setCurrentContent] = useState(loadingContents()); @@ -20,12 +22,16 @@ function RunOptions(props) { useEffect(() => { if (initialized === false) { - authComponent.authFetch('/api') - .then(res => res.json()) - .then(res => { - setIps([res['ip_addresses']][0]); - setInitialized(true); + authComponent.authFetch(CONFIG_URL) + .then(res => res.json()) + .then(res => { + let commandServers = res.configuration.internal.island_server.command_servers; + let ipAddresses = commandServers.map(ip => { + return ip.split(":", 1); }); + setIps(ipAddresses); + setInitialized(true); + }); } })