I am investigating one suspicious program we have been using for months. After some complex code it dynamically generates an object (type() get <type 'code'>
) and then executes it with exec
. This is where I got lost. I have a tool for decompiling whole pyc compiled file, but I don't know how to decompile a dynamically generated object within a running program.
I can print it (nice bytecode there), I can write it to file. I tried to write it to a file and running pyc decompiler on it, but since it was bytecode of just one object and not full valid pyc program, it failed