Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
janluke opened this issue Oct 3, 2017 · 3 comments

Comments

@janluke
Copy link

janluke commented Oct 3, 2017

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.

@JdeH
Copy link
Member

JdeH commented Oct 5, 2017

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

@JdeH
Copy link
Member

JdeH commented Dec 16, 2017

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

@hiccuplp
Copy link

hiccuplp commented Sep 21, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants