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

Running pyconcrete in Electron. #55

Closed TaeyoonKwon closed 5 years ago

TaeyoonKwon commented 5 years ago

I am trying to use Electron as a GUI to run python scripts inside as child-processes.

Would it be possible to encrypt all .py files to .pye then run it in Electron?

Since .pye file has to be executed by pyconcrete.exe, I am guessing that I have to include pyconcrete.exe and run the codes when the process starts.

I am trying to distribute Electron apps to the users who have no Python installed.

But then I have to compile python codes with PyInstaller, which doesn't seem to be possible with .pye files.

Is there any way to accomplish both pyconcrete encryption and making the codes executable in Electron?

Falldog commented 5 years ago

Electron is JS framework right? So you just want to distribute standalone python app which encrypt by pyconcrete

As I know, PyInstaller or py2exe or others, which will package all .py into a zip file And the py loader is customized, the way is conflict with pyconcrete So I think pyocncrte can't be used by PyInstaller or py2exe

If you use python3 Maybe zipapp is a solution, but I'm not sure the implementation solution is same as PyInstaller or not and there is another issue talk about it Support for Python zipapp module #54

Need sometime to investigate it

TaeyoonKwon commented 5 years ago

Electron is JS framework right?

Yes, it is. I am trying to run some python modules as a child processes of ElectronJS.

The reason I am trying to use pyconcrete here is because algorithms inside my python modules are quite important. I am trying to do the best encryption I can do with Python (even though Python is not a good language for code hiding) and pyconcrete is the best possible way I've found.

So if PyInstaller(and other tools) is not compatible with pyconcrete, I guess I have to give up making them excutable and distribute Python and all dependencies seperately.

Then I have another question here,

If I start Python child process in electron, Is it cross-platform (Windows, Mac and Linux) to send system message "pyconcrete main.pye" to start a Python process? Will I need to run my Electron App as admin for it?

Falldog commented 5 years ago

If I start Python child process in electron, Is it cross-platform (Windows, Mac and Linux) to send

system message "pyconcrete main.pye" to start a Python process? Reference https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback It should be work with below code exec('"pyconcrete main.pye', {cwd: "Your main.pye location dir"});

Will I need to run my Electron App as admin for it?

pycocnrete doesn't need admin privilege to do execution

erm3nda commented 2 years ago

Since .pye file has to be executed by pyconcrete.exe This is a bit false, you can import pye modules from within python, importing pyconcrete. The pyconcrete.exe is meant to be used as facility launcher, and probably it's a strippped down binary of the module itself.

You need to add pye files as data in pyconcrete config, so the compiled program can import them later.

The version and password from your system pyconcrete install will be added to the compiled binary. Be sure you install a pyconcrete with a password that satisfies you, because it has a default one :-) and you must setup it properly.