Below is a small little script for a stupid college class.
The idea was to let all the monks get a chance to obfu it into something the teacher will not be able to read.
The best one will be chosen and sent as the project.

good luck all
#!/usr/bin/perl print "Please enter the string to be searched for the string 'monkey': +\n"; chomp($_ = <STDIN>); if(/monkey/) { print "String 'monkey' was found in the input string.\n"; } else { print "String 'monkey' was not found in the input string.\n"; }


Hacker_J99
s vv\uhar_\uj99v.s v..v$&cked by $&ckev.print

Replies are listed 'Best First'.
Re: Obfu/golf Contest
by Abigail-II (Bishop) on Feb 19, 2003 at 21:14 UTC
    eval eval '"'. (( (( (( (( (( (( (( (( (( '#'))))) )) )))) ) ))) ) ) ).+ '!' .+ (( '/' )). ('[' ^+ '.' ) .+( '['^ (( '(') )) .("\["^ ')'). ( '/' ) .('`' | (( '"'))). ('`'|')').('`'|"\."). '/'.('['^'+').('`'|'%') .('['^')').('`'|"\,").( '!'^',').('!'^'+').('!' ^',').('!'^'+').("\["^ '+').('['^')').("\`"| ')').('`'|'.').("\["^ '/').('{'^'[').''. '\\'.'"'.('{'^'+') .(('`')| ',' ).(('`')| '%' ).(('`')| '!') .('['^'(' ).''. ('`'|'%'). ("\{"^ '[').('`'| '%').( '`'|'.').('['^'/').('`'| '%').('['^')').('{'^'[') .('['^'/').('`'|"\(").( '`'|'%').('{'^'[').('['^ '(').('['^'/').('['^')'). ('`'|')').('`'|'.').('`'| "'").('{'^'[' ).(('[')^ '/').("\`"| "\/").( '{'^'[') .("\`"| ('"')).( '`'|'%'). ('{'^'[' ).(('[')^ ('(')).( '`'|'%'). (('`')| "\!").( ('[')^ ')') .+( (( (( (( (( (( (( (( (( (( '`'))))) )) )))) ) ))) ) ) )|+ '#' ). +( '`' |(( '(') )) .+( ( '`' )|(( (( '%') )) )).('`' |'$') . ((( ( '{')) ) ^+ "\[").( '`'|'&').('`'|"\/").( '['^')').('{'^'[').('[' ^'/').('`'|'(').(('`')| '%').('{'^'[').('['^'(' ).('['^'/').('['^')'). ('`'|')').('`'|'.').( '`'|"'").('{'^('[')). "'".('`'|'-').('`' |'/').('`'|"\.").( '`'|'+') .+( '`'|'%'). ((( '['))^'"' ).(( "'")).':' .'\\' .'\\'.('`' |'.'). '\\'."\"". "\;".( '!'^',').('!'^'+').('!'^ ',').('!'^'+').('`'|'#') .('`'|'(').('`'|"\/").( '`'|'-').('['^'+')."\(". '\\'.'$'.'_'.('{'^('[')). '='.('{'^'[').'<'.(('{')^ '(').('{'^'/' ).(('`')^ '$').("\`"^ "\)").( '`'^'.') .('>'). ')'.';'. ('!'^',') .(('!')^ '+').('`' |"\)").( '`'|'&'). '('.'/' .("\`"| '-').( '`'| '/' ). +( (( (( (( (( (( (( (( '`'))))) )) )))) ) ))| ( ( '.' ))) .( (( '`' ))| '+') .( '`' | '%' ).+( (( '[') )^ ('"')). "\/". ( ')' ) .('{' ^ (( '['))). '\\'.'{'.('!'^"\,").( '!'^'+').('['^'+').('[' ^')').('`'|')').(('`')| '.').('['^'/').('{'^'[' ).'\\'.'"'.('{'^'(').( '['^'/').('['^"\)").( '`'|')').('`'|"\.").( '`'|"'").('{'^'[') ."'".('`'|('-')).( '`'|'/') .+( '`'|'.'). ((( '`'))|'+' ).+( '`'|'%'). ('['^ '"')."'".( ('{')^ '[').('['^ ',').( '`'|'!').('['^'(').('{'^ '[').('`'|'&').('`'|'/') .('['^'.').('`'|"\.").( '`'|'$').('{'^'[').('`'| ')').('`'|'.').('{'^'['). ('['^'/').('`'|'(').('`'| '%').('{'^'[' ).(('`')| ')').("\`"| "\.").( '['^'+') .("\["^ ('.')).( '['^'/'). ('{'^'[' ).(('[')^ ('(')).( '['^'/'). (('[')^ "\)").( ('`')| ')') .+( (( (( (( (( (( (( (( (( (( '`'))))) )) )))) ) ))) ) ) )|+ '.' ). +( '`' |(( "'") )) .(( ( '.' ))). (( '\\' )) .'\\'.( "\`"| ( '.' ) ).''. ( (( '\\'))) .'"'.';'.('!'^"\,").( '!'^'+').'\\'.'}'.('!'^ ',').('!'^'+').('`'|'%' ).('`'|',').('['^'(').( '`'|'%').('{'^'[').''. '\\'.'{'.('!'^"\,").( '!'^'+').('['^"\+").( '['^')').('`'|')') .('`'|'.').(('[')^ ('/')).( '{' ^'[').''. ((( '\\'))).+ '"'. ('{'^'(') .('[' ^'/').('[' ^')'). ('`'|')'). ("\`"| '.').('`'|"'").('{'^'[') ."'".('`'|'-').('`'|'/') .('`'|'.').('`'|"\+").( '`'|'%').('['^'"')."'".( '{'^'[').('['^',').("\`"| '!').('['^'(').('{'^'['). ('`'|('.')).( '`'|'/'). ('['^'/').( '{'^'[' ).("\`"| "\&").( '`'|'/') .('['^'.' ).("\`"| '.').('`' |"\$").( '{'^'['). (('`')| "\)").( ('`')| '.') .+( (( (( (( (( (( (( (( (( (( '{'))))) )) )))) ) ))) ) ) )^+ '[' ). +( '[' ^(( '/') )) .+( ( '`' )|(( (( '(') )) )).('`' |'%') . ((( ( '{')) ) ^+ "\[").( '`'|')').('`'|"\.").( '['^'+').('['^'.').('[' ^'/').('{'^'[').(('[')^ '(').('['^'/').('['^')' ).('`'|')').('`'|'.'). ('`'|"'").'.'.('\\'). '\\'.('`'|"\.").'\\'. '"'.';'.('!'^','). ('!'^'+').'\\'.'}' .(('!')^ ',' ).(('!')^ '+' ).(('!')^ ',') .('!'^'+' ).''. ('!'^'+'). ("\!"^ '+').('!'^ "\+"). '"';$:='.'^'~';$~=('@')| '(';$^=')'^'[';$/=('`')| '.';$_='('^'}';$,="\`"| '!';$\=')'^'}';$:=('.')^ '~';$~='@'|'(';$^=')'^'[' ;$/='`'|'.';$_='('^'}';$, ='`'|"\!";$\= ')'^"\}"; $:='.'^'~'; $~='@'| "\(";$^= ')'^'[' ;$/='`'| ('.');$_= '('^'}'; $,=('`')| "\!";$\= ')'^"\}"; $:='.'^ '~';$~= ('@')| '('; #;#

    Abigail

      I hope you have kids Abigail-II, cuz those be Teletubbies...

      thor

      Bravo!! Gobsmacked.


      Examine what is said, not who speaks.

      The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.

      This ... this is a thing of beauty. I thought it was just a random obfu, but it is an actual monkey contribution. Amazing. Pardon me while I go see if I can understand it.


      I just realized that I was using the same sig for nearly three years.

Real monks code in...
by TheDamian (Vicar) on Feb 20, 2003 at 02:04 UTC
    I was tempted to translate the prompt and response too, but that would take it beyond the original spec:
    use Lingua::Romana::Perligata; EGRESSO SCRIBE DICTUM SIC PLEASE ENTER THE STRING TO BE CIS TUM LACUNAM TUM DICTUM SIC SEARCHED FOR THE STRING MONKEY CIS TUM BIGUTTAM TUM LACUNAM. HUIC VESTIBULO PERLEGEMENTUM DA. DICTUM SIC STRING MONKEY WAS CIS TUM LACUNAM SCRIBE EGRESSO. SI HOC TUM DICEMENTUM SIC MONKEY CIS SCRUTAMENTUM TUM NULLUM PRAESTANTIAM HOCQUE TUM DEMINUEMENTUM DICEMENTUM SIC MONKEY CIS SCRUTAMENTUM TUM NULLUM PRAESTANTIAM FAC SIC EGRESSO NOT INQUEMENTUM TUM LACUNAM SCRIBE CIS. SCRIBE EGRESSO DICTUM SIC FOUND IN THE INPUT STRING CIS TUM NOVUMVERSUM.
    Note that this requires the 0.55 release of Perligata, which (due to the current CPAN woes) is currently only available from my personal mirror.
      Hmmmmm...just realized that it's much more "monumental" when it's formatted properly:
      use Lingua::Romana::Perligata; EGRESSO SCRIBE DICTUM SIC PLEASE ENTER THE STRING TO BE CIS TUM LACUNAM TUM DICTUM SIC SEARCHED FOR THE STRING MONKEY CIS TUM BIGUTTAM TUM LACUNAM. HUIC VESTIBULO PERLEGEMENTUM DA. DICTUM SIC STRING MONKEY WAS CIS TUM LACUNAM SCRIBE EGRESSO. SI HOC TUM DICEMENTUM SIC MONKEY CIS SCRUTAMENTUM TUM NULLUM PRAESTANTIAM HOCQUE TUM DEMINUEMENTUM DICEMENTUM SIC MONKEY CIS SCRUTAMENTUM TUM NULLUM PRAESTANTIAM FAC SIC EGRESSO NOT INQUEMENTUM TUM LACUNAM SCRIBE CIS. SCRIBE EGRESSO DICTUM SIC FOUND IN THE INPUT STRING CIS TUM NOVUMVERSUM.
        Even better would be to ray-trace it with POV, which will easily create an object out of a text string processed through a truetype font, and then subtract that from a solid granite block. Print on a photorealistic printer.

        —John

        Outstanding!
      How about in Klingon? Did you ever get that out of alpha?
Re: Obfu/golf Contest
by Tomte (Priest) on Feb 19, 2003 at 16:14 UTC

    Update:Added 'glitter' version in a hurry :)

    It's a try: 78 for the core part
    $;=pack"H*",'6d6f6e6b6579';$_=<>;$:=($_=~/$;/?' ':' not ');print$;.$:. +'found';

    With all the glitter: 189 without newlines

    #!/usr/bin/perl print"Please enter the string to be searched for the string 'monkey':\ +n" ;$;=pack"H*",'6d6f6e6b6579';$_=<>;chomp; $:=" was".($_=~/$;/?' ':' not ');print"String ". $;.$:.'found';

    regards,
    tomte


Re: Obfu/golf Contest
by thelenm (Vicar) on Feb 19, 2003 at 17:48 UTC
    Here's one I just spent way too much time on. It's based on the 'smiley-face' JAPH that merlyn did back in 1990 (can be found on this page). I got a little lazy at the end... the last part can surely be obfuscated much better than it currently is.

    Update: hmm, if you download the code and try to run it, make sure you get rid of the ^M characters first. Maybe cut and paste is the way to go, instead.

    #!/usr/bin/perl -lp BEGIN{++vec$,,$.+=y///c,1for+split' ',q;q,q, q, q,q, q q, q q, q, q,q +q q, q,q,q q q, q q,q q q q, q, q,q q q,q,q,q q,q q, q,q q q,q q q q, q q,q +, q, q q q, q, q,q q q,q q,q q q q,q,q,q q,q,q q, q q q,q,q q, q q, q, q,q +q q,q,q,q q,q q q,q q q q,q, q, q q q,q q,q q q q, q,q q, q q,q q q q, q + q, q q q,q q q,q,q,q q,q,q q, q q q, q q q q, q q,q,q,q q,q, q,q, q q, q, + q,q q q,q,q,q q,q q q,q q q q, q, q,q q q, q,q,q q q,q q,q q q q, q q,q, q + q,q,q q, q q, q, q,q q q,q, q,q q q,q,q,q q,q, q q,q q q, q q q q, q q,q q,q + q q q,q,q,q q,q,q q, q q q,q,q q, q q, q, q,q q q,q,q,q q,q q q,q q q q,q, + q, q q q,q q,q q q q, q,q q, q q,q q q q, q q, q q q,q q q,q,q,q q,q q q q, +q q,q q, q q, q q, q q q q, q q,q q q q, q q, q q, q, q q, q, q,q q q, q,q q + q q q, q q q,q q,q, q, q q;;print$,}last}($,,$=)=($,=~/([a-z]{6})/,$,=~/'( +.*)'/); for("@{[ucfirst$,,$&,was,(/$1/?():'not'),found,in,the,input,$,.q,.,]}" +){

    -- Mike

    --
    just,my${.02}

Re: Obfu/golf Contest
by diotalevi (Canon) on Feb 19, 2003 at 17:58 UTC

    I'm not going to spend more than a moment on this but how about using conditional regex expressions ala:

    print "String 'monkey' was "; <>=~/(?(?:monkey)(?!)|(?{print "not "}))/ print "found in the input string\n";

    Seeking Green geeks in Minnesota

Re: Obfu/golf Contest
by BrowserUk (Patriarch) on Feb 19, 2003 at 18:51 UTC

    It won't win any golf trophys, but it might wrinkle teach's brow a little.

    #!/usr/bin/perl -l @_=split'z',q;stringzmonkeyzthe zeaz foze zinzr zt z Plzentezto bzrchedzszwazund zpuz z'znoz:z.z~ z;;for$s(q;$_='jdnfkhcarlfndmehcarsbsu';, q\$_='arsbsronr'.(<>!~?$_[1]?&&'ti').'epgrcav'\) {eval$s,s'(.)'$_[-97+ord$1]'ge,print}

    Examine what is said, not who speaks.

    The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.

Re: Obfu/golf Contest
by xmath (Hermit) on Feb 19, 2003 at 15:50 UTC
    Let's start with regular compaction.

    Is it ok with you to use commandline options in the #! line? (like -l etc)

    If so:

    #!/usr/bin/perl -l print "Please enter the string to be searched for the string 'monkey': +"; print "String 'monkey' was ",<>!~/monkey/&&'not ',"found in the input +string.";

    else:

    #!/usr/bin/perl print "Please enter the string to be searched for the string 'monkey': +\n"; print "String 'monkey' was ",<>!~/monkey/&&'not ',"found in the input +string.\n";
      Here's one reducing the redundancy in the strings:
      $s="string";$m="monkey";print "Please enter the $s to be searched for +the $s '$m':\n";print "\u$s '$m' was ",<>!~/$m/&&'not ',"found in the + input $s.\n";
      154 characters (but no perl shebang -- is that required for the golf stroke count?)

      Update:170 with the shebang.

      I just realized something to hide&reduce those strings: You use exactly 32 different characters (excluding newline), so you might be able to encode them with 5-bit codes and pack them tightly into a bitstring which you put as raw binary data into the file. This will make all strings almost twice as short and totally unreadable.

      •Update: sorry, mind blurp.. I was already thinking a bit ahead. You use less than 32 chars, but if you take a..z and add the remaining ones you use ('P', 'S', ' ', '.', "'", ':') it adds up to 32. Using a..z is useful since it's more compact than explicitly listing all chars you really use.

      The issue is how to compactly write the decoding logic. You'll have to play with unpack 'B*' etc. Also use barewords when possible (unpack B99, or if you need a list of chars for the logic you can do a..z)

      I don't have time to try this myself right now, maybe someone else can figure it out from here

Re: Obfu/golf Contest
by BazB (Priest) on Feb 19, 2003 at 19:31 UTC

    This is a pretty simple obfu.
    The under-lying code is 171 characters.

    Update: Warning! Huge line follows in readmore:

    This is based on other posts in this thread, with an added

    sub _{print $_[0].$/};
    to compress print to _, and save on "\n"'s.

    Change eval to print for the real source.

    Cheers.

    BazB.


    If the information in this post is inaccurate, or just plain wrong, don't just downvote - please post explaining what's wrong.
    That way everyone learns.

Re: Obfu/golf Contest
by hv (Prior) on Feb 19, 2003 at 18:22 UTC

    Not a very golfish approach, but you could take a look at Acme::Bleach.

    Hugo
Re: Obfu/golf Contest
by Pug (Monk) on Feb 19, 2003 at 23:04 UTC
    Here are two soluations that does not have a 'seen' print statement in it. Unforuntly both will only stop when you press a second \n or Crtl-C it. This one is the first version I have no special setup required. The problem is that you can easy tell where the monkey is checked.
    #!/usr/bin/perl -pal if($t++) { exit; } $_=join "",("String \'monkey\' was ", (pop @F)!~/monkey/&& 'not ', 'fo +und in the input string.'); sub BEGIN{ print "Please enter the string to be search for the string +'monkey':";}
    This one requires that it be runed with this command
    perl -F'monkey' $CODE_FILE
    I can't seem to get the -F to work when in the #! of the file. 8(
    #!/usr/bin/perl -apn if ($t++) { exit; } $_=join "",("String 'monkey' was ", scalar @F ==1 && 'not ', 'found in the input string.'); sub BEGIN{ print "Please enter the string to be search for the string +'monkey':";}
    --
    Pug