18 lines
326 B
Go
18 lines
326 B
Go
|
package powershell
|
||
|
|
||
|
import (
|
||
|
"encoding/base64"
|
||
|
)
|
||
|
|
||
|
func powershellEncode(buffer []byte) string {
|
||
|
// 2 byte chars to make PowerShell happy
|
||
|
wideCmd := ""
|
||
|
for _, b := range buffer {
|
||
|
wideCmd += string(b) + "\x00"
|
||
|
}
|
||
|
|
||
|
// Base64 encode the command
|
||
|
input := []uint8(wideCmd)
|
||
|
return base64.StdEncoding.EncodeToString(input)
|
||
|
}
|