Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Can i encrypt my python program code?

Can i encrypt my python program code , so if i gave it to someone he might change the credits and pretend that he is the one who made this program.
I don't think you can "truly" encrypt a python program, but you can do

Code
python -OO -m py_compile yourFile.py
in the terminal and it will produce folder and in that folder there is a file that contains byte code, it's probably reversible I haven't looked much into it but it should work, also don't forget to rename the file extension back to .py from .pyc
i like python lua js
(Feb 5, 2018 05:08 AM)Riԁdle Wrote:  I don't think you can "truly" encrypt a python program, but you can do

Code
python -OO -m py_compile yourFile.py
in the terminal and it will produce folder and in that folder there is a file that contains byte code, it's probably reversible I haven't looked much into it but it should work, also don't forget to rename the file extension back to .py from .pyc

Thank you so much .. 🤝
(Feb 5, 2018 05:08 AM)Riԁdle Wrote:  I don't think you can "truly" encrypt a python program, but you can do

Code
python -OO -m py_compile yourFile.py
in the terminal and it will produce folder and in that folder there is a file that contains byte code, it's probably reversible I haven't looked much into it but it should work, also don't forget to rename the file extension back to .py from .pyc

As far as I know, that is as good as it gets. Only other option would be to run it as a SAAS application.
(Feb 5, 2018 01:32 PM)Charger Wrote:  As far as I know, that is as good as it gets. Only other option would be to run it as a SAAS application.

What do you mean by SAAS application?
(Feb 6, 2018 02:53 PM)DrollBeack18100 Wrote:  What do you mean by SAAS application?

As in Software as a Service. You host the app and then clients hit it via an API (normally).
Thank you all 🤝 . Does this code 'python -OO -m py_compile yourFile.py' can decrease the probability of detecting the malware?
And how can we decrypt it back?
(Feb 7, 2018 02:13 AM)DrollBeack18100 Wrote:  Thank you all 🤝 . Does this code 'python -OO -m py_compile yourFile.py' can decrease the probability of detecting the malware?
And how can we decrypt it back?

Nope, if anything it might increase the chance of false positives. This will probably only occur with lower-end anti-viruses.
(Feb 5, 2018 05:08 AM)Riԁdle Wrote:  I don't think you can "truly" encrypt a python program, but you can do

Code
python -OO -m py_compile yourFile.py
in the terminal and it will produce folder and in that folder there is a file that contains byte code, it's probably reversible I haven't looked much into it but it should work, also don't forget to rename the file extension back to .py from .pyc


Thank you for this! simple to the point solution to a problem I was having the other day.
Signature comingsoon. Just know, Im cool af ;)
You could also encrypt your code as a string, then use 'exec(string)', though doing so could be problematic as you would also need to include the decryption key within the source


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by Bass_ReevesAug 20, 2023 01:44 AM 9 632 Aug 20, 2023 01:44 AM
Last Post: Lucky4L
[Python] by mikehackMay 9, 2022 11:12 AM 2 151 May 9, 2022 11:12 AM
Last Post: mikehack
[C] by FhackMar 19, 2022 04:11 PM 27 972 Mar 19, 2022 04:11 PM
Last Post: focuswow35