Log in

View Full Version : a crackme of sorts


mike
September 23rd, 2002, 04:43
Once you learn perl, you have to write a few japhs. They become mini-reversing puzzles for those that read them. All they do is print 'Just another Perl hacker,' (with a comma at the end). Here are my first two attempts:
Code:

$_=q]#*'$$*$$($$)%#,*$$#&$$)$#'$#&'%#+#$#&'$#+%$#'#,*#,,$#*$#&'#''];$
/=q s\s$\%$###$g;\s#&#***#g;0 1chr}1m;(...);g}5'',1(ord)-42}3//;s;;$/
=~s@\*@\\\$@g;$/=~s;\d;qw}print map{ 5 split 3 join }[$&];eg;eval$/;#

$_="You know--Rodney from Roy,like last week's episode!";
s/[^a-z -]*//ig;tr[mRoeny tifl askd-][Preach Jolt sunk,];
print $_{q!JAPHANACRYPTOGRAM!},(reverse split//)[14..38];

Kayaker
September 23rd, 2002, 05:17
I moved this from off-topic Mike. Maybe someone can figure this out and I can learn wtf it means

Regards,
Kayaker

Bengaly
September 24th, 2002, 07:15
crypto is taking over mike's brain

mike
September 28th, 2002, 01:07
The second one is easiest.
$_ is the default scalar variable in Perl. If a command doesn't have a parameter, it grabs it from here. So the first line sets $_ to the string "You know--Rodney from Roy,like last week's episode!"

The second line uses the substitution operator and the transposition operator. The substitution s/[a-z -]// replaces everything that isn't a letter, a dash, or a space with nothing. The switches ig mean case Insensitive and Global. There's no argument to tell it what string to use, so it uses $_.
What's left is "You know--Rodney from Roylike last weeks episode"

The transposition tr[mRoeny tifl askd-][Preach Jolt sunk,] replaces each character in the first list with the corresponding one in the next list. $_ is now "Yeu ncew,,rekcah lreP rehtona tsuJ waanu apoueka". You should be able to see the string now and guess what the rest of the program does.

$_{q!JAPHANACRYPTOGRAM!} is blank because I haven't defined it before (it's an element of %_, a hash table). split // takes the string and turns it into an array of characters. reverse turns it around. [14..38] takes the letters 14..38. print prints!

SiNTAX
September 28th, 2002, 13:27
Somebody's been following the Perl Obfuscation Contest

h**p://www.sysadminmag.com/tpj/obfuscated/


Anyway something even kewl'er:

Wolfenstein 5K
h**p://www.the5k.org/description.asp/entry_id=946


Wolfenstein in JavaScript, just 5kb in size.. what will they think next...

Anyway we're getting REALLY off-topic now.