JAPH Ad Infinitum
No replies — Read more | Post response
|
by rebugger
on Nov 21, 2011 at 17:16
|
|
|
This is my first attempt at obfuscated code. It's not incredibly obfuscated, tbh, but I was satisfied with it the way it turned out. Note that while it doesn't run "in place" in a DOS/Windows environment (and maybe others), you should at least be able to see what it's doing
@s=split//,'Just another Perl hacker, ';@t=(.1);while(t){$"="";@l=(&
+s
(2)."@s[2..5] "."@s[19,18,17,16]",' '.$s[1].&s(4).$s[6].&s(1).$s[20]
+.
&s(4).$s[15],$s[0].&s(6).$s[7].&s(6).$s[14],' '.$s[27].&s(4).$s[22].'
+'
.$s[8].&s(4).$s[13],&s(2)."@s[26,25,24,23]".&s(3)."@s[9..12]");$"="\n"
+;
print"@l\n\e[5A\r";select$t,$t,$t,$t[0];push@s,shift@s}sub s{' 'x$_[0]
+}
Hope you enjoy!
|
japh: prints just another perl hack
1 direct reply — Read more / Contribute
|
by ansh batra
on Nov 21, 2011 at 02:19
|
|
|
print("##### # # ### ##### # # # # ##### #
+# ##### ### #### ##### ### # # # # ##
+# # #\n # # # # # # # ## # # # #
+# # # # # # # # # # # # # # #
+ # # #\n # # # ## # # # # # # # # #
+ ##### ### # # #### ### ### # ##### # #
+ # ##\n# # # # # # ##### # ## # # #
+ # # # # # # # # # # # # ####
+# # # #\n # # ### # # # # # #
+# # # ##### # # # ##### # # ##### # # #
+ # ### # #\n");
download the code and run it
|
JAPH from POD
1 direct reply — Read more / Contribute
|
by trizen
on Nov 03, 2011 at 13:02
|
|
|
sub f{my%D;@D{@_}=();for(@_){if(-d){next if${_}eq'.';my@g;opendir(D,${
+_})||next;
while(defined(my$d=readdir(D))){unless(${d}eq'.'or${d}eq'..'){push@g,"
+${_}/$d"}}
closedir(D);push@f,grep({-f}@g);f(grep((!exists($D{$_})),grep({-d}@g))
+)}elsif(-f
){push@f,$_}}return@f}my$q=qr/["']\w[^\W\d]{3}\h\w{5}([[:alpha:]])\S\b
+\N\D\1\w+?
\s\p{PosixAlpha}\B.[\x63-\x72]{4,},?(?:\\n)?["']/six;do{-T||next;open(
+_,'<',$_);
sysread _,$_,-s;if(/$q/o){$_=eval$&;chomp;local$\=$/;print;exit}}forea
+ch(f@INC);
|
Just another unpack hacker
2 direct replies — Read more / Contribute
|
by ambrus
on Oct 25, 2011 at 13:05
|
|
|
print unpack "(C/(xx)X220a)26", pack "a366",
"qsoultoJk ontalPykvhscktkol,r few ues\nrenrnlhaarchkrb"
Update 2013-05-24: see Re: how to unpack a C struct with length array preceding data array.
|
Up and down
4 direct replies — Read more / Contribute
|
by trizen
on Oct 25, 2011 at 08:55
|
|
|
eval { hacker
Perl
another
Just
$,=$"};
eval { Just
another
Perl
hacker
};
package another
;sub Just
{print qw; Perl
hacker
;}
package hacker
;sub Perl
{print qw; Just
another
;,''}
or
Just another Perl hacker
local+$,=$";package another;sub Just{print(substr((caller(0))[3],3**2)
+,@_)}
package hacker;sub Perl{Just another((split/:./,(caller(0))[3])[1,0]),
+exit}
|
Objects: Classical and Functional
3 direct replies — Read more / Contribute
|
by davido
on Oct 25, 2011 at 00:09
|
|
|
I had an idea, and as I worked on it, two forms emerged.
Blessed Objects:
$"='|';$|=$d=1;@b=map{bless{t,"$_ ",r,$d*=-1}}qw/Just another Perl
hacker,/;sub v{$s=shift;my$_=$$s{t};$r=int y===c*$$s{a}/360;$$s{a}=
($$s{a}+$$s{r})%360;s%(.{$r})(.*)%$2$1%;$_}{print"\r@{[map{v$_}@b]
}";select$x,$y,$z,2e-3;redo}
Functional Objects:
$"='|';$|=$d=1;@b=map{my($t,$h,$a)=("$_ ",$d*=-1);sub{my$_=$t;$r=int
y===c*$a/360;$a=($a+$h)%360;s%(.{$r})(.*)%$2$1%;$_}}qw/Just another
Perl hacker,/;{print"\r@{[map{&$_}@b]}";select$x,$y,$z,2e-3;redo}
The extra discussion may be unconventional for this sort of post, but I just enjoyed the process and felt like sharing a little about it.
Enjoy!
|
Nervous sub
2 direct replies — Read more / Contribute
|
by davido
on Oct 23, 2011 at 02:40
|
|
|
Just for my amusement... It's been awhile since I've done one of these, but a little idea came to me this morning that I played with this evening before turning in. Maybe others will find some amusement in it too.
Enjoy!
$s=q;Just another Perl hacker,;;sub u{;lc pop}for my$i(0..24){push@s,
sub{[(r()>.98)?(\&u,\&l)[&r+.5]->((split//,${substr($s,2,1,)})[$i]):(
split//,$s)[$i],r()*1.3+$i-.65]}}sub l{uc pop}$|++;for(1..500){;@o=([
"\r"],sort{$a->[1]<=>$b->[-1]}map{;$_->()}@s);print$_->[0x00]for@{[@o
]};select$_->[2],$_->[3],$_->[4],r()*.2;}sub r{rand}sub s{$f->[0]=$s}
|
Invisible JAPH?
No replies — Read more | Post response
|
by trizen
on Sep 09, 2011 at 13:30
|
|
|
After execution, take a look at your $0 script.
open _=>">$0";print _+'print chr length for split"\5"=>qq;';print _+qq
"\0"x+ord($_)=>"\5"for(split//=>join''=>'Vioh<}rshtyn<Lynp<t}'^$;x(ord
($/)*(++$-*$-++)),'iaox,'^$/x($-**$-),$/);print _ ';';close _;do"./$0"
|
Length obfuscation
3 direct replies — Read more / Contribute
|
by trizen
on Aug 03, 2011 at 08:51
|
|
|
Hi monks,
this is my first post.
# Global mode (pretty slow on large files)
$_=q qrea ncJertsa ,thelhPkour q,my $i=length;
while($i){s/(.{$i})(.)/$2$1/g;--$i}print+$_.$/
# Non-global
$_=q qnPteorJlt hhascekaerru, q,my $i=length;
while($i){s/(.{$i})(.)/$2$1/;--$i}print+$_.$/;
# Opposite code:
$_=q qJust another Perl hacker,q;until($i eq
length){s/(.)(.{$i})/$2$1/g;++$i}print+$_.$/
It's very simple and easy to understand. Note: for files should be added '/s'
|
(almost) foldl
7 direct replies — Read more / Contribute
|
by dk
on Jun 07, 2011 at 17:16
|
|
|
There runs now a topic on moscow.pm list on how to calculate a sum of numbers in a list, basically
this:
my $sum = 0;
$sum += $_ for @list;
but without using extra vars and modules (nurture your inner purist, yes :) Now I believe I found a line that wasn't discovered before:
print sub { (map {splice @_, 0, 2, $_[0] + ($_[1] // 0)} @_)[-1] }-> (
+1,2,3,4,5);
Hopefully you'll find it amusing :)
|
|