zoukankan      html  css  js  c++  java
  • Python 代码的加密混淆

    py 脚本编译成 c 文件(cython)

    用 cython 将核心代码 py 模块文件转化成 .c 文件,再用 gcc 编译成 so(unix)文件,或者将其编译成 pyd(windows)文件。

    编译过程:

    1、服务器安装依赖

    pip install python
    yum install python-devel gcc
    

    2、编写 setup.py 文件,内容如下:

    from distutils.core import setup
    from Cython.Build import cythonize
    setup(
        ext_modules = cythonize("test.py",language_level=2)
    )
    
    # 批量编译
    setup(
        ext_modules = cythonize(["test.py","test2.py".......],language_level=2)
    )
    

    3、运行以下命令

    python setup.py build_ext --inplace
    
    文章来自:chenxuhua.com
  • 相关阅读:
    第几天?
    农历02__资料
    农历01
    VC6_预编译头
    QWebEngine_C++_交互
    Qt570_CentOS64x64_02
    Qt570_CentOS64x64_01
    QWebEngineView_CssVariables
    Windows__书
    Win7SDK
  • 原文地址:https://www.cnblogs.com/chenxuhua/p/12837697.html
Copyright © 2011-2022 走看看