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]使用约束模式 1和约束模式 4 的加密方式时在Linux.aarch64平台上报错 #897

Closed
LVguomin opened this issue Dec 13, 2022 · 2 comments

Comments

@LVguomin
Copy link

跨平台使用约束模式1和约束模式4进行加密时,在Linux.aarch64平台上编译完成后,运行报错,但编译后的代码在windows.x86_64 和 linux.x86_64平台上可以正常运行。

以下时加密步骤:
执行加密命令1:
pyarmor obfuscate -O waterFlow_proj/waterFlow --platform windows.x86_64 --platform linux.x86_64 --platform linux.aarch64 --advanced 1 --restrict 1 --exact init.py

INFO PyArmor Version 7.7.0
INFO Python 3.8.10
WARNING "--advanced 1" is deprecated for Python 3.8, use "--advanced 2" instead
INFO Target platforms: ['windows.x86_64', 'linux.x86_64', 'linux.aarch64']
INFO Update target platforms to: ['windows.x86_64.7', 'linux.x86_64.7', 'linux.aarch64.3']
INFO Source path is "/mnt/hdisk/opt/watersystem/waterFlow_src"
INFO Entry scripts are ['init.py']
INFO Use cached capsule /home/khadas/.pyarmor/.pyarmor_capsule.zip
INFO Search scripts mode: Exact
INFO Save obfuscated scripts to "waterFlow_proj/waterFlow"
INFO Read product key from capsule
INFO Obfuscate module mode is 2
INFO Obfuscate code mode is 1
INFO Obfuscate string value is False
INFO Wrap mode is 1
INFO Restrict mode is 1
INFO Advanced value is 1
INFO Super mode is False
INFO Super plus mode is not enabled
INFO Generating runtime files to waterFlow_proj/waterFlow/pytransform
INFO Extract pytransform.key
INFO Read default license from capsule
INFO Create library path to support multiple platforms: waterFlow_proj/waterFlow/pytransform/platforms
INFO Copying /home/khadas/.pyarmor/platforms/windows/x86_64/7/_pytransform.dll
INFO To waterFlow_proj/waterFlow/pytransform/platforms/windows/x86_64
INFO Patch library waterFlow_proj/waterFlow/pytransform/platforms/windows/x86_64/_pytransform.dll
INFO Patch library file OK
INFO Copying /home/khadas/.pyarmor/platforms/linux/x86_64/7/_pytransform.so
INFO To waterFlow_proj/waterFlow/pytransform/platforms/linux/x86_64
INFO Patch library waterFlow_proj/waterFlow/pytransform/platforms/linux/x86_64/_pytransform.so
INFO Patch library file OK
INFO Copying /home/khadas/.pyarmor/platforms/linux/aarch64/3/_pytransform.so
INFO To waterFlow_proj/waterFlow/pytransform/platforms/linux/aarch64
INFO Patch library waterFlow_proj/waterFlow/pytransform/platforms/linux/aarch64/_pytransform.so
INFO Patch library file OK
INFO Copying /home/khadas/.local/lib/python3.8/site-packages/pyarmor/pytransform.py
INFO Rename it to pytransform/init.py
INFO Generate runtime files OK
INFO Start obfuscating the scripts...
INFO /mnt/hdisk/opt/watersystem/waterFlow_src/init.py -> waterFlow_proj/waterFlow/init.py
INFO Insert bootstrap code to entry script waterFlow_proj/waterFlow/init.py
INFO Obfuscate 1 scripts OK.

执行加密命令2:
pyarmor obfuscate -O waterFlow_proj/waterFlow --platform windows.x86_64 --platform linux.x86_64 --platform linux.aarch64 --advanced 1 --restrict 4 -recursive --exclude init.py .

INFO PyArmor Version 7.7.0
INFO Python 3.8.10
WARNING "--advanced 1" is deprecated for Python 3.8, use "--advanced 2" instead
INFO Target platforms: ['windows.x86_64', 'linux.x86_64', 'linux.aarch64']
INFO Update target platforms to: ['windows.x86_64.7', 'linux.x86_64.7', 'linux.aarch64.3']
WARNING Option --entry has been deprecated
INFO Source path is "/mnt/hdisk/opt/watersystem/waterFlow_src"
INFO Entry scripts are ['cursive']
INFO Use cached capsule /home/khadas/.pyarmor/.pyarmor_capsule.zip
INFO Search scripts mode: Recursive
INFO Exclude pattern "init.py"
INFO Auto exclude output path "waterFlow_proj/waterFlow"
INFO Save obfuscated scripts to "waterFlow_proj/waterFlow"
INFO Read product key from capsule
INFO Obfuscate module mode is 2
INFO Obfuscate code mode is 1
INFO Obfuscate string value is False
INFO Wrap mode is 1
INFO Restrict mode is 4
INFO Advanced value is 1
INFO Super mode is False
INFO Super plus mode is not enabled
INFO Generating runtime files to waterFlow_proj/waterFlow/pytransform
INFO Extract pytransform.key
INFO Read default license from capsule
INFO Create library path to support multiple platforms: waterFlow_proj/waterFlow/pytransform/platforms
INFO Copying /home/khadas/.pyarmor/platforms/windows/x86_64/7/_pytransform.dll
INFO To waterFlow_proj/waterFlow/pytransform/platforms/windows/x86_64
INFO Patch library waterFlow_proj/waterFlow/pytransform/platforms/windows/x86_64/_pytransform.dll
INFO Patch library file OK
INFO Copying /home/khadas/.pyarmor/platforms/linux/x86_64/7/_pytransform.so
INFO To waterFlow_proj/waterFlow/pytransform/platforms/linux/x86_64
INFO Patch library waterFlow_proj/waterFlow/pytransform/platforms/linux/x86_64/_pytransform.so
INFO Patch library file OK
INFO Copying /home/khadas/.pyarmor/platforms/linux/aarch64/3/_pytransform.so
INFO To waterFlow_proj/waterFlow/pytransform/platforms/linux/aarch64
INFO Patch library waterFlow_proj/waterFlow/pytransform/platforms/linux/aarch64/_pytransform.so
INFO Patch library file OK
INFO Copying /home/khadas/.local/lib/python3.8/site-packages/pyarmor/pytransform.py
INFO Rename it to pytransform/init.py
INFO Generate runtime files OK
INFO Start obfuscating the scripts...
INFO json2py_Key.py -> waterFlow_proj/waterFlow/json2py_Key.py
INFO json2token.py -> waterFlow_proj/waterFlow/json2token.py
INFO main.py -> waterFlow_proj/waterFlow/main.py
INFO qua_monitor.py -> waterFlow_proj/waterFlow/qua_monitor.py
INFO utils.py -> waterFlow_proj/waterFlow/utils.py
INFO vel_monitor.py -> waterFlow_proj/waterFlow/vel_monitor.py
INFO wl_monitor.py -> waterFlow_proj/waterFlow/wl_monitor.py
INFO xjjj.py -> waterFlow_proj/waterFlow/xjjj.py
INFO Obfuscate 8 scripts OK.

加密完成后在linux.aarch64平台上,cd xxx/waterFlow_proj,执行python -c "import waterFlow" 报错:
XXX lineno: 3, opcode: 228
Traceback (most recent call last):
File "", line 1, in
File "</mnt/hdisk/opt/watersystem/waterFlow_src/waterFlow_proj/waterFlow/init.py>", line 3, in
File "", line 3, in
SystemError: unknown opcode

运行环境
python3.8.13
pyarmor 7.7.0

期盼得到您的答复!!

@jondy
Copy link
Contributor

jondy commented Dec 14, 2022

不要使用 --advanced 1, 使用 2试试

@LVguomin
Copy link
Author

使用2会报其他错误,在windows平台上也一样报错
Traceback (most recent call last):
File "", line 1, in
File "/mnt/hdisk/opt/watersystem/waterFlow_src/waterFlow_proj/waterFlow/init.py", line 1, in
from pytransform import pyarmor
ModuleNotFoundError: No module named 'pytransform'

@jondy jondy closed this as completed Mar 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants