有什么好的编译器可以将 perl/python/php 脚本编译成 linux 可执行文件吗?

发布于 2024-09-10 06:31:25 字数 242 浏览 6 评论 0原文

我正在开发一个项目,需要读取文本文件,从中提取数据,然后生成报告(文本文件)。由于需要进行大量字符串解析,我决定使用 Perl、Python 或 PHP 进行解析(按顺序优先)。但我不想将源代码暴露给我的客户。有没有好的编译器可以将 perl/python/php 脚本编译成 linux 可执行文件?

我不是在寻找100%完美的,而是在寻找至少90%完美的。我所说的完美是指编译器不需要编写具有有限语言功能子集的脚本。

I am working on a project that requires reading text files, extracting data from them, and then generating reports (text files). Since there are a lot of string parsing, I decided to do it in Perl or Python or PHP (preference in that order). But I don't want to expose the source code to my client. Is there any good compiler for compiling perl/python/php scripts into linux executables?

I am not looking for a 100% perfect one, but I am looking for an at least 90% perfect one. By perfect, I mean the compiler doesn't require to write scripts with a limited subset of language features.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

伴梦长久 2024-09-17 06:31:25

抱歉,这根本不值得你花时间。对于您选择的任何语言(从您列出的语言中),对于某人选择提出的任何编译器/混淆器,我向您保证我可以从中获得可读的源代码(如果是 Perl,则在一小时内;如果是 Python,则需要更长的时间)或 PHP 只是因为我不太熟悉这些语言的实现,不是因为这些语言本质上更难)。

我认为你应该更好地考虑一下你的目标是什么,以及为什么你想为一个你认为先验想要欺骗你的客户工作。如果您仍然想继续这样的方案,请用 C 或 Fortran 编写——当然不是以“P”开头的任何内容。

I'm sorry, it's simply not worth spending your time on. For any language you choose (from among the ones you listed), for any compiler/obfuscator someone chooses to come up with, I promise you I can get readable source code out of it (within an hour if it's Perl; longer if it's Python or PHP simply because I'm less acquainted with the implementations of those languages, not because it's intrinsically harder with those languages).

I think you should take a better look at what your goals are and why you want to work for a client that you're assuming a priori wants to rip you off. And if you still want to go ahead with such a scheme, write in C or Fortran -- certainly not anything starting with "P".

小ぇ时光︴ 2024-09-17 06:31:25

确实存在一个 perl 编译器,名为 perlcc。我不熟悉 perl,但它看起来像你正在寻找的。

There does exist a Compiler for perl, called perlcc. I'm not familar with perl, but it looks like what you're looking for.

呆萌少年 2024-09-17 06:31:25

加密 Perl 代码有 3 个选项:

  1. 使用 PAR 通过 PAR::Filter::Obfuscate 或 PAR::Filter::Crypto 创建可执行文件

  2. 使用 Filter::Crypto::CryptFile (需要在目标操作系统上安装一些模块)

  3. 转为模块并加密为Module::Crypt。

您也可以尝试 B::C - 它已从核心 Perl 发行版中删除,现在可在 CPAN 上使用。

There are 3 options of encrypting Perl code:

  1. Use PAR to create executable file with PAR::Filter::Obfuscate or PAR::Filter::Crypto

  2. Use Filter::Crypto::CryptFile (will require some modules installed on target OS)

  3. Turn into module and encrypt into Module::Crypt.

Also you can try B::C - it was removed from core Perl distribution and is now available on CPAN.

不乱于心 2024-09-17 06:31:25

到目前为止,我们已经听说过带有一些混淆过滤器的 perlcc 和 PAR。这些可能有效。

我对 ActiveState 的 PerlApp 非常好运,它是他们的 Perl 开发工具包的一部分。

捆绑代码并隐藏它非常有效。您可以免费试用,并且它还附带一些不错的附加功能。贵还是便宜取决于你的观点。对我来说,它很便宜。使用 PAR 使代码隐藏工作且可靠,或者使用 perlcc 进行代码隐藏所花费的时间成本很容易低于软件包的价格。 YMMV。

So far we've heard about perlcc and PAR with some obfuscation filters. These may work.

I have had very good luck with ActiveState's PerlApp which is part of their Perl Dev Kit.

It works well to bundle your code and hide it. You can try it for free, and it comes with some nice extras. Whether it is expensive or cheap depends on your perspective. For me, it was cheap. The cost in time of getting code hiding working and reliable with PAR or messing with perlcc was easily less than the price of the package. YMMV.

无力看清 2024-09-17 06:31:25

对于 Python 您可以调用您的代码并将 *.pyc 文件提供给客户端。

For Python You can call your code and give the *.pyc file to the client.

↙厌世 2024-09-17 06:31:25

对于linux来说,可执行文件是设置了+x的东西,所以不需要编译脚本。要隐藏源代码,您可以使用混淆器。这会使您的源代码不可读。

For linux an executable is something which has +x set, so there's no need to compile scripts. To hide your sourcecode you could use an obfuscator. This makes your sourcecode unreadable.

和我恋爱吧 2024-09-17 06:31:25

我从未使用过这个,所以我不知道它的设置有多容易,但是您可以使用 HipHop PHP 将 PHP 脚本转换为 C++ 代码并编译它们。 (假设您选择用 PHP 编写它们)

http://developers.facebook.com/blog/ post/358

http://github.com/facebook/hiphop-php

I've never used this, so I don't know how easy it is to setup, but you could use HipHop PHP to turn your PHP scripts into C++ code and compile them. (Assuming you choose to write them in PHP)

http://developers.facebook.com/blog/post/358

http://github.com/facebook/hiphop-php

貪欢 2024-09-17 06:31:25

对于 Python,您可以使用 cx.freeze。我没有使用过这个,但我相信它基本上将 .pyc 捆绑到一个 zip 文件中,并添加了一个可执行的前端。

或者,您可以尝试使用 Cython 编译 Python 代码。这会将 Python 语言的修改版本转换为 C 代码,然后可以对其进行编译。这通常用于编写高性能扩展或与现有 C 库的接口,但最新版本也可用于制作完整的可执行文件。

For Python you can use cx.freeze. I have not used this but I believe that it basically bundles the .pyc into a zip file and adds an executable front-end.

Alternatively you could try compiling you Python code with Cython. this translates a modified version of the Python language into C code, which can then be compiled. This is normally used to write high performance extensions or interface with existing C libraries, but the latest version can also be used to make a complete executable.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文