-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathProtect.ps1
48 lines (24 loc) · 913 Bytes
/
Protect.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
function SuperDecrypt
{
param($script)
$bytes = [Convert]::FromBase64String($script)
## XOR “encryption”
$xorKey = 0x42
for($counter = 0; $counter -lt $bytes.Length; $counter++)
{
$bytes[$counter] = $bytes[$counter] -bxor $xorKey
}
[System.Text.Encoding]::Unicode.GetString($bytes)
}
$decrypted = SuperDecrypt “FUIwQitCNkInQm9CCkItQjFCNkJiQmVCEkI1QixCJkJlQg==”
Invoke-Expression $decrypted
Write-Host 'dfsdfsdf'
Enable-PSScriptBlockLogging
Enable-PSScriptBlockInvocationLogging
$crt = dir Cert:\LocalMachine\My -DocumentEncryptionCert
New-SelfSignedCertificate -Subject '[email protected]' -Type DocumentEncryptionCertLegacyCsp
$p = 'Its my favotire certficate' | Protect-CmsMessage -To '*[email protected]*'
Get-CmsMessage $p
$p | Unprotect-CmsMessage
Enable-ProtectedEventLogging $crt
Disable-ProtectedEventLogging