Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Obfuscated code

( #1597=superdoc: print w/replies, xml ) Need Help??

Got some code which would take a Perl grand master to understand without running it? Post it in this section so we can stare at it in awe.

Word of warning, though: Don't be too cocky with your post — almost inevitably someone will post a reply that does the exact same thing in even fewer characters!

New Less than Readable Code
die if lie! fun with Win32
1 direct reply — Read more / Contribute
by Discipulus
on Nov 12, 2018 at 05:27
    Hello nuns and monks!

    I'm not an obfusctor, but as Win32 is obfuscated per se i present you this little lie/truth game

    use Win32; exit unless @}; $ms = \&Win32::GetSystemMet +rics if $^O; END{ exit if @};while(<DATA>) { s/\s//g ; push @} , jo +in '', map {chr (($^O =~ s/\D+//r)+$_)}( $_ =~ /\d{2}/g ) } seek DA +TA, 0, 0; ; $s.=$_ for<DATA>;die if !eval $s; system('cls'); print $ +^O,' ', map {uc $_} substr($} [4], 0, 1 ), substr ($}[0] , 7 , 1), sub +str( $}[5] ,4,1), substr ($}[8],1,1), $/;} map{die 'lie!' unless($$_[1 +]->($$_[2] )?6:7 )== Win32::MsgBox($}[$$_ [0]] . "?", 4, $0); }[0, $ms +,75], [1, $ms, 91], [2, $ms, 23],[3,$ms, 0x2004], [4,$ms, 67],[5, $ms +,0x2003]; map { print $}[$$_[0]]. "?\n"; <STDIN> eq $$_[1] ( $$_[2] ). +"\n" or die'lie!'}[6,$ms,80],[7,$ms,0], [8,$ms,1]; eval '#!perl' unle +ss $^O; __DATA__ 777 9 8 5 8 36 9 00 7265 830 08 669 82 847 36 765 760 08 7726 +96 976 77 79 858 36 90 0726 5830072798 27390 7978 84 65 76 00 8772 69 +69 76 7 7 7 98583 69 0 0 66 8 58 4847 97 8830 0658 26900 83 876 58080 + 6968 73 8 30 08 4 726 90 080 670 073 78 006 8 79 67 756 96 80 077 796 + 869 74 85 8 3 84006 67 9798 4007378 007 065 7376 1383 6570 69 007779 +6869 89 798 500 808 5840 08 0670 079 78 0 08 37 6 6 58 4 69 0 07 779 6 +869 72798 70077 65788 9007 77 97873 84798283 0068790089798 500726 58 +669 87726584078 3008472690087736884 720079700070738 28384008367 826969 +78 8772658407830084726900726973717 284007970007073 8283840083678269697 +8

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
rand ( perl --help )
No replies — Read more | Post response
by usemodperl
on Jun 18, 2018 at 19:28
    perl -le 'chomp(@_=`perl -h`);($u)=grep/^U/,@_;($r)=grep/^R/,@_;@_=gre +p/^\s+\-/,@_;$s=$_[int(rand(scalar@_))];for(1..2){system"clear";print +"\033\[1m$u\033\[0m";print/1/?"\033[5m":"",$s,/1/?"\033[0m":"";print" +\033\[1m$r\033\[0m";sleep(3)if/1/}'
Larry Wall
2 direct replies — Read more / Contribute
by usemodperl
on Jun 17, 2018 at 22:19
    perl -e '$_=`perl -v`;while(/\d\,(\s\x4c[^\n]+)/){print$1}'

    Edit: It prints a lot! If that annoys you try the static version:

    perl -le '$_=`perl -v`;if(/\d\,\s(\x4c[^\n]+)/){print$1}'
A quick one-liner
No replies — Read more | Post response
by liverpole
on Jun 11, 2018 at 20:19
    Should work on most *nix systems:
    perl -E'say`$^Xdoc -qj`=~m`"(.*)"`'

    s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
Happy birthday, happy birthday... happy birthday to Perl!
1 direct reply — Read more / Contribute
by Discipulus
on Dec 18, 2017 at 02:49
    # ### ##0## ### # ;while( #=30==# <DATA>) {chomp; s{#}{}g #==30=# ;3;s{0} {\n}g;; #=30==# ;s{\d}{ " "x $& }xge;print}BEGIN{print$/,(" "x14),(join" - ",( map{join" ",(split/\s/,scalar gmtime$_)[1,2,4] }566784000,1513555200)),$/};END{seek DATA,0,0; print" "x 4,$_ while<DATA>}30;30;__DATA__###30 9_2_2_7_2_7_2_2_2_108|_||_1|_|1|4_||1|2\1/|_1| #_||_||_108|2|_1|1\1|_3_||_|3/1|_1|1||1\1_|10#

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Langton's Obfuscation
No replies — Read more | Post response
by golux
on Oct 29, 2017 at 01:22
    After watching this very interesting video, I decided it just had to be made into an obfuscation. After completion I realized it had been more than a year since I had composed one -- time flies. As usual, more information can be found at Wikipedia.

    You'll need to have perl/Tk installed to run it. Invoke it with perl <program> (or in Windows give it a .pl extension). I won't give away too much, except to say that the shape of the code hints at the ultimate outcome.

    When first run, type the <space> key to start progress. You can then type <space> again to pause or restart. The number of "cycles" (or "generations") displays in the invoking window after each subsequent pause.

    Two parameters may be given; both are optional.

    The first is an integer that says how many "cycles" to run before changing colors. It defaults to a value which is more obvious when you run the code. Try for example a value of '350'.

    The second is the delay in milliseconds between successive "cycles"; use a larger value to slow down execution. The default is '1' (fastest possible).

    s""v tf!Ul <)%c- %e-%y -%z- %l-% d*>) 1-3-4 1-34- 1-(g1 1(*<% p>tij gu}}2 1111 <%E>t ijgu }}2< %N>Nb joXjo epx.? ofx)* <%N.? ujumf )rr| #Mbo hupo (t!B ou#~* <%w>% N.?Db owbt) .xj>? 911-. if>? 623* .?qb dl<n bq|% w.?d sfbuf Mjof) 9+%`- 1-9+% `-623 *<%w. ?dsfb ufMjo f)1-9 +%`-9 11-9+ %`*~) 2//: :*<' `''% N.?c joe) #=tq bdf? #>?t vc|,, %c&3} }qsjo u#Dpv ou;%l ]o#~* <tvc! s|sbo e)27* ~tvc! `|%w. ?efmf uf)% t*<% t>%w .?ds fbuf Sfdu bohm f)d) (111( **~tv c!d|) 9+%y. 5-9+) 75.%z *.5-9 +%y,5 -9+)7 5.%z* ,5-.g j>?di s)46 */%` [1^* ~%N. ?sfq fbu) %E>? tvc|j g)%c& 3''%l ,,=23 81:*| %j>21 1+%z, %y<%g >%g[% j^<% f>%g @.2; 2<%w .?ef mfuf )%g*< %g[%j ^>%g@ (1(;% w.?ds fbuf Pwbm) d)%d* *<%e& 3boe %z,> %e=3 @.%f ;%f< %e&3 ps%y, >%e@. %f;%f <%e>) %e,%f *&5<' `<%l& %p!ps %d>tq sjou g(&y &y&y (-'s -'s-' s~~*< %N.?N bjoMp pq";s,\s,,g;s;([^[]);chr(ord($1)-1);ge,eval
    say  substr+lc crypt(qw $i3 SI$),4,5
Predecrement a constant?
1 direct reply — Read more / Contribute
by monsoon
on Feb 28, 2017 at 02:14

    Not much obfuscation really. The idea was to try and see if it was possible with some unusual code to predecrement a constant or at least to pretend to do so.

    *0=sub: lvalue {my$l}, print --0 ->(!0)
Dungeons and Dragons die roller (Golf)
4 direct replies — Read more / Contribute
by zsl
on Sep 30, 2016 at 16:18

    60 byte solution, not counting hashbang, to take strings that look like '2d4' or '2d4+10' and give you the result:

    -n ($d,$s,$=)=split/d|\+/;$=+=1+rand $s for 1..$d;print$=,$/

    Anyone wants to try and beat my record?

    $thanks++
Another japh
No replies — Read more | Post response
by Mandrake
on Aug 03, 2016 at 21:43
    Had a bit of spare time today !
    {sub OrO{OrOOr (eval(chr(@_[0])))}}push @Or,++$_ for(0..(++$_*++$_)*++$_);{sub OrOOr{print@_[0]}} OrO(Or(Or0()+1+Or0(),Or0()+1))&&OrO(Or(Or0()+Or0(), Or0()+Or0()/(Or0()-2)))&&OrO(Or(0,(Or0()*(Or0()-1) -1)))&&OrO(Or(Or0()*2+1,(Or0()*2+1)/(Or0()-1)));sub Or{$Or[@_[0]].$Or[@_[1]]}sub Or0{$_= "\[\[\[\[";$_=((split//));}
Self-constructing Japh
1 direct reply — Read more / Contribute
by golux
on Jul 30, 2016 at 17:37
    It's been a while. Here's an obfuscated script written over 4 years ago that finally got finished up. Though it technically works in Windows with "perl -MWin32::Console::ANSI <script>", it looks much better in Linux or MacOS (or probably Cygwin), for which it was designed, as it uses ansi escape sequences.

    Note: to change the speed give an optional delay argument in fractions of a second. The default is 0.1 (ie. 0.5 would be slower, 0.05 faster).

    die+eval(q{$|=pr int"\e[ 2J\n";$k=' |';s ,,2 220;3500731;352273 5071;16007150 74;1622713,x;y; 0-4;8| _/%;;s ;5;\e[103m;g;s,6, \e[102m,g;s;7;\e [m;g;$/=$_;$_=q| hb2Gbb 5hhDei 4dh0Bh lFbi20 1hoC4d o0CdsB bp201h vDev5d v0ChzG |;s;[1 -9];>$&;g;s;[A-I ];^$&;g;y|A-I|1- 9|;{s;^(\w)(\w); ;x?($y =-97+ord$1,$x=-9 7+ord$2):s,^0,, ?$k='/':s,^([>^] )(\d), ,?map{$c=$1,$X=1 +3*$x,$Y=$y* 2,$Z=4;$"=$/=~s; %;$k;r ;map{p rint"\ e[${\$Y ++};${ X}H$_" ;$X--if++$ Z<7}sp lit';' ,$";$k= '|';se lect$J ,$a,$p,$ARG V[0]|| .1;'^' eq$c?$y --:$x+ +}1..$ 2:last;redo }}=~y %8 \n % %dr), "\e[". "22H\n"
    say  substr+lc crypt(qw $i3 SI$),4,5

Set the new obfuscation standard
Title:
code@?#!:
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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (10)
    As of 2018-11-16 09:20 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My code is most likely broken because:
















      Results (193 votes). Check out past polls.

      Notices?
      • (Sep 10, 2018 at 22:53 UTC) Welcome new users!