<?xml version="1.0" encoding="windows-1252"?>
<node id="290623" title="Re: Fun With Reserved Keywords" created="2003-09-11 05:17:30" updated="2005-08-12 02:14:35">
<type id="11">
note</type>
<author id="47040">
Chady</author>
<data>
<field name="doctext">
&lt;p&gt;This is a really cool obfu. and it's the first time I attempt to crack an obfuscation. Please correct me where I'm wrong&lt;/p&gt;
(spoilers in readmore)
&lt;readmore&gt;

&lt;p&gt;First of all, this obfu uses a lot of quoting, and the &lt;code&gt;xor&lt;/code&gt;s are there to seperate the statements, so if we hunt down the qw// q// qq// s/// we end up with something that looks like this.&lt;/p&gt;

&lt;code&gt;
1  . not exp log srand; 
2  . s// /x ;
3  . s/ /length uc ord and print chr ord for qw[join use sub tied]/
4  . ; eval 
5  . ; print qq| | 
6  . ; int eval lc q|cos and print chr ord for 
7  .             qw[ abs ne open tied hex exp ref]|
8  . 
9  . ; scalar srand print qq| |
10 . ; int eval lc qq|sqrt cos and print chr ord for 
11 .             qw[printf each return local]|
12 .       or print qq| | 
13 .       and eval q|undef or oct xor time xor 
14 .                   ref print chr int ord lc
15 .                   foreach qw[hex alarm chdir kill exec return]| 
16 . gt sin sort split
&lt;/code&gt;

&lt;p&gt;Line 1 : decorative?&lt;/p&gt;
&lt;p&gt;Lines 2-4 : These lines evaluate the statement in line 3 - &lt;code&gt;length uc ord&lt;/code&gt; returns a true values so that &lt;code&gt;and&lt;/code&gt; gets to the print which prints out the first letter of the quoted words 'join use sub tied'. &lt;code&gt;ord&lt;/code&gt; return the ord of the first letter, and then &lt;code&gt;chr&lt;/code&gt; passes that letter to print. So these lines print 'just'&lt;/p&gt;
&lt;p&gt;Lines 6-7 : These lines use the same technique to print 'another' using a small variation.&lt;/p&gt;

&lt;p&gt;Lines 10-11 : print 'perl'&lt;/p&gt;
&lt;p&gt;Lines 13-15 : print 'hacker' in another variation&lt;/p&gt;

&lt;p&gt;The smart thing is the way the last part (lines 10-16) are compiled to be executed in that order; 
depending on the return values, these last lines evaluate to roughly &lt;code&gt;0 or 1 and 0 gt 0&lt;/code&gt;,
and having the statements inside &lt;code&gt;eval&lt;/code&gt;s makes sure they are executed in order.&lt;/p&gt;

&lt;/readmore&gt;

&lt;p&gt;I hope I got it right?&lt;/p&gt; 

&lt;hr&gt;&lt;font size="1"&gt;He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.&lt;br&gt;&lt;br&gt;
&lt;A HREF="/index.pl?node=Chady"&gt;Chady&lt;/A&gt; | &lt;a href="http://chady.net" target="Chady"&gt;http://chady.net/&lt;/a&gt;&lt;/font&gt;</field>
<field name="root_node">
290607</field>
<field name="parent_node">
290607</field>
</data>
</node>
