What you're talking about is re-deploying UPX in python with lots of stuff. What you need to do to do this: Change all VirtualAlloc calls to VirtualAllocEx calls. Change all Loadlibrary calls to loadlibraryEX calls. Implement move fixes.
The best approach would probably be to configure UPX to output the DLL instead of the executable. Then using some python dll injection code to transfer it to another process. You will work a lot with CTypes if you want to do this. Fair warning ...
source
share