Opy icon indicating copy to clipboard operation
Opy copied to clipboard

Bug: syntax error in obfuscated code when using multi-line string literals

Open janluke opened this issue 8 years ago • 3 comments

Code to replicate the issue:

print("This is a very very very long string argument "
      "splitted in two lines to demonstrate a bug")

or even:

s = ("This is a very very very long string argument "
     "splitted in two lines to demonstrate a bug")
print(s)

This is valid Python code. After obfuscation, the code contains a syntax error:

File "../code_opy/test.py", line 18
    l1l1lll1_opy_ (u"ࠨࡳࡱ࡮࡬ࡸࡹ࡫ࡤࠡ࡫ࡱࠤࡲࡵࡲࡦࠢ࡯࡭ࡳ࡫ࡳࠣࡤ"))
                ^
SyntaxError: invalid syntax

The same happens putting "\" at the end of every line.

janluke avatar Oct 03 '17 20:10 janluke

I am not sure I can make Opy's simplistic parser understand this. But I'll look into it. Thanks for the feedback!

JdeH avatar Oct 05 '17 06:10 JdeH

Still no good solution to this. Haven't completely given up, though.

JdeH avatar Dec 16 '17 13:12 JdeH

I found a similar question:

name = 'Eric' print(f'Hello, my name is {name}')

This is valid Python code. After obfuscation, the code contains a syntax error:

name = l11l1_opy_ (u"ࠫࡊࡸࡩࡤࠩࠀ") print(l11ll_opy_ (u"ࠬࡎࡥ࡭࡮ࡲ࠰ࠥࡳࡹࠡࡰࡤࡱࡪࠦࡩࡴࠢࡾࡲࡦࡳࡥࡾࠩࠁ"))

cause a error:

print(l11ll_opy_ (u"ࠬࡎࡥ࡭࡮ࡲ࠰ࠥࡳࡹࠡࡰࡤࡱࡪࠦࡩࡴࠢࡾࡲࡦࡳࡥࡾࠩࠁ")) NameError: name 'l11ll_opy_' is not defined

hiccuplp avatar Sep 21 '23 02:09 hiccuplp