Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pepper executable code with non-regexable copyright?

I'm looking for an idea. An idea that can--in some form--allow me to pepper my Perl code with hard-to-remove copyright comments all over the place so that it's almost illegible and is difficult to remove using a regex--with the code still being executable.


As one of the commenters has pointed out below the following trick can be applied to any such normal technique:

perl -MO=Deparse obfuscated.pl > plaintext.pl

Perhaps someone here can find a work around.

like image 681
user3333975 Avatar asked Dec 26 '22 12:12

user3333975


1 Answers

My contribution, easy to work around, but may trip up a sloppy code stealer: introduce subtle bugs into the code if the copyright notice has been tampered with

Example:

sub square_root {
    my $arg = shift;
    return sqrt($arg + 0.1 * apply_fudge_factor());
}

sub apply_fudge_factor {
    return 8410 != unpack("%32W*", ($::D//=join'',<DATA>));
}

print "sqrt(9)=",square_root(9);

__END__
=head1 NAME

my_program.pl - a program by me, and not by you

=head1 AUTHOR

Copyright (c) 2014 by Me

=cut

The checksum of the pod is 8410. If you make any changes after the __END__ token, the output of the program is

sqrt(9)=3.01662062579967
like image 56
mob Avatar answered Feb 19 '23 11:02

mob