Island: Change agent binary download endpoint

This commit is contained in:
Shreya Malviya 2022-06-02 17:32:40 +05:30
parent ed1e152e9c
commit 662fc6b50e
5 changed files with 6 additions and 8 deletions

View File

@ -20,9 +20,7 @@ class UnsupportedOSError(Exception):
class AgentBinaries(AbstractResource):
# API Spec: Rename to /api/agent-binaries, because information about agent runs
# and binary files are different resources
urls = ["/api/agent/download/<string:host_os>"]
urls = ["/api/agent-binaries/<string:host_os>"]
# Used by monkey. can't secure.
def get(self, host_os):

View File

@ -60,7 +60,7 @@ def _get_run_agent_command(target_os: str, island_ip: str):
def _get_run_monkey_cmd_linux_line(island_ip):
binary_name = "monkey-linux-64"
download_url = f"https://{island_ip}:5000/api/agent/download/linux"
download_url = f"https://{island_ip}:5000/api/agent-binaries/linux"
download_cmd = f"wget --no-check-certificate {download_url} -O {binary_name}"
chmod_cmd = f"chmod +x {binary_name}"
@ -76,7 +76,7 @@ def _get_run_monkey_cmd_windows_line(island_ip):
"[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}"
)
download_url = f"https://{island_ip}:5000/api/agent/download/windows"
download_url = f"https://{island_ip}:5000/api/agent-binaries/windows"
download_cmd = (
f"(New-Object System.Net.WebClient).DownloadFile('{download_url}', '{agent_exe_path}')"
)

View File

@ -1,5 +1,5 @@
export default function generateLocalLinuxCurl(ip, username) {
let command = `curl https://${ip}:5000/api/agent/download/linux -k `
let command = `curl https://${ip}:5000/api/agent-binaries/linux -k `
+ `-o monkey-linux-64; `
+ `chmod +x monkey-linux-64; `
+ `./monkey-linux-64 m0nk3y -s ${ip}:5000;`;

View File

@ -1,5 +1,5 @@
export default function generateLocalLinuxWget(ip, username) {
let command = `wget --no-check-certificate https://${ip}:5000/api/agent/download/`
let command = `wget --no-check-certificate https://${ip}:5000/api/agent-binaries/`
+ `linux -O ./monkey-linux-64; `
+ `chmod +x monkey-linux-64; `
+ `./monkey-linux-64 m0nk3y -s ${ip}:5000`;

View File

@ -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/agent/download/windows',`
+ `(New-Object System.Net.WebClient).DownloadFile('https://${ip}:5000/api/agent-binaries/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`;