Ad Code

Responsive Advertisement

Ticker

6/recent/ticker-posts

Encrypted Python source code

執行如下命令,即可將目錄下的所有.py文件編譯成.pyc文件:

python -m compileall

python -m compileall test.py

然後刪除 目錄下所有 .py 文件就可以了。

$ find -name '*.py' -type f -print -exec rm {} \;


這一方法,可以加密我們的Python代碼,勝過代碼裸在外面。尷尬的是,因為Python解釋器的兼容較差,有些版本並不能運行.pyc文件。而且已經有現成的反編譯工具,可以直接破解。


比如python-uncompyle6,只要執行以下命令,就可以搞定。

$ uncompyle6 *compiled-python-file-pyc-or-pyo*



Reference:https://kknews.cc/code/yv6a24n.html