Skip to content

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

Open

Description

@janluke

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.

Activity

  1. JdeH commented on Oct 5, 2017

    @JdeH
    Member

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

  2. self-assigned this
    on Oct 5, 2017
  3. JdeH commented on Dec 16, 2017

    @JdeH
    Member

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

  4. hiccuplp commented on Sep 21, 2023

    @hiccuplp

    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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions