python-obfuscator icon indicating copy to clipboard operation
python-obfuscator copied to clipboard

Obfuscation changes __name__ variable name

Open joaopfg opened this issue 3 years ago • 1 comments

I am trying to obfuscate a very simple file like the following:

from file1 import f1
from file2 import f2

if __name__ == "__main__":
    f1()
    f2()
    print("f3")

The __name__ variable name is converted to a garbage string and it avoids the program to run. Any idea where is the bug ? I can try a PR.

joaopfg avatar Jun 06 '22 14:06 joaopfg

It seems to me that the vars are renamed with a regex, so you would have to fully change how the script works. Renaming vars with a regex results in a lot of bugs, you should try tokenize or ast.

billythegoat356 avatar Jul 06 '22 15:07 billythegoat356