2

I am attempting to obfuscate my python code with pyminifier. Generally I would use SAAS, however it is not within the budget of this small project nor is it feasible to host this as a server application. I have tried the following code:

pyminifier --nonlatin --replacement-length=50 C:/hi.py

Though when I edit the file it does not appear to be any different. The same can be said when I open with Uncompile6. Am I missing something? It changes in command line or appears to. If I distributed this through pyinstaller, the code appears to change in cmd but does not seem any different.

  • pyminifier doesn't change the source file, it sends its output to the terminal. You need to capture that output to a file yourself, eg by redirection. Why do you want to use `--replacement-length=50`? Surely shorter names would make the code more obfuscated. – PM 2Ring Nov 12 '17 at 15:13
  • @PM2Ring I see. That would explain why nothing has changed. There does does not seem to be much documentation on this, would you be able to provide an example? –  Nov 12 '17 at 15:19
  • I don't use Windows, but I'm pretty sure that standard redirection syntax works in your command prompt, eg `pyminifier -O --nonlatin --replacement-length=5 C:/hi.py >C:/newhi.py` – PM 2Ring Nov 12 '17 at 15:45
  • @PM2Ring My exact output is # Created by pyminifier`. Does not seem to obfuscate correctly. –  Nov 16 '17 at 07:01

1 Answers1

0

In default, pyminifier only make the file smaller(deleting unnecessary white spaces, comments....). You probably want to run:

pyminifier -O --nonlatin --replacement-length=50 C:/hi.py
Tomáš Šíma
  • 834
  • 7
  • 26
  • Apparently this does not change source, but there is an additional step of redirecting it. I can't find anything on that though. Perhaps converting to a pyz - like pyminifier --pyz=C:/hi1.pyz C:/hi1.py. It's produces an error though I have a large library of imports... –  Nov 12 '17 at 15:42
  • 1
    To be honest, this library is so out of date it's amazing it works at all xD –  Nov 27 '17 at 08:47
  • ﱟ=True ^ SyntaxError: invalid character in identifier – greendino Sep 27 '20 at 21:22