Falldog / pyconcrete

Protect your python script, encrypt it as .pye and decrypt when import it
Apache License 2.0
694 stars 149 forks source link

Decrypting .pye files #40

Closed ddfabbro closed 6 years ago

ddfabbro commented 6 years ago

I'm using pyconcrete as library using the example given in the README.

My project has the following structure:

.
└── myproject
    ├── main.py
    ├── pyconcrete
    └── src
        ├── module1.pye
        ├── module2.pye
        └── module3.pye

What is the process to decrypt module1.pye, module2.pye, etc, given that the passphrase is know?

Now, suppose I distribute myproject to end user.

What you be the process for them to decrypt module1.pye, module2.pye, etc?

Falldog commented 6 years ago

main.py need to import pyconcrete ex: example django manage.py

Once your script import pyconcrete, it will hook importer for decrypt .pye. So you must import pycocnrete before any module be encrypted as .pye

ddfabbro commented 6 years ago

I did so, and it works perfectly! But my question is, once I have my main.py working and remove all .py files, how can my .pye get decrypted by me using the passphrase I defined on setup step?

How about if I distribute myproject to end user, he will also have _pyconcrete.pyd. How do I know my code is safe? Where is this file and what can I do with it?

Falldog commented 6 years ago

As README mentioned, encrypt & decrypt secret key record in _pyconcrete.pyd (like DLL or SO) the secret key would be hidden in binary code, can't see it directly in HEX view.

There is always a way to decrypt .pye files, but pyconcrete just make it harder.