From hkmp5@spray.se Sat Sep 22 14:55:14 EDT 2001 Article: 418917 of comp.lang.perl.misc Path: newshog.newsread.com!bad-news.newsread.com!netaxs.com!newsread.com!news-hog.berkeley.edu!ucberkeley!newsfeed.stanford.edu!postnews1.google.com!not-for-mail From: hkmp5@spray.se (Alex SC) Newsgroups: comp.lang.perl.misc Subject: Re: Best way to hide the perl source code.. Date: 22 Sep 2001 07:37:47 -0700 Organization: http://groups.google.com/ Lines: 64 Message-ID: <18d79944.0109220637.5007e22@posting.google.com> References: <3BABE40D.82225D00@atrenta.com> NNTP-Posting-Host: 130.237.42.108 Content-Type: text/plain; charset=Big5 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1001169468 1109 127.0.0.1 (22 Sep 2001 14:37:48 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 22 Sep 2001 14:37:48 GMT Xref: bad-news.newsread.com comp.lang.perl.misc:418917 Jayakumar Mundunuri wrote in message news:<3BABE40D.82225D00@atrenta.com>... > Hi Friends!! > > Can you suggest me what is the best way to hide perl source code? > > perl Compiler/ perlcc / perl Bite code / encrypt / perl Filter .... > > I heard the above names but not really attempted to use them. > > It would be great help if anybody guide me with some references. > > Thanks in advance. I'm sure you've read all the "don't do that posts already". And, in theory, I agree - if you intend to absolutely rely on the source not being available then don't do that. Then again, there may be other considerations. For instance, I deploy perl scipts across a multitude of DOS++ boxen where I work, and I used to have the problem of users (mostly excel and word mavericks, mind you) trying to "improve" upon my glorious programming and breaking all sorts of things in the process. I solved these problems to my satisfaction by hiding the source. If your problem is similar, then by all means go ahead. How, you ask? I didn't want to mess with anything of off CPAN, since it's not guaranteed to be installed where needed. Instead I use the MIME::Base64 module, available wherever perl is, unless your install is _really_ screwed up. 1) Write your script, debug it to your satisfaction. 2) Run the script thru' MIME::Base65::encode_base64. 3) Write a wrapper that looks more or less like #!/usr/bin/perl -w use strict; require 5; use MIME::Base64 qw(encode_base64 decode_base64); local($/)=undef; my $encStr=q( YOUR NICE ENCODED STRING GOES HERE! ); my $str=decode_base64($encStr); eval $str; 4) Distribute this instead of your original script. Now, will this stop EVIL HACKERS from stealing the efforts of your startling creativity and valiant efforts? Hell no. But rest assured that the average Office drone will faint with panic should he or she happen to open up your magnum opus with the texteditor and looks at those relentless marching rows of uniform text. So that particular mission is accomplished. The nice thing with this is that your script will still work anyway perl is available - you won't have to compile for separate architectures or anything like that. The bad thing is that it's an efficiency killer - I wouldn't suggest doing this for a CGI, say, that will be accessed several times every second. For all those scripts that will run a couple of times each day, though, it's perfect. Enjoy!