Gossamer Forum
Home : General : Perl Programming :

Hiding codes

(Page 1 of 2)
> >
Quote Reply
Hiding codes
Hello everyone,
This question will sound rubbish for many of the members out there. but beleive me i m in a serious trouble:(. Actually i m a developer and i develop programs for my clients. My clients are also web developer. When i upload the program onto thier said servers they get it from there and use the program. I want you guys to give me a solution for it. Can any code or some kinda installation file or certain password stuff can help me? or any other way where can i stop them using it anymore.
Please help me out
Abuzer

Quote Reply
Re: Hiding codes In reply to
Add this to the beginning of your scripts:

$file ="/path/to/logon.txt";
open(FILE,"$file") || die $!;
close(FILE);

Before you use your scripts just copy a file to the server using FTP. When you're done, delete it. A bit crude, but it'll work.

I'm working on a free CGI protection scheme at the moment; check CGI Resources in a few weeks (end of plug). Wink


Martin Webster
--
Cebidae's UK Internet Resource
http://www.cebidae.co.uk/
Quote Reply
Re: Hiding codes In reply to
Hey i m too interested in this kind of stuff but i don't understand a single line answered by Cebidae. So any body out there can please explain me what exactly one has to do.
Thanks in advance

Quote Reply
Re: Hiding codes In reply to
Thanks for replying, Cebidae. But don't you think is qyite simple? They are enough intelligent to recoznise this thing and would put the logon.txt according to the path. Please confirm that this is the thing u wanted me to do. If you have any other ideas do post.
Thanks once again

Quote Reply
Re: Hiding codes In reply to
recently i made my perl into binary files..

they still run.. i can even run them on windows.. but in a dos screen..

there is no way to edit the file.. unless of course they use a decompiler like softice or something.


Jerry Su
Quote Reply
Re: Hiding codes In reply to
here are a few examples with two telnet based scripts i made for my perl class..

well.. actually.. only the cashier program is.. but the blackjack was just because i was bored one day when i had nothing to do..

http://pdamania.com/blackjack.exe
http://pdamania.com/cashier.exe

if you try to open the programs.. you'll notice it is binary..

Jerry Su
Quote Reply
Re: Hiding codes In reply to
So Jerry su what should i do to avoid them to run? Keep in mind they are the owners of thier servers.
Regs
Abuzer


Quote Reply
Re: Hiding codes In reply to
well there are a few paradimes out there that encrypt scripts and make them into binary.. my past host used one to prevent people from reading perl files from their control panel.. so people wouldn't create pop3 emails and logins by hand..

basically.. two lines remain in the script..

#!/usr/bin/perl

and the line calling the paradime..

the rest is encrypted binary which is decrypted to a buffer and then ran..

you could put code in the encrypted area that says like..

open FILE, "../lock.txt" or die "Unauthorized Use!";
close FILE;

that way if lock.txt did not exist in the parent directory.. then the script would die.. otherwise it would run.. since this is encrypted.. it would not be readable..

Jerry Su
Quote Reply
Re: Hiding codes In reply to
Jerry how to add this lines in encrypted format? and commands?
I am a newbie. Please help
Regs
JackofNone

Quote Reply
Re: Hiding codes In reply to
Most encryption/obfuscation can be easily bypassed with:

perl -MO=Deparse script.pl > unencrypt.pl

this will print the output of the file formatted as perl understands it and is usually quite readable.

As for binaries, it's more complex but is generally safe from novices.

Cheers,

Alex


--
Gossamer Threads Inc.
Quote Reply
Re: Hiding codes In reply to
It's really great pleasure recieving reply from ALEX. Cool! But jerry how would you guide me to do this encryption.
Regs
JackofNone

Quote Reply
Re: Hiding codes In reply to
hmmm...I too am interested in this encryption to binary. Can some further light be shed on how it can be accomplished ?

Quote Reply
Re: Hiding codes In reply to
I really do not understand. This foresee an encryption algorithm on the server, so the code will never be protected. You must give the source without allowing them to read it. This is what was required in the original post.

Quote Reply
Re: Hiding codes In reply to
Hi

Can you give us more details about the binary solution? It is not clear how we could change the perl file to protect the source.

Thank you.

Quote Reply
Re: Hiding codes In reply to
See perldoc perlcc for more info..

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Hiding codes In reply to
Alex,
It looks great ... but if it is supposed to protect perl files... how can I work on a script to run it in that environment.
Can you post some examples or address us to a few examples on the Internet. It would help more :) Docs are not easy to understand. Sorry.

Thank you.

Quote Reply
Re: Hiding codes In reply to
You should just be able to do:

perlcc yourscript.pl

and you should now have a binary file yourscript that you can run. It will be system dependnant most likely though.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Hiding codes In reply to
Just 2 questions.

Can we create it before and then install the binaries on any server ...or it must be created on the server on which it will run?

Is this valid for windows platform running latest perl versions?

Quote Reply
Re: Hiding codes In reply to
I'm not real good at this stuff but, it seems to me like you should be able to create a password protected directory on your server to house a small but vital portion of the script's source. Just have each clients personal script access the protected file through a unique password embeded in the script. If you want to prevent them from using it anymore, just remove their script's password from the access list. I could be wrong on this and If so, I hope someone let's me know. I'm interested in the results.

Quote Reply
Re: Hiding codes In reply to
Alex,
i have tried the command perlcc myfile.pl but the system says that command not found. is this the right command? Please help me

Best Regs
JackofNone

Quote Reply
Re: Hiding codes In reply to
Yes, it may not be installed in your system though, or it may have been removed.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Hiding codes In reply to
Hi Alex,
Than what should i do now? Can you help me.

Best Regs
JackofNone

Quote Reply
Re: Hiding codes In reply to
I have tried this:
Code:
perl -MO=Deparse script.pl > unencrypt.pl
on an encrypted script, but Perl reported syntax errors and the resulting file is blank. Is there any other way to unencrypted a file?

Happy Coding,

--Drew
http://www.FindingHim.com
Quote Reply
Re: Hiding codes In reply to
 
I just had to get in this,

I've been wanting to compile perl for a while now.

I just made a little test script, named it test.pl in it I wrote

#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<b>Test</b>";

And in the shell I typed:
perlcc /path/to/test.pl

And it spit out test.pl.c

it was all in c code, what am I supposed to do with that? Plus when it finished it said there was an error in compiling the perl file. The test.pl.c was pretty big, I thought that it would have finished. The file it spit our was 1041 lines long. What gives???

So how do I get it to compile to a binary format.

Thanks,

perlkid

Quote Reply
Re: Hiding codes In reply to
What were the errors?

Cheers,

Alex

--
Gossamer Threads Inc.
> >