Encrypting modules..

jbi130 at yahoo.com jbi130 at yahoo.com
Tue Feb 24 21:17:24 EST 2004


So I wrote a custom importer in C that loads in encrypted files,
decrypts, then unmarshals them and loads them as modules, there is
also a quick little compiler to generate our encrypted modules.

Works pretty good.  The intention is to distribute python modules and
limit access to the source.

My question now is, from the interpreter can a user extract the
bytecode from a loaded module (which could then be written to a file
and 'decompyled')?  If so, any effort I put into an encrypted module
loader has gone to waste (only 2 hours and worth the time to learn
about custom importers).  I don't mean to bring up an old thread about
hiding source, but searching google for getting bytecode from an in
memory module didn't bring up much.

If this is the case, is the only alternative to hack up the
interpreter and the bytecode in generates/reads?  Building python is
part of our build/distribution process so it would not be that big of
a deal.

Thanks!



More information about the Python-list mailing list