Edw*_*Yip 7 python decompiling pyside cx-freeze
我是python的新手,我正在使用Python + PySide评估开发桌面程序,并发现cx_freeze在将我的python代码转换为可执行文件方面非常有效,而且它是跨平台的.
我的问题是,有人可以将cx_freeze生成的EXE反编译回完全可读的代码,就好像我的原始源代码一样吗?
注意:我并不担心有人破解我的程序,但只是不希望别人可以接受我的代码并开发基础.
谢谢.
似乎当前接受的答案不再正确。
以下是如何从冻结的项目中恢复原始源代码cx_freeze。
注意:它是在“Hello world”项目上完成的,但是,使用相同的方法,我已经能够从我用 冻结的项目中反编译 1000 多行代码源代码cx_freeze,并恢复几乎原始源代码!
创建一个test.py包含
import time
print('hello')
time.sleep(2)
print('world')
Run Code Online (Sandbox Code Playgroud)
然后创建可执行文件
cxfreeze test.py --target-name=test.exe
Run Code Online (Sandbox Code Playgroud)
然后通常您会将其分发给最终用户:
现在让我们尝试对其进行逆向工程!
#2) 获取 .pyc 字节码
打开dist/lib/library.zip并解压缩文件test__main__.pyc。
#3) 现在使用 decompyle6 获取源代码
import uncompyle6
with open('test_main_reverse_eng.py', 'w') as f:
uncompyle6.decompile_file('test__main__.pyc', f)
Run Code Online (Sandbox Code Playgroud)
#4) 惊喜...
这是原始源代码!
# uncompyle6 version 3.7.1
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit (AMD64)]
# Embedded file name: test.py
# Compiled at: 2020-06-16 21:02:17
# Size of source mod 2**32: 58 bytes
import time
print('hello')
time.sleep(2)
print('world')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4060 次 |
| 最近记录: |