#!/usr/bin/perl # # mask.pl v0.1_alpha by X-3mE # generate perl Obfu with a code # file and a mask # # released under GNU GPL terms # my $file=shift @ARGV; # code file name my $mask=shift @ARGV; # mask/image file my $dot=shift @ARGV; # dot (the symbol # used in the image # file) my $codestr; # string containing # the entire perl code # check the args existance unless($file or $mask) { die "Usage: $0 file obfu_mask [dot]\n" } # checking dot arg existance: # if not, the std dot is '#' unless($dot) { $dot='#' } # open the source code file open(FILE,"<$file") or die "Error: file $file\n"; # kill \n's, \t's, spaces and so on # if you want a space in your code, use ^'s while($f=<FILE>) { $f=~s/\s//g; $codestr.=$f } close(FILE); # put the "clean" code in a temp file open(FILE,">$file.tmp") or die "Error: temp file $file\n"; print FILE $codestr; close(FILE); open(FILE,"<$file.tmp") or die "Error: temp file $file\n"; open(MASK,"<$mask") or die "Error: file $mask\n"; my $c; print '$_=q%'."\n"; # apply code to the mask while(<MASK>) { while(/$dot/) { $c=getc(FILE); s/$dot/$c/e } print } # print exceeding code chars unless(eof(FILE)) { while(!eof(FILE)) { $c=getc(FILE); print $c } } # print final instructions print "\n"; # old one was: #print '%;'."\n\n".'s/\s//g;'."\n".'s/\^/ /g;'."\n"; print '%;'."\n\n".'s/\s+//g;'."\n".'s/\^/ /g;'."\n"; # add other substitution code here print "\neval\n"; close(MASK); unlink("$file.tmp") # remove temp file # in old code it was so: # system("rm -rf $file.tmp") # end #

In reply to mask.pl_v0.1_alpha by X-3mE

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.