SoFunction
Updated on 2024-11-17

Implementation of Python compiled into a .so file for encrypted post call

Pyc is relatively easy to crack, and using cython to compile python files into .so files can enhance the privacy of python source code to some extent.

Compiling into .so files

Environment preparation: cython

Test script preparation:

#-*-coding: UTF-8 -* -
class test:
  def say(self):
    print 'hello'

Script compilation preparation:

3.1 Prepare documentation as follows:

#-*-coding: UTF-8 -* -
from  import setup
from  import cythonize
setup(
  ext_modules = cythonize("") # Note that the use of relative paths is recommended here, as the compiled so files may have path problems when referencing other modules.
)

3.2 The compiled so file () is under build/lib in the directory where it was called.

Usage

Scripting:

#-*-coding: UTF-8 -* -
from test import test # Note that the file should be in an accessible path
()

Perform validation.

The above implementation of this Python compiled into a .so file for encryption and then call is all that I have shared with you, I hope to be able to give you a reference, and I hope you will support me more.