forked from guardicore/monkey
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request guardicore#838 from shreyamalviya/add-run-as-user-…
…option Add option to run as a certain user on the Run Monkey page
- Loading branch information
Showing
5 changed files
with
74 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 11 additions & 8 deletions
19
monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/commands/local_linux_curl.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
import {OS_TYPES} from '../utils/OsTypes'; | ||
|
||
|
||
export default function generateLocalLinuxCurl(ip, osType) { | ||
let bitText = osType === OS_TYPES.LINUX_32 ? '32' : '64'; | ||
return `curl https://${ip}:5000/api/monkey/download/monkey-linux-${bitText} -k | ||
-o monkey-linux-${bitText}; | ||
chmod +x monkey-linux-${bitText}; | ||
./monkey-linux-${bitText} m0nk3y -s ${ip}:5000\`;`; | ||
} | ||
|
||
export default function generateLocalLinuxCurl(ip, osType, username) { | ||
let bitText = osType === OS_TYPES.LINUX_32 ? '32' : '64'; | ||
let command = `curl https://${ip}:5000/api/monkey/download/monkey-linux-${bitText} -k ` | ||
+ `-o monkey-linux-${bitText}; ` | ||
+ `chmod +x monkey-linux-${bitText}; ` | ||
+ `./monkey-linux-${bitText} m0nk3y -s ${ip}:5000;`; | ||
|
||
if (username != '') { | ||
command = `su - ${username} -c "${command}"`; | ||
} | ||
|
||
return command; | ||
} |
18 changes: 12 additions & 6 deletions
18
monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/commands/local_linux_wget.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
import {OS_TYPES} from '../utils/OsTypes'; | ||
|
||
|
||
export default function generateLocalLinuxWget(ip, osType) { | ||
let bitText = osType === OS_TYPES.LINUX_32 ? '32' : '64'; | ||
return `wget --no-check-certificate https://${ip}:5000/api/monkey/download/ | ||
monkey-linux-${bitText}; | ||
chmod +x monkey-linux-${bitText}; | ||
./monkey-linux-${bitText} m0nk3y -s ${ip}:5000`; | ||
export default function generateLocalLinuxWget(ip, osType, username) { | ||
let bitText = osType === OS_TYPES.LINUX_32 ? '32' : '64'; | ||
let command = `wget --no-check-certificate https://${ip}:5000/api/monkey/download/` | ||
+ `monkey-linux-${bitText}; ` | ||
+ `chmod +x monkey-linux-${bitText}; ` | ||
+ `./monkey-linux-${bitText} m0nk3y -s ${ip}:5000`; | ||
|
||
if (username != '') { | ||
command = `su - ${username} -c "${command}"`; | ||
} | ||
|
||
return command; | ||
} |
16 changes: 11 additions & 5 deletions
16
monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/commands/local_windows_cmd.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
import {OS_TYPES} from '../utils/OsTypes'; | ||
|
||
|
||
export default function generateLocalWindowsCmd(ip, osType) { | ||
export default function generateLocalWindowsCmd(ip, osType, username) { | ||
let bitText = osType === OS_TYPES.WINDOWS_32 ? '32' : '64'; | ||
return `powershell [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}; | ||
(New-Object System.Net.WebClient).DownloadFile('https://${ip}:5000/api/monkey/download/ | ||
monkey-windows-${bitText}.exe','.\\monkey.exe'); | ||
;Start-Process -FilePath '.\\monkey.exe' -ArgumentList 'm0nk3y -s ${ip}:5000';`; | ||
let command = `powershell [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}; ` | ||
+ `(New-Object System.Net.WebClient).DownloadFile('https://${ip}:5000/api/monkey/download/ ` | ||
+ `monkey-windows-${bitText}.exe','.\\monkey.exe'); ` | ||
+ `;Start-Process -FilePath '.\\monkey.exe' -ArgumentList 'm0nk3y -s ${ip}:5000';`; | ||
|
||
if (username != '') { | ||
command = `runas /user:${username} "cmd /K ${command}"`; | ||
} | ||
|
||
return command; | ||
} |
16 changes: 11 additions & 5 deletions
16
...nkey_island/cc/ui/src/components/pages/RunMonkeyPage/commands/local_windows_powershell.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
import {OS_TYPES} from '../utils/OsTypes'; | ||
|
||
|
||
export default function generateLocalWindowsPowershell(ip, osType) { | ||
export default function generateLocalWindowsPowershell(ip, osType, username) { | ||
let bitText = osType === OS_TYPES.WINDOWS_32 ? '32' : '64'; | ||
return `[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}; | ||
(New-Object System.Net.WebClient).DownloadFile('https://${ip}:5000/api/monkey/download/ | ||
monkey-windows-${bitText}.exe','.\\monkey.exe'); | ||
;Start-Process -FilePath '.\\monkey.exe' -ArgumentList 'm0nk3y -s ${ip}:5000';`; | ||
let command = `[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}; ` | ||
+ `(New-Object System.Net.WebClient).DownloadFile('https://${ip}:5000/api/monkey/download/ ` | ||
+ `monkey-windows-${bitText}.exe','.\\monkey.exe'); ` | ||
+ `;Start-Process -FilePath '.\\monkey.exe' -ArgumentList 'm0nk3y -s ${ip}:5000';`; | ||
|
||
if (username != '') { | ||
command = `Start-Process powershell.exe -ArgumentList "-noexit ${command}" -Credential ${username}`; | ||
} | ||
|
||
return command; | ||
} |