[Question] How to edit script after being obfuscated
AI-M-BOT opened this issue · comments
New Pyarmor 8.x has much stronger encryption than all previous versions.
Except for rft issues, i just wanna ask if i can still edit obfuscated scripts like Pyarmor 7.x
Now obfuscated scripts looks like this:
# Pyarmor 8.5.9 (pro), 00XXXX, CV, 2024-05-20T18:55:39.117816
from pyarmor_runtime_00XXXX import __pyarmor__
__pyarmor__(__name__, __file__, b'PY00XXXX...')
If i add lines bufore from pyarmor_runtime_00XXXX import __pyarmor__
like
def trash_func():
from secrets import randbelow
return ['some trash to change md5 of py file'] * randbelow(10)
It will return
Traceback (most recent call last):
File "<frozen __main__>", line 1, in <module>
RuntimeError: unauthorized use of script (1:1102)
So i know it is a designed protection.
However i do have demand to obfuscate the encrypted scripts for distribution like what i did using Pyarmor 7.x . So i am here to ask, is there any way or command to bypass and achieve my goal?
Please check online doc in the topic part: understand obfuscated scripts
Of course i checked, and after using pyarmor cfg restrict_module 0
, still i cannot slightly edit my scripts like adding useless functions.
The document states:
By default the obfuscated scripts can’t be changed.
...
...
...
Disable all the restrictions by this command:
pyarmor cfg restrict_module 0
By default ... Does that mean under certain conditions it is still changeable???
Reproduced, I'll check it.
Sorry, I made a mistake. It could not be reproduced.
The following example works fine:
pyarmor cfg restrict_module = 0
pyarmor gen foo.py
echo "i = 1" >> dist/foo.py
python dist/foo.py