From c0da5b7103fab7f6905be2cf827f2a4dca14ba16 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Fri, 15 Apr 2022 15:38:40 +0200 Subject: [PATCH] Island: Rename api/monkey endpoint to api/agent --- monkey/monkey_island/cc/app.py | 8 ++++---- monkey/monkey_island/cc/resources/monkey.py | 2 +- monkey/monkey_island/cc/services/remote_run_aws.py | 8 ++++---- .../pages/RunMonkeyPage/commands/local_linux_curl.js | 2 +- .../pages/RunMonkeyPage/commands/local_linux_wget.js | 2 +- .../RunMonkeyPage/commands/local_windows_powershell.js | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/monkey/monkey_island/cc/app.py b/monkey/monkey_island/cc/app.py index 792888a19..f6975eb36 100644 --- a/monkey/monkey_island/cc/app.py +++ b/monkey/monkey_island/cc/app.py @@ -118,9 +118,9 @@ def init_api_resources(api): api.add_resource(Authenticate, "/api/auth") api.add_resource( Monkey, - "/api/monkey", - "/api/monkey/", - "/api/monkey//", + "/api/agent", + "/api/agent/", + "/api/agent//", ) api.add_resource(LocalRun, "/api/local-monkey") api.add_resource(ClientRun, "/api/client-monkey") @@ -132,7 +132,7 @@ def init_api_resources(api): api.add_resource(ConfigurationImport, "/api/configuration/import") api.add_resource( MonkeyDownload, - "/api/monkey/download/", + "/api/agent/download/", ) api.add_resource(NetMap, "/api/netmap") api.add_resource(Edge, "/api/netmap/edge") diff --git a/monkey/monkey_island/cc/resources/monkey.py b/monkey/monkey_island/cc/resources/monkey.py index 9e4cf47af..a11f9ffb8 100644 --- a/monkey/monkey_island/cc/resources/monkey.py +++ b/monkey/monkey_island/cc/resources/monkey.py @@ -26,7 +26,7 @@ class Monkey(flask_restful.Resource): if guid: monkey_json = mongo.db.monkey.find_one_or_404({"guid": guid}) # TODO: When the "legacy" format is no longer needed, update this logic and remove the - # "/api/monkey//" route. Also considering not + # "/api/agent//" route. Also considering not # flattening the config in the first place. if config_format == "legacy": ConfigService.decrypt_flat_config(monkey_json["config"]) diff --git a/monkey/monkey_island/cc/services/remote_run_aws.py b/monkey/monkey_island/cc/services/remote_run_aws.py index ae9d910ea..fcabb6d86 100644 --- a/monkey/monkey_island/cc/services/remote_run_aws.py +++ b/monkey/monkey_island/cc/services/remote_run_aws.py @@ -131,7 +131,8 @@ class RemoteRunAwsService: return ( r"wget --no-check-certificate https://" + island_ip - + r":5000/api/monkey/download/monkey-linux-" + + r":5000/api/agent/download/linux " + + r"-O monkey-linux-" + bit_text + r"; chmod +x monkey-linux-" + bit_text @@ -148,9 +149,8 @@ class RemoteRunAwsService: r"[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {" r"$true}; (New-Object System.Net.WebClient).DownloadFile('https://" + island_ip - + r":5000/api/monkey/download/monkey-windows-" - + bit_text - + r".exe','.\\monkey.exe'); " + + r":5000/api/agent/download/windows'" + + r"'.\\monkey.exe'); " r";Start-Process -FilePath '.\\monkey.exe' " r"-ArgumentList 'm0nk3y -s " + island_ip + r":5000'; " ) diff --git a/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/commands/local_linux_curl.js b/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/commands/local_linux_curl.js index 6daf29f18..2f45ce457 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/commands/local_linux_curl.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/commands/local_linux_curl.js @@ -1,5 +1,5 @@ export default function generateLocalLinuxCurl(ip, username) { - let command = `curl https://${ip}:5000/api/monkey/download/linux -k ` + let command = `curl https://${ip}:5000/api/agent/download/linux -k ` + `-o monkey-linux-64; ` + `chmod +x monkey-linux-64; ` + `./monkey-linux-64 m0nk3y -s ${ip}:5000;`; diff --git a/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/commands/local_linux_wget.js b/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/commands/local_linux_wget.js index 2549c7272..d03b9a4f7 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/commands/local_linux_wget.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/commands/local_linux_wget.js @@ -1,5 +1,5 @@ export default function generateLocalLinuxWget(ip, username) { - let command = `wget --no-check-certificate https://${ip}:5000/api/monkey/download/` + let command = `wget --no-check-certificate https://${ip}:5000/api/agent/download/` + `linux -O ./monkey-linux-64; ` + `chmod +x monkey-linux-64; ` + `./monkey-linux-64 m0nk3y -s ${ip}:5000`; diff --git a/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/commands/local_windows_powershell.js b/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/commands/local_windows_powershell.js index ea068dfb5..8c194c252 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/commands/local_windows_powershell.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/commands/local_windows_powershell.js @@ -1,7 +1,7 @@ function getAgentDownloadCommand(ip) { return `$execCmd = @"\r\n` + `[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {\`$true};` - + `(New-Object System.Net.WebClient).DownloadFile('https://${ip}:5000/api/monkey/download/windows',` + + `(New-Object System.Net.WebClient).DownloadFile('https://${ip}:5000/api/agent/download/windows',` + `"""$env:TEMP\\monkey.exe""");Start-Process -FilePath '$env:TEMP\\monkey.exe' -ArgumentList 'm0nk3y -s ${ip}:5000';` + `\r\n"@; \r\n` + `Start-Process -FilePath powershell.exe -ArgumentList $execCmd`;