469,275 Members | 1,802 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,275 developers. It's quick & easy.

How can I decrypt an perl script?

The script starts like this.

#!/usr/bin/perl
use Filter :: decrypt ;

This is a script used by our company and the technician left so know I need to find out what it does and how it works. Tried perl -MO=Deparse "script" but it threws an error Compilation failed in tequire at "script name" line2. Begin failed -- compilation aborted at "script name" line 2 use Filter :: decrypt ;.

Can anyone help me?
Jan 5 '11 #1
7 5079
RonB
589 Expert Mod 512MB
Remove the unwanted spaces, they are causing the compilation error.

Expand|Select|Wrap|Line Numbers
  1. use Filter::decrypt;
Jan 5 '11 #2
Do I just remove the spaces and then run the Deparse?
I removed the spaces and lets assume the script name is eric
I ran perl -MO=Deparse eric and it ran saying eric syntax OK,
but how can I decrypt the scrypt so I can read it?
Because I need to be able to read it, edit it and then encrypt it and run it again.
Could you please tell me how I should do this?
Jan 6 '11 #3
numberwhun
3,503 Expert Mod 2GB
Personally I have never used this module (or had a use for it), so I am unfamiliar with its caveats and workings.

That said, after you ran the deparse, did it produce a decrypted version of the file? It sounds like you were expecting it to write to screen, but that may not be the case.

Why are you encrypting your Perl script? Even the text of this 16 year old module says that its not totally secure and that the algorithm is quite simple. If its reading the source you are worried about, you may have better luck producing an executable binary version of your Perl script instead.

Regards,

Jeff
Jan 6 '11 #4
RonB
589 Expert Mod 512MB
You've stated that the script starts out with those 2 plain text lines.

Are you saying that the rest of the script is encrypted?

Did you simply add those 2 lines to an already encrypted script?
Jan 6 '11 #5
All the scripts start with those 2 lines, I think the previous person added them. And all the scripts are encrypted. I need to get the encrypted scripts that start with those 2 line, decrypted and user readeble and then a way to re-encrypt them and make them executable.
Jan 7 '11 #6
numberwhun
3,503 Expert Mod 2GB
I still don't get the need for the encryption of the scripts. Simply converting them to executable binaries should be enough. You distribute the binaries and keep the source files.

Are we to understand that you only have the encrypted versions of these files and do not have the text version?
Jan 7 '11 #7
Rabbit
12,516 Expert Mod 8TB
I don't know perl but I took a look at the source code and as far as I can tell, the encryption algorithm is dead simple. Basically it XORs everything against the key 'perl'. As long as the person who first who wrote it didn't mess with the algorithm, you just need to XOR every 4 bytes against the key 'perl' and that will decrypt it for you.
Jan 7 '11 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by Martin Foster | last post: by
6 posts views Thread by Richard Trahan | last post: by
2 posts views Thread by vermarajeev | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.