-
Notifications
You must be signed in to change notification settings - Fork 329
Closed
Labels
Description
Stripped down example script:
def init():
def assert_builtin(func):
return func
import sys
import builtins
isinstance = assert_builtin(builtins.isinstance)
ord = assert_builtin(builtins.ord)
pow = assert_builtin(builtins.pow)
len = assert_builtin(builtins.len)
globals = assert_builtin(builtins.globals)
exc_info = assert_builtin(sys.exc_info)
try:
undefined
except NameError:
frozen = False
__dict__ = globals()
__name__ = __dict__['__name__']
import textwrap
def load():
def foo(name=None):
"""foo"""
def bar(name):
try:
_hash = get_hash(module.load)
except Exception:
raise
init()
print('done')
Obfuscated with Pyarmor 9.0.8 under Linux / Python 3.13:
> pyarmor cfg wrap_mode=2 clear_frame_locals=1
> pyarmor gen -i -O ./dist ./myscript.py
The execution of the obfuscated script results most of the time in a segmentation fault, but sometimes also with the error:
Traceback (most recent call last):
File "<frozen myscript>", line 38, in <module>
SystemError: no locals found
It works without issues if you remove some random statements from the script. Also generally no issues with other Python versions.