Encrypt python files

Denis McMahon denismfmcmahon at gmail.com
Fri May 8 06:59:10 EDT 2015


On Wed, 06 May 2015 00:23:39 -0700, Palpandi wrote:

> On Wednesday, May 6, 2015 at 12:07:13 PM UTC+5:30, Palpandi wrote:
>> Hi,
>> 
>> What are the ways to encrypt python files?
> 
> No, I just want to hide the scripts from others.

You can do that by deleting the scripts. Make sure you use a secure 
deletion tool.

I'm not aware of any mechanism for encrypted executable python scripts. 
You can obfuscate the code, but you can't encrypt it because the python 
interpreter needs the script file to execute it.

The same holds true for any mechanism designed to encrypt executable code 
regardless of whether it's script or compiled. At the lowest level the 
processor only understands the instruction set, and encrypted code has to 
be decrypted to execute.

As the decryption method is always available to anyone who has legitimate 
access to execute the code, it's impossible to hide the code at that 
point.

Example - if I give you an encrypted binary to run on your system, it 
either has to be unencryptable using tools you already have, or using a 
built in unencrypter, both of which you have access to and can use to 
unencrypt the encrypted executable code.

-- 
Denis McMahon, denismfmcmahon at gmail.com



More information about the Python-list mailing list