#!/usr/local/bin/perl -w # An attempt at an end to those damn 'hide the source' nodes. # Usage: close-the-source.pl open_source.pl closed_source.pl # If you want to know what is going on go to: # http://perlmonks.com/index.pl?node_id=264840 use strict; use Crypt::Simple prompt => 'Please type the password now'; # Get the in and out off the command line. my $in_file = shift @ARGV; my $out_file = shift @ARGV; # Open the files. open IN, $in_file or die "Please specify file to scramble: $!"; open OUT, ">$out_file" or die "Please specify file to save to: $!"; # Grab the data and close the file. my @data = (); while () { push @data, $_; } close IN; # Scramble the data my $scramble = encrypt( @data ); # Create closed_source.pl print OUT << "END"; #!/usr/local/bin/perl -w # If you want to know what is going on go to: # http://perlmonks.com/index.pl?node_id=264840 # Usage: 'perl $out_file | perl - args' use strict; use Crypt::Simple prompt => 'Please type the password now'; my \$scramble = '$scramble'; my \@clear = decrypt( \$scramble ); my \$code = join '', \@clear; print \$code; END # Be neat. close OUT; # Be rude. print "\n\nRight - run 'perl $out_file | perl - args' and stop pestering us.\n\n";