Hnfull / Intensio-Obfuscator

Obfuscate a python code 2.x and 3.x
MIT License
624 stars 129 forks source link

ModuleNotFoundError when using "import *" and -rfn obfuscating parameter #37

Closed mcastillof closed 4 years ago

mcastillof commented 4 years ago

Hello, when obfuscating filenames, i'm experiencing a ModuleNotFoundError error. Maybe I'm doing something wrong. I'm on Debian Testing amd64. Steps to reproduce:

Put this two files in a dir: File main.py:

import bye
bye.printMessage()

File bye.py:

def printMessage():
    print("See You Later Alligator")

After obfuscating the dir with -rfn parameter, if you try to run the file that corresponds to main.py, you will see:

python3 ./HShhZPALpXzosVYylDpXUnDtyoQWEYtdNOcWdYmgXLkRIUscGlCoqwFoZpTAZwbu.py 
Traceback (most recent call last):
  File "./HShhZPALpXzosVYylDpXUnDtyoQWEYtdNOcWdYmgXLkRIUscGlCoqwFoZpTAZwbu.py", line 1, in <module>
    import bye
ModuleNotFoundError: No module named 'bye'
mcastillof commented 4 years ago

Taking a look at your examples, I have seen that there was a difference in the way that I was importing. I'm using import *, you were using from * import *.

The following files are working.

File main.py:

from bye import printMessage
printMessage()

File bye.py:

def printMessage():
    print("See You Later Alligator")
Hnfull commented 4 years ago

thank you @mcastillof for this description of your issue, I will work to resolv it

mcastillof commented 4 years ago

Thanks to you. Seems a great tool :)

Hnfull commented 4 years ago

hi,

Intensio-Obfuscator tool currently don't support 2 types of import see -> https://github.com/Hnfull/Intensio-Obfuscator/blob/master/docs/malfunctions/python_code_malfunctions.md.

The only type of import supported is indeed from dir.file import function or from dir.file import class.

Your ModuleNotFoundError error was indeed an error in my code of an entry not removed in a dictionnary. Your import isn't supported by Intensio-Obfuscator, normally he should not have done the obfuscation of bye.py to avoid this type of error.

I close this issue, I reproduced this example and currently he handle it correctly.

It's also a important feature to add in this project, an issue is already created -> https://github.com/Hnfull/Intensio-Obfuscator/issues/30

Thank your for this return :)