Python:安全地编译脚本? [英] Python: Compiling Script Safely?

查看:42
本文介绍了Python:安全地编译脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!

与我的上一个问题相反,我认为我采用了错误的方法.基本上,我需要能够编译 Python 脚本而不用担心任何常见的 leecher 来获取我的源代码并自己开始使用它.现在我知道 Python 是一种开源语言,并不意味着要受到保护,但一定有办法吗?

So contrary to my last question I think I was pursuing the wrong method. Basically I need to be able to compile a Python script without fear of any common leecher to obtain my source code and begin usage of it themselves. Now I know Python is a open source language not meant for being protected but there must be a way?

例如,Py2Exe 要求您将源代码保留在纯文本文件中,以便进行编译.这完全不是我想要的.这样做的全部原因是编译不仅会发生在我自己的 PC 上.我的项目将被编译为 PE 可执行文件形式,供公众使用,我不能让他们简单地打开和查看我的源代码.

For example Py2Exe asks you to leave your source code in a plain text file for it then to be compiled. Which is exactly not what I'm wanting. The whole reason for this is that compilation will be happening not just on my own PC. My project is going to be compiled to PE executable form and is intended for public use and I can't have them simply opening and viewing my source.

有人可以帮助我吗?

推荐答案

没有办法完全防止逆向工程.您可以做的一些事情:

There's no way to protect anything completely against reverse engineering. Some things you can do:

  • 分发 .pyc 文件.这需要稍微更多的努力来进行逆向工程
  • 使用混淆器(那里没有很多混淆器,我还没有找到任何可以称之为一流的)
  • 在 c 中编写关键部分(可能是许可证检查等)并调用它们
  • 将关键部分编写为 Web 服务

如果您分发 .pyc 或 py2exe,大多数人可能永远不会查看您的代码.如果有人从字节码中逆向工程师你的代码,有什么大不了的?如果他们有足够的决心,他们就可以编写自己的应用程序.如果您的应用程序足够强大,可以保护源代码,请不要太担心.

If you distribute .pyc or py2exe, most people will probably never look at your code. IF someone reverses engineers your code from the byte code, what's the big deal? If they're determined enough, they could just write their own application. Don't worry about it so much and ship your application if it's great enough to be protective of the source.

这篇关于Python:安全地编译脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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