Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

hide code

by emotiv (Novice)
on Nov 22, 2007 at 15:18 UTC ( #652385=perlquestion: print w/ replies, xml ) Need Help??
emotiv has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks
my boss asks me how to make unreadable a perl module so that the source code cannot be seen anymore (obviously I am not talking about chmod). I know this is contrary to the open source spirit but could anybody tell me the process for this sin?

Comment on hide code
Re: hide code
by tirwhan (Abbot) on Nov 22, 2007 at 15:28 UTC

    Tell your boss it can't be done in any reliable or secure manner. If he doesn't believe you, point him to the nodes listed under Re: Hiding your Script (or summarise them for him in a language he understands).


    All dogma is stupid.
Re: hide code
by okram (Monk) on Nov 22, 2007 at 15:57 UTC
Re: hide code
by marto (Bishop) on Nov 22, 2007 at 16:45 UTC
Re: hide code
by rgiskard (Hermit) on Nov 22, 2007 at 16:50 UTC
    It couldn't hurt to take a closer look at Perl Archiving Toolkit's filters at CPAN . It has a couple of packages (Obfuscation, Bleach, etc.) that could suit your needs.
      Acme::Bleach it's a option. From the module description, module removes all the unsightly printable characters from your source file.
Re: hide code
by codeacrobat (Chaplain) on Nov 22, 2007 at 17:24 UTC

      Or even easier with B::Deobfuscate

      Best regards,
      perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"

Re: hide code
by fenLisesi (Priest) on Nov 22, 2007 at 18:49 UTC
    Ah, reminds me of CryPerl., my first post. Heh heh. For certain application types, you may be able to use VMWare to create and distribute a virtual appliance. The freely available tools are enough to do this. For the preferably minimal OS to go into the appliance, rPath provides some nifty tools that will also allow you, reportedly, to easily dish out software updates to your clients, the way MS does, for example.
Re: hide code
by dragonchild (Archbishop) on Nov 22, 2007 at 19:55 UTC
    The proper solution is licensing. MySQL seems to do okay letting everyone see their source code and people paying them when they need to use the non-free license. Remember - even compiled C code can be decompiled. It's all a matter of how much people care to figure out what you're doing. Frankly, most people couldn't care less about how your code works so long as it does work. The people who do care generally tell you how to fix it. What's wrong with that?

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
Re: hide code
by pipedings (Initiate) on Nov 22, 2007 at 22:28 UTC
    Kill all the unnecessary whitespace. Change all variable names (by regex/search/replace) to gibberish. Or just compile it with perlcc and deliver binaries.
      perlcc is no more. It hasn't really ever been.
Re: hide code
by KurtSchwind (Hermit) on Nov 23, 2007 at 00:01 UTC

    The answer to this depends on who you are trying to hide the source code from. If you are talking about delivering an application for internal company use and you just want to keep the monkeys from screwing with it, you can use a few obfuscation techniques as discussed by others.

    If you need to deploy this code to paying customers, your best bet is going to be to use perlcc and go with binaries.

    Either way, you'll have to decide if that's enough protection because in the end, an experienced perl person can reverse what you've done to hide the code. Or reverse it enough to dink with it.

    --
    I used to drive a Heisenbergmobile, but every time I looked at the speedometer, I got lost.
Re: hide code
by Joost (Canon) on Nov 23, 2007 at 02:12 UTC
    As an aside to what other people are telling you (i.e. that whatever you do is reversible, given enough time/money/intelligence): that's probably true for any reasonably documented/researched language. Java decompilers are quite common, for example. It probably even doesn't matter whether you're using a high- or low-level language. High level language implementations probably have all kinds of recognizable fingerprints, and low-level languages are "by definition" either close to assembly and/or easy to decompile.

Re: hide code
by gex (Scribe) on Nov 24, 2007 at 13:51 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://652385]
Approved by Corion
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2014-12-26 18:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (174 votes), past polls