Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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".

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.

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.

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

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.

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

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top