189 8069 5689

Pyinstaller如何加密打包应用-创新互联

这篇文章主要讲解了Pyinstaller如何加密打包应用,内容清晰明了,对此有兴趣的小伙伴可以学习一下,相信大家阅读完之后会有帮助。

峨山县网站制作公司哪家好,找成都创新互联!从网页设计、网站建设、微信开发、APP开发、响应式网站等网站项目制作,到程序开发,运营维护。成都创新互联从2013年开始到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选成都创新互联

pyinstaller是一个非常简单的打包python的py文件的库。用起来就几条命令就够了,

官方文档:pyinstaller

Pyinstaller如何加密打包应用

抓取真实api后

def obfuscation(py_file, save_path):
 print("读取文件:", py_file)
 with open(py_file, "r", encoding="utf-8") as f:
  py_content = f.read()

 print("进行混淆中...")
 url = "https://pyob.oxyry.com/obfuscate"
 headers = {
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
  "Referer": "http://pyob.oxyry.com/",
  "content-type": "application/json",
  "cookie": "_ga=GA1.2.1306886713.1588752647; _gid=GA1.2.46944674.1588899118"
 }
 data = json.dumps({
  "append_source": "false",
  "preserve": "",
  "remove_docstrings": "true",
  "rename_default_parameters": "false",
  "rename_nondefault_parameters": "true",
  "source": py_content
 })
 result = json.loads(requests.post(url, data=data, headers=headers).text)["dest"]
 result = "# cython: language_level=3\n" + result
 print("混淆成功...")

 with open(save_path, "w", encoding="utf-8") as f:
  f.write(result)
 print("混淆文件已写入{}\n".format(save_path))
 
if __name__ == '__main__':
 obfuscation("my.py", "../混淆/my.py")
 obfuscation("approach.py", "../混淆/approach.py")

网站题目:Pyinstaller如何加密打包应用-创新互联
网站路径:http://jkwzsj.com/article/deceio.html

其他资讯