/
/
根据输入密码生成payload
proc yOZ7q {password {times
16000
}} {
set
::maui::util::H6VeX ""
set
::maui::util::EL0BW [string repeat \\
0
32
]
package require tcltwofish
package require sha256
set
BJvoG [qA4kM
32
]
set
passwordKey [qA4kM
32
]
set
ZQpQw [qA4kM [expr {
16
*
256
}]]
set
payloadIVsHash [sha2::sha256
-
bin
$ZQpQw]
set
encryptedPayloadIVs
"[qA4kM 32]$ZQpQw"
for
{
set
i
0
} {$i < $times} {incr i
64
} {
set
encryptedPayloadIVs [tcltwofish::encrypt $BJvoG $encryptedPayloadIVs]
}
set
iv [qA4kM
16
]
set
iHcWR [a64bL $password $passwordKey $iv $times]
set
encryptedKey [tcltwofish::encrypt $iHcWR
"[qA4kM 32]$BJvoG"
]
set
LZQjH [binary
format
Ia16a32a64a32a
*
$times $iv $passwordKey $encryptedKey $payloadIVsHash $encryptedPayloadIVs]
set
::maui::util::H6VeX $ZQpQw
set
::maui::util::EL0BW $BJvoG
return
$LZQjH
}
/
/
生成随机数据
proc qA4kM {length} {
set
YKL8w ""
if
{[RLPut unix]} {
foreach xML4B {
/
dev
/
urandom
/
dev
/
random} {
if
{[catch {
set
WyLEv [
open
$xML4B r]
fconfigure $WyLEv
-
translation binary
set
YKL8w [read $WyLEv $length]
close $WyLEv
}]} {
catch {close $WyLEv}
}
else
{
break
}
}
}
else
{
}
if
{[string length $YKL8w] !
=
$length} {
incr length
-
[string length $YKL8w]
while
{$length >
=
2
} {
append YKL8w [binary
format
S [expr {
int
([maui::util::rand]
*
0x10000
)}]]
incr length
-
2
}
if
{$length >
0
} {
append YKL8w [binary
format
c [expr {
int
([maui::util::rand]
*
0x100
)}]]
}
}
return
$YKL8w
}
proc rand {} {
if
{[maui::util::RLPut
"windows"
] && [info commands ::bitrock::secure::rand_s] !
=
""} {
if
{[catch {
set
r [::bitrock::secure::rand_s]
} V77Ls]} {
maui::util::debug
"failed to call rand_s: $V77Ls"
set
r [expr {rand()}]
}
}
else
{
set
r [expr {rand()}]
}
return
$r
}