obfuscate and license
cython
cython3 --embed -o hello.c hello.py
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
ext_modules = [
Extension("main", ["main.py"]),
Extension("src.__init__", ["src/__init__.py"],
Extension("src.math_func", ["src/math_func.py"]),
Extension("src.text_func", ["src/text_func.py"]),
]
setup(
name = 'Sample Program',
cmdclass = {'build_ext': build_ext},
ext_modules = ext_modules
)
- 生成强秘密(generate strong password)
import random
import string
def generate_strong_password(length=16):
# 定义密码字符池
characters = string.ascii_letters + string.digits + string.punctuation
# 确保密码中至少包含一个小写字母、大写字母、数字和特殊字符
password = [
random.choice(string.ascii_lowercase),
random.choice(string.ascii_uppercase),
random.choice(string.digits),
random.choice(string.punctuation)
]
# 在剩余长度中随机选择字符
password += random.choices(characters, k=length - 4)
# 打乱字符顺序
random.shuffle(password)
# 将列表转换为字符串
return ''.join(password)
# 生成一个长度为 16 的强密码
password = generate_strong_password(16)
print("Generated strong password:", password)
pyarmor
pyarmor obfuscate --recursive server.py