mercredi 9 décembre 2020

How to extract non-function code from module?

I'm trying to extract all the "runnable" code given a function in a module. Right now I'm only able to extract the functions in any imported module that are called inside the starting function. However, some modules have "outside" expressions (i.e. some variables defined globally in the module, or functions called in the same level).

With inspect and dis I did the work to extract the functions, but, is there any way of extracting the "non-function" of a module?


If anybody wonders what am I doing, is a packer for python. What I want to achieve is that this tools only packs the required code given a starting function.

Also, if is there something already out there that does what I'm trying to achieve, I'd like to know.





Aucun commentaire:

Enregistrer un commentaire