Skip to content

Instantly share code, notes, and snippets.

@nanasess
Created February 17, 2012 00:17
Show Gist options
  • Save nanasess/1849100 to your computer and use it in GitHub Desktop.
Save nanasess/1849100 to your computer and use it in GitHub Desktop.
Easy copy protection for perl.
#!/usr/bin/perl
use Digest::SHA1 qw(sha1 sha1_hex sha1_base64);
my $document_root = $ENV{'DOCUMENT_ROOT'};
my $addr = $ENV{'SERVER_ADDR'};
my $v = sha1_hex($document_root,$addr);
if ($v ne '01f9ee68866f973e95c6c379afa9ab6e4a7a4395') {
print "Content-type: text/plain\n\n";
print "hehehe\n";
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment