Svenskithesource / PyArmor-Unpacker

A deobfuscator for PyArmor.
GNU General Public License v3.0
493 stars 73 forks source link

Using Method 2 in Python 3.8.16 #50

Closed OwnerCM closed 11 months ago

OwnerCM commented 1 year ago

I encountered a. py file encrypted through pyarmor, but this file is not a startup file, it only contains some important functions. I was unable to inject the process through step 3 of method 2 because the file immediately exited the program after being executed through the Python command, and I have not found a suitable method to continue. Please help me, thank you!

Error message through method 2: image

. py file format:

Normal mode

From pytransform import pyarmor Runtime Pyarmor Runtime() Pyarmor (name, file, b ' x06 x0f...', 2)

OwnerCM commented 1 year ago

May I ask if it is necessary to execute the encrypted. py file through the startup file of the project before injecting it? Or is it possible to directly execute the encrypted. py file through the Python command for injection? I am currently using the second method, but an error message was reported, as shown in the screenshot above. This issue has been bothering me for a long time, and I look forward to your reply. Thank you!

Svenskithesource commented 1 year ago

This issue was already discussed in #26 Please try what was discussed there and explain what you have trouble with if it doesn't work.

OwnerCM commented 1 year ago

This issue was already discussed in #26 Please try what was discussed there and explain what you have trouble with if it doesn't work.

@Svenskithesource I created a module and wrote the following code: import sys print('文件名:'+sys._getframe().f_code.co_filename) print('函数名:'+sys._getframe(0).f_code.co_name)
print('调用该函数的函数名字:'+sys._getframe(1).f_code.co_name) input()

The program has indeed paused. I executed the injection but still reported an error, as follows: 文件名:D:\CZ\cl_interface.py 函数名: 调用该函数的函数名字:_call_with_frames_removed Traceback (most recent call last): File "", line 4, in File "", line 456, in NameError: name 'code' is not defined

OwnerCM commented 1 year ago

This issue was already discussed in #26 Please try what was discussed there and explain what you have trouble with if it doesn't work.

@Svenskithesource I created a module and wrote the following code: import sys print('文件名:'+sys._getframe().f_code.co_filename) print('函数名:'+sys._getframe(0).f_code.co_name) print('调用该函数的函数名字:'+sys._getframe(1).f_code.co_name) input()

But the error was still reported: 文件名:D:\CZ\cl_interface.py 函数名: 调用该函数的函数名字:_call_with_frames_removed Traceback (most recent call last): File "", line 4, in File "", line 456, in NameError: name 'code' is not defined

I found that many modules have been changed and the last function called is Call With Frames Removed, is this a Pyarmor function? I used sys._getframe to check the calling function and found that it was Pyarmor who called the module., but it seems that Pyarmor did some work to invalidate this method of calling the module. 文件名:d:\CZ\request.py 调用该函数的函数名字:_call_with_frames_removed 调用该函数的函数名字:exec_module 调用该函数的函数名字:_load_unlocked 调用该函数的函数名字:_find_and_load_unlocked 调用该函数的函数名字:_find_and_load 调用该函数的函数名字:_node 调用该函数的函数名字:uname 调用该函数的函数名字:system 调用该函数的函数名字:_load_library 调用该函数的函数名字:pyarmor_init 调用该函数的函数名字:pyarmor_runtime 调用该函数的函数名字:

youjunyi commented 1 year ago

@OwnerCM 问题解决了吗?我也遇到了同样的问题

OwnerCM commented 1 year ago

@OwnerCM 问题解决了吗?我也遇到了同样的问题

很遗憾,我也没解决