Search code examples
pythonencryptionpassword-encryption

Let someone run your code, but not see it


Description

I'm curious if there is a way to let someone run your python code, but

  • Without having to give them the python file. --> Ex. get_curl.py
  • Not allow that person see what inside the code. I'm thinking of an encrypted python file. But if we encrypt it, how can python execute it.

Attempt

I've tried post my sample code on github gist and use curl and pipe into it. But then my URL is there, so they could have see the file, if they visited that URL.

https://gist.githubusercontent.com/bheng/b23d775ee7b106cd7cc0ae5ac71b81a9/raw/c6ecd3ed7bc04699d73e1b9ed521f481ac6a41c4/get_curl.py

curl "https://gist.githubusercontent.com/bheng/b23d775ee7b106cd7cc0ae5ac71b81a9/raw/c6ecd3ed7bc04699d73e1b9ed521f481ac6a41c4/get_curl.py" -s -N > cool; python cool

Questions

Is this something that is not possible ?

Or is this something that can be achievable via library / plug-in / framework?


Solution

  • This is not possible. See this paper:

    https://www.math.ias.edu/csdm/files/Archives/11-12/rimpagliazzo_on_the_impossibility_obfuscating_programs.pdf