Donut is arguably the most popular tool for this task today. It takes a PE file (EXE/DLL) and generates position-independent shellcode. Donut creates a small assembly stub that acts as the reflective loader described above. It supports both .NET and native PE files.
import subprocess