Falldog / pyconcrete

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

Why can the code run correctly without "import pyconcrete" in the main.py? #64

Closed animebing closed 4 years ago

animebing commented 4 years ago

Thanks for your awesome work, which helps me a lot, but I still find something I can't understand. I use pyconcrete-admin.py to encrypt my all .py file except main.py, but when I run my code without import pyconcret in main.py, it can still run correctly, can you tell me why this happens, thanks anyway.

Falldog commented 4 years ago

I think you installed pyconcrete as site-packages, it will generate pyconcrete.pth in your site-packages, python will default load all *.pth at launch. So your main.py execute by default python executable, it will load pyconcrete.pth and then import pyconcrete automatically.

animebing commented 4 years ago

@Falldog Thank you for your quick reply, what should I do if I don't want this characteristic, may remove 'pyconcrete.pth'?

Falldog commented 4 years ago

You should follow the README https://github.com/Falldog/pyconcrete#partial-encrypted-pyconcrete-as-lib, install pyconcrete as local library rather than global package

You can uninstall pyconcrete or delete pyconcrete.pth to revise current environment

animebing commented 4 years ago

@Falldog I have deleted pyconcrete.pth and it works, maybe I should install it as a local library. I really appreciate your kind and quick reply.

animebing commented 4 years ago

@Falldog I am going to install pyconcrete in a shell script, but I don't want to input the passphrase during the process, so whether I can just simply add --install-option="--passphrase=<your passphrase>" after python setup.py install, thanks.

Falldog commented 4 years ago

@animebing for current pyconcreate installation behavior not allow setup passphrase after installation. Please make your shell script to use credentials mechanism to install pyconcrete.

for your reference: https://unix.stackexchange.com/questions/212329/hiding-password-in-shell-scripts

animebing commented 4 years ago

I don't mean to setup passphrase after installation, I just want to hardcode the passphrase in the shell script just like you do in pip install, but here I want to use python setup.py install instead of pip install.

获取 Outlook for Androidhttps://aka.ms/ghei36


From: Falldog notifications@github.com Sent: Wednesday, October 16, 2019 12:08:59 AM To: Falldog/pyconcrete pyconcrete@noreply.github.com Cc: Bingbing yanbing_dong@hotmail.com; Mention mention@noreply.github.com Subject: Re: [Falldog/pyconcrete] Why can the code run correctly without "import pyconcrete" in the main.py? (#64)

@animebinghttps://github.com/animebing for current pyconcreate installation behavior not allow setup passphrase after installation. Please make your shell script to use credentials mechanism to install pyconcrete.

for your reference: https://unix.stackexchange.com/questions/212329/hiding-password-in-shell-scripts

― You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Falldog/pyconcrete/issues/64?email_source=notifications&email_token=AEXOB4GYJDPE44XZX7PJLKTQOXTJXA5CNFSM4JA4Z72KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBJKZWI#issuecomment-542289113, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEXOB4ATX34MIYAQHNEUNFLQOXTJXANCNFSM4JA4Z72A.

Falldog commented 4 years ago

Well noted Please give it a try

python setup.py install --passphrase=<your passphrase>
animebing commented 4 years ago

@Falldog it works, thanks.