liftoff / pyminifier

Pyminifier is a Python code minifier, obfuscator, and compressor.
GNU General Public License v3.0
1.45k stars 224 forks source link

obfuscate class methods fails #19

Open kotlet-schabowy opened 9 years ago

kotlet-schabowy commented 9 years ago

Hi ,

I am figthing the following problem. Looks like a bug, does it?

class GO(object):
    def __init__(self):
        self.counter = {}
        self.setup()
        self.run()

    def setup(self):
        self.queue = multiprocessing.Queue()  

    def run(self):
        pass

def main():
    c = GO()

will result in:

class GO(m):
m=object
 def __init__(C):
  C.counter = {}
  C.setup()
  C.run()
 def Q(C):
  C.queue = t.Queue()
 def I(C):
  pass
def v():
 c = GO()
# Created by pyminifier (https://github.com/liftoff/pyminifier)

The method setup is being obfuscated in the definition but not in the the call in def init

I am using the following command line:

c:\>c:\python27\scripts\pyminifier.exe --obfuscate-functions --obfuscate-variables --obfuscate-import-methods --obfuscate-builtins test_pyminifier.py > test_pyminifier_mini.py
yilmazdurmaz commented 5 years ago

this same problem can be seen in the very example on the help page, where the "test" method has not been renamed to anything. problem is in obfuscating procedure itself in the minifier.

it is already 4 years since last commits, so i do not expect someone to fix it in near future. however, it is still a very useful tool for basic minimization for the production environment.