Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Concealing Perl Code

by Gorby (Monk)
on Aug 13, 2004 at 17:01 UTC ( [id://382751]=perlquestion: print w/replies, xml ) Need Help??

Gorby has asked for the wisdom of the Perl Monks concerning the following question:

Hello Wise Monks,

Is there a way I can "compile" my perl code so that others can only run it, not read it?

Thanks in advance.

Gorby

Replies are listed 'Best First'.
Re: Concealing Perl Code
by insensate (Hermit) on Aug 13, 2004 at 17:08 UTC
Re: Concealing Perl Code
by diotalevi (Canon) on Aug 13, 2004 at 17:13 UTC
Re: Concealing Perl Code
by Aristotle (Chancellor) on Aug 14, 2004 at 19:39 UTC

    Is there a way I can "compile" my perl code so that others can only run it, not read it?

    Yes. Don't give them the code. Run the code on a server you control, and let the users run queries against it over the network.

    That's not what you want to do? You need to let them run your code on their own hardware?

    Ok, still possible. Do not grant redistributing/relicensing permissions for your code, either in part on completely (up to you).

    That's not what you want do do? You wanted it to be concealed via technical measures?

    Sorry, no can do.

    As far as I'm concerned, that's a good thing. CPAN might never have happened otherwise.

    Makeshifts last the longest.

Re: Concealing Perl Code
by zentara (Archbishop) on Aug 14, 2004 at 13:04 UTC
    jaco wrote:

    "I saw a method of doing this awhile ago where the code was wrapped into c binary. It only prevented novices from viewing the code, since all you needed to do was open the binary file and browse through it."

    Maybe you were thinking of "the generic script compiler" at shc.html ? It takes any script, shell or perl, and compiles it into a self-decrypting RC4 encoded c-binary. It can't be read by looking at the binary, but it CAN be easily cracked by a knowledgable user. It works well however, and stymies the average computer user.


    I'm not really a human, but I play one on earth. flash japh
Re: Concealing Perl Code
by jaco (Pilgrim) on Aug 13, 2004 at 18:11 UTC

    I saw a method of doing this awhile ago where the code was wrapped into c binary. It only prevented novices
    from viewing the code, since all you needed to do was open the binary file and browse through it.


    i have a snippet from one of my chat logs ...
    /*#define MULTIPLICITY */ /* try not to be a bad boy, avoid tinkering +with the interpreter's internal structure! */ \#include <EXTERN.h> \#include <perl.h> \#include <stdlib.h> static PerlInterpreter *pi; static char *script = $scriptText; int main(int argc, char **argv, char **envv) { int l, i, p_argc; char **p_argv; char *e_switch = \"-e\"; char *real_name = argv[0]; char *s_argv[2] = { e_switch, script } ; char **p_envv = envv; p_argc = argc+2; p_argv = (char **)malloc(sizeof(char*)*argc); p_argv[0] = argv[0]; p_argv[1] = s_argv[0]; p_argv[2] = s_argv[1]; for(i=1;i<argc;i++) { p_argv[i+2]=argv[i]; } pi = perl_alloc(); perl_construct(pi); perl_parse(pi,NULL,p_argc,p_argv,p_envv); { SV *sv; sv = perl_get_sv(\"0\",FALSE); if (!SvOK(sv)) { printf(\"%s: unrecoverable error\\n\",argv[0]); exit(EXIT_FAILURE); } sv_setpv(sv,argv[0]); } perl_run(pi); perl_destruct(pi); perl_free(pi); return EXIT_SUCCESS; }
    I wish i could remember what it was called or who wrote it.
    I'll try and find it on my old disks
Re: Concealing Perl Code
by CountZero (Bishop) on Aug 14, 2004 at 10:27 UTC
    I think far more programs (even those compiled into machine-code) are simpy copied and used without due respect to the laws of copyright, than programs are decompiled, studied and incorporated into other code.

    Do not over-rate the intellectual capacity of the users of your programs (any dumb-ass with a CD-burner can faster copy and distribute your program than you can write it), nor deceive yourself about the quality of your programming: it may be a shock to all of us programmers, but the world at large is most probably not interested at all in how we programmed things, just that it works (and how they can get away with it without paying).

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Re: Concealing Perl Code
by jacques (Priest) on Aug 14, 2004 at 12:30 UTC
    Check out PAR.

    (and Super Search next time ... this question has been asked many times already)

A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://382751]
Approved by blokhead
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-03-28 13:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found