|Do you know where your variables are?|
Re: Protection for Perl Scriptsby afoken (Prior)
|on Jul 08, 2010 at 04:52 UTC||Need Help??|
There is NO technical way to protect a perl script. PAR and friends can be unpacked (see Uncool Use Of Perl: perl2exe. decompile quick steps), obfuscation can be removed (perl -MO=Deparse obfu.pl), and even the most advanced encryption algorithm is useless because you have to provide both the decryption algorithm and the decryption key to run the script. Break before the parser starts reading the decrypted code, print the code, done.
This is not a Perl problem, you will have the same problem with any interpreted language, and, to a lesser extend, even with compiled languages. There are some very good decompilers around for C, C++, Java, and all other major languages.
If you need to protect your code, consult a lawyer.
If you want to avoid accidental changes to your code, set the read-only attribute (DOS/Win, attrib +r your.pl) or remove the writeable attribute (Unix, chmod -w your.pl).
As a side node, the skype executable is an example of a very aggressive protection attempt, it uses obfuscation, encryption, runtime checks, anti-debugger tricks, and some other techniques in parallel and in multiple layers. It even encrypts unused code in memory. It is really hard to find out what really happens inside the code, but with enough work, even that is breakable.
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)