You know that a python file converted to an exe file can be deciphered and its codes can be displayed.
What is the way to prevent this decryption event? I don't want to people see the codes.
You can use Nuitka to convert .py file into a C-based standalone executable. Then, pass a resulting .exe file through VMProtect to obfuscate the binaries.
Related
I have created one python file recently and then I added login system in it with date validation.
I obfuscate it by using pyarmor pyarmor obfuscate foo.py and given to my paid users.
They run my file and they got one foo.pyc file and then they opened it and they got my all code in binary digits but they can bypass my login system and they can use my file for lifetime. What can I do to hide my python file and foo.pyc? If i will use pyarmor pack foo.py it will converted into .exe file so they can get my source code? they will get .pyc file?
When I try to convert obfuscated python file to exe using pyarmor it shows an error DO NOT pack the obfuscated script, please pack the original script directly if I will try to obfuscate original file directly it will come in decrypted pattern or encrypted pattern?
Use pyarmor pack foo.py but I am not sure that they can wether decrypt or not.
For example, I have a Python file like this:
print("Hello World")
Now I am converting it to an .exe file using pyinstaller.
But I found a method to convert it back:
Use pyinstxtractor.py:
python pyinstxtractor.py yourFileName.exe
This will extract .exe and create a folder named yourFileName.exe_extracted.
Inside the yourFileName.exe_extracted folder, find the file without
any extension.
Edit it with HxD editor and from any pycache file created with the
same version of Python, copy the first row and insert it into your
file.
Save and Rename the file with .pyc extension.
Decompile the compiled bytecode (.pyc) to .py using any online tool,
like https://www.toolnb.com/tools-lang-en/pyc.html
Is there any way to prevent converting the .exe file converting back to his .py file?
Thanks.
You can use an obfuscation tool such as PyArmor and add at-least some level of code-protection to your original python script.
The official documentation of PyArmor has more info on this here https://pyarmor.readthedocs.io/en/latest/advanced.html#bundle-obfuscated-scripts-to-one-executable-file
Accidentally deleted the python code, all i have is a single unix executable file generate by pyinstaller.
Is there a way to reverse this and to extract my code ?
I have an .exe file where file compiled by py2exe in my .exe folder I have some .dll files, one .exe file and library.zip file and inside this zip I have to many .pyccompiled files.
I have decompiled this files from library.zip using Easy Python Decompiler and that program created me new file where I can see and change my code.
I have opened this file where I needed and I changed my code using python editor and finaly I saved as new script code with the some name and extension .pyc
with purpose to replace first .pyc.
zip again library folder and I tried to run .exe prgram but after the changes the program doesn't execute.
What have I done wrong in my task? Do I need to re-compile again in some way?
pyc and py file are NOT the same. While they represent the same code, they are totally different :
the py file represents the code you are typing, can be interpreted by the python interpreter, is not native, and is portable
the pyc file is a compiled version of the py file, that is not portable, not intended to be modified by an human, but faster
You cannot swap them and expect it to work. You will need to compile it to pyc before. You will find more information here : How can I manually generate a .pyc file from a .py file
I made a python script that saves its output into a .text file. The .text file contents is scrambled but the python script I made can unscramble the text. If I use py2exe to make the script an .exe file, will others be able to see the script it uses to unscramble the text if they have a copy of the .exe file?
Py2Exe packages your script with a standalone Python interpreter, but under normal circumstances won't "compile" it.
Viewing the source code for a Py2Exe package executable would be trivial.