Hnfull / Intensio-Obfuscator

Obfuscate a python code 2.x and 3.x
MIT License
625 stars 127 forks source link

"EOL while scanning string literal" when working with strings with # symbol inside #39

Closed mcastillof closed 4 years ago

mcastillof commented 4 years ago

Seems like Intensio-Obfuscator is threating # symbols inside a string as comments.

Example code to reproduce the problem:

text = "hello#world"
print(text)

running Intensio-Obfuscator without arguments, I get:

[-] Need at least one argument [-rts] - [-ps] - [-rfn] - [-rth]
  File "/tmp/tesst/deploy1/main.py", line 1
    text = "hello
                ^
SyntaxError: EOL while scanning string literal

And running it with -v -ps:

********************* [ Analyze and setup environment ] **********************

[+] Running analyze input of 1 file(s)...

Analysis     |================================| 100%

[+] File input found :

-> /tmp/tesst/nuevo1/main.py

[+] Analyze input argument '/tmp/tesst/nuevo1' -> Successful
[!] Output '/tmp/tesst/deploy1' already exists, do you want delete it ? (Y/N) : 
[+] Running analyze output of 1 file(s)...

Analysis     |================================| 100%

[+] Output files copy :

-> /tmp/tesst/deploy1/main.py

[+] Analyze and setup output argument environment '/tmp/tesst/deploy1' -> Successful

********************** [ Obfuscation delete comments ] ***********************

[+] Running delete comments in 1 file(s)...

Obfuscation  |================================| 100%

Check        |================================| 100%

-> 1 lines of comments deleted

[+] Obfuscation delete comments -> Successful

******************** [ Obfuscation delete line space(s) ] ********************

Obfuscation  |================================| 100%

Check        |================================| 100%

[+] Obfuscation delete lines spaces -> Successful

******************* [ Correction padding empty class(es) ] *******************

Correction   |================================| 100%

[!] No empty class found in /tmp/tesst/deploy1

****************** [ Correction padding empty function(s) ] ******************

Correction   |================================| 100%

[!] No empty function found in /tmp/tesst/deploy1

************ [ Obfuscation replace string(s) to string(s) mixed ] ************

[!] Obfuscation [ replace string to string ] mixed no asked !

****************** [ Obfuscation adding padding script(s) ] ******************

[+] Running add of random scripts in 1 file(s)...

Setting up   |================================| 100%

Obfuscation  |================================| 100%

Check        |================================| 100%

-> 1 scripts added in 1 file(s)

-> 10 lines added in 1 file(s)

[+] Obfuscation padding script -> Successful

******************** [ Obfuscation replace file(s) name ] ********************

[!] Obfuscation [ replace file name ] feature no asked !

****************** [ Obfuscation replace string(s) to hex ] ******************

[!] Obfuscation [ replace string to hex ] feature no asked !

******************** [ Obfuscation delete line space(s) ] ********************

Obfuscation  |================================| 100%

Check        |================================| 100%

[+] Obfuscation delete lines spaces of padding scripts-> Successful

********************* [ Correction delete .pyc file(s) ] *********************

[!] No .pyc file(s) found in /tmp/tesst/deploy1

  File "/tmp/tesst/deploy1/main.py", line 1
    text = "hello
                ^
SyntaxError: EOL while scanning string literal
Hnfull commented 4 years ago

Hi @mcastillof,

You find a pretty issue ! I will work to resolv it.

Thank you

Hnfull commented 4 years ago

I fixed issue, This bug was a bad regular expression to detect comments to be deleted Thank for this return