Python 代码混淆 [英] Python Code Obfuscation

查看:85
本文介绍了Python 代码混淆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你知道有什么工具可以帮助我混淆 python 代码吗?

Do you know of any tool that could assist me in obfuscating python code?

推荐答案

您的问题空间未指定.这是用于命令行应用程序吗?这段代码应该用作库吗?

Your problem space is underspecified. Is this for a command-line app? Is this code supposed to be used as a library?

除了其他两个答案之外,您还可以将代码嵌入到二进制文件中.当它启动时,解码代码并评估字符串.这也适用于共享库扩展.我想你也可以用字节码来做到这一点,但它不会像调用 Py_EvalCode 那样简单.

In addition to the two other answers, you could embed the code into a binary. When it starts, decode the code and eval the string. This works for a shared library extension as well. You could also do that with byte code, I think, but it wouldn't be as simple as calling Py_EvalCode.

py2exe 或 freeze 是其他解决方案,可将代码转换为可执行文件.它只是将代码包含在二进制文件中,并没有做任何严重的混淆,但它仍然比打开 .py 文件更难.

py2exe or freeze are other solution, which convert the code into an executable. It just includes the code in the binary, and doesn't do any sort of serious obsfucation, but it's still harder than opening a .py file.

您可以用 Cython 编写代码,它类似于 Python,用 C 编写 Python 扩展文件,用作 .so.这可能是其中最难进行逆向工程并仍然为您提供用于开发的高级语言的.

You could write the code in Cython, which is similar to Python and writes Python extension files in C, for use as a .so. That's perhaps the hardest of these to reverse engineer and still give you a high-level language for develoment.

它们都是可破解的,所有解决方案也是如此.你希望它有多难?

They are all hackable, as are all solutions. How hard to you want it to be?

这篇关于Python 代码混淆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆