forked from p15670423/monkey
Island: Change agent binary download endpoint
This commit is contained in:
parent
ed1e152e9c
commit
662fc6b50e
|
@ -20,9 +20,7 @@ class UnsupportedOSError(Exception):
|
||||||
|
|
||||||
|
|
||||||
class AgentBinaries(AbstractResource):
|
class AgentBinaries(AbstractResource):
|
||||||
# API Spec: Rename to /api/agent-binaries, because information about agent runs
|
urls = ["/api/agent-binaries/<string:host_os>"]
|
||||||
# and binary files are different resources
|
|
||||||
urls = ["/api/agent/download/<string:host_os>"]
|
|
||||||
|
|
||||||
# Used by monkey. can't secure.
|
# Used by monkey. can't secure.
|
||||||
def get(self, host_os):
|
def get(self, host_os):
|
||||||
|
|
|
@ -60,7 +60,7 @@ def _get_run_agent_command(target_os: str, island_ip: str):
|
||||||
def _get_run_monkey_cmd_linux_line(island_ip):
|
def _get_run_monkey_cmd_linux_line(island_ip):
|
||||||
binary_name = "monkey-linux-64"
|
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}"
|
download_cmd = f"wget --no-check-certificate {download_url} -O {binary_name}"
|
||||||
|
|
||||||
chmod_cmd = f"chmod +x {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}"
|
"[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 = (
|
download_cmd = (
|
||||||
f"(New-Object System.Net.WebClient).DownloadFile('{download_url}', '{agent_exe_path}')"
|
f"(New-Object System.Net.WebClient).DownloadFile('{download_url}', '{agent_exe_path}')"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
export default function generateLocalLinuxCurl(ip, username) {
|
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; `
|
+ `-o monkey-linux-64; `
|
||||||
+ `chmod +x monkey-linux-64; `
|
+ `chmod +x monkey-linux-64; `
|
||||||
+ `./monkey-linux-64 m0nk3y -s ${ip}:5000;`;
|
+ `./monkey-linux-64 m0nk3y -s ${ip}:5000;`;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
export default function generateLocalLinuxWget(ip, username) {
|
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; `
|
+ `linux -O ./monkey-linux-64; `
|
||||||
+ `chmod +x monkey-linux-64; `
|
+ `chmod +x monkey-linux-64; `
|
||||||
+ `./monkey-linux-64 m0nk3y -s ${ip}:5000`;
|
+ `./monkey-linux-64 m0nk3y -s ${ip}:5000`;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
function getAgentDownloadCommand(ip) {
|
function getAgentDownloadCommand(ip) {
|
||||||
return `$execCmd = @"\r\n`
|
return `$execCmd = @"\r\n`
|
||||||
+ `[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {\`$true};`
|
+ `[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';`
|
+ `"""$env:TEMP\\monkey.exe""");Start-Process -FilePath '$env:TEMP\\monkey.exe' -ArgumentList 'm0nk3y -s ${ip}:5000';`
|
||||||
+ `\r\n"@; \r\n`
|
+ `\r\n"@; \r\n`
|
||||||
+ `Start-Process -FilePath powershell.exe -ArgumentList $execCmd`;
|
+ `Start-Process -FilePath powershell.exe -ArgumentList $execCmd`;
|
||||||
|
|
Loading…
Reference in New Issue