mister5317 Posted September 1, 2009 Share Posted September 1, 2009 I found it a fun learning experience to make something as simple as "HELLO WORLD!" into a difficult process. I obfuscated my PHP below to just echo "HELLO WORLD!". Anyone else have a better example to echo "HELLO WORLD!"? <?php // Output = HELLO WORLD! function __e($_){echo$_; }function __($_){__e(chr ($_));}function _a(){$__ =func_get_args();foreach ($__ as$k=>$v)$a[$k]=$v; return$a;}foreach(_a(7,4 ,+11,11,14,-33,22,14,17, 11,3,-32)as$k=>$v){__(65 +$v);} Give it a shot, it more difficult to think of creative ways to make something out of the box like this. Quote Link to comment https://forums.phpfreaks.com/topic/172743-php-obfuscation/ Share on other sites More sharing options...
waynew Posted September 1, 2009 Share Posted September 1, 2009 You should post this in the misc section. Quote Link to comment https://forums.phpfreaks.com/topic/172743-php-obfuscation/#findComment-910511 Share on other sites More sharing options...
mister5317 Posted September 1, 2009 Author Share Posted September 1, 2009 Shoot, sorry, I don't see a place to move it... Quote Link to comment https://forums.phpfreaks.com/topic/172743-php-obfuscation/#findComment-910523 Share on other sites More sharing options...
waynew Posted September 1, 2009 Share Posted September 1, 2009 Ah, just post a new topic. Quote Link to comment https://forums.phpfreaks.com/topic/172743-php-obfuscation/#findComment-910527 Share on other sites More sharing options...
bossman Posted September 1, 2009 Share Posted September 1, 2009 im confused with what you mean by obfuscation...cant you just <? echo "HELLO WORLD!"; ?> ........? Quote Link to comment https://forums.phpfreaks.com/topic/172743-php-obfuscation/#findComment-910537 Share on other sites More sharing options...
Batosi Posted September 1, 2009 Share Posted September 1, 2009 Yea he can but the point is to make it complex Quote Link to comment https://forums.phpfreaks.com/topic/172743-php-obfuscation/#findComment-910543 Share on other sites More sharing options...
Daniel0 Posted September 1, 2009 Share Posted September 1, 2009 function _f($z){return($z==1?0:($z==2?1:_f($z-1)+_f($z-2)));}$_a=array(0x38,0x2d,0x3c,0x2a,0x3d,0x45,0x36,0x24,0x21,0x3c,0x2c,0x51);$_b=array(0x6f,0x66,0x6d,0x65,0x70,0x62,0x60,0x69,0x70);for($i=0,$a=sizeof($_a),$b=sizeof($_b);$i<$a;++$i)print(chr($_a[$i]^($_b[$i%$b]+_f($i%3+3)))); Ninja points to whomever finds the easter egg(s). Quote Link to comment https://forums.phpfreaks.com/topic/172743-php-obfuscation/#findComment-910565 Share on other sites More sharing options...
newbtophp Posted September 2, 2009 Share Posted September 2, 2009 If the obfuscation is formatted, it can be easily read, theirfore more easyier to deobfuscate <?php // Output = HELLO WORLD! function __e($_) { echo $_; } function __($_) { __e(chr($_)); } function _a() { $__ = func_get_args(); foreach ($__ as $k => $v) $a[$k] = $v; return $a; } foreach (_a(7, 4, + 11, 11, 14, -33, 22, 14, 17, 11, 3, -32) as $k => $v) { __(65 + $v); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/172743-php-obfuscation/#findComment-910694 Share on other sites More sharing options...
Philip Posted September 2, 2009 Share Posted September 2, 2009 Pretend this post doesn't exist. Quote Link to comment https://forums.phpfreaks.com/topic/172743-php-obfuscation/#findComment-910695 Share on other sites More sharing options...
corbin Posted September 2, 2009 Share Posted September 2, 2009 Pretend this post doesn't exist. But it does! Daniel: A recursive function wrapped in an ugly ternary statement, numbers in hex representation and bit manipulation... Wow! Quote Link to comment https://forums.phpfreaks.com/topic/172743-php-obfuscation/#findComment-910709 Share on other sites More sharing options...
Daniel0 Posted September 2, 2009 Share Posted September 2, 2009 A recursive function wrapped in an ugly ternary statement, numbers in hex representation and bit manipulation... Wow! Yeah, but it's a special recursive function, a particular type of bit manipulation and one of the number sequences have a special meaning and one of the number sequences have a special meaning if you fiddle a bit with it. Quote Link to comment https://forums.phpfreaks.com/topic/172743-php-obfuscation/#findComment-910728 Share on other sites More sharing options...
corbin Posted September 2, 2009 Share Posted September 2, 2009 I figured your easter eggs had something to do with the numbers so I looked at them a bit but couldn't come up with anything.... Quote Link to comment https://forums.phpfreaks.com/topic/172743-php-obfuscation/#findComment-911257 Share on other sites More sharing options...
Daniel0 Posted September 3, 2009 Share Posted September 3, 2009 The easter egg is 'phpfreaks'. function _f($z){return($z==1?0:($z==2?1:_f($z-1)+_f($z-2)));} $_a=array(0x38,0x2d,0x3c,0x2a,0x3d,0x45,0x36,0x24,0x21,0x3c,0x2c,0x51); $_b=array(0x6f,0x66,0x6d,0x65,0x70,0x62,0x60,0x69,0x70);for($i=0,$a=sizeof($_a),$b=sizeof($_b);$i<$a;++$i)print(chr($_a[$i]^($_b[$i%$b]+_f($i%3+3)))); Here is how it works: The function I defined is a recursive implementation of the Fibonacci sequence. The arrays $_a and $_b contain the strings HELLO WORLD! and phpfreaks. However, each character in $_b has been shifted upwards with the $i % 3 + 3th Fibonacci number. Then I applied a XOR shift on $_a with the Fibonacci shifted string. The code I posted reverses this of course. Quote Link to comment https://forums.phpfreaks.com/topic/172743-php-obfuscation/#findComment-911409 Share on other sites More sharing options...
JonnoTheDev Posted September 3, 2009 Share Posted September 3, 2009 Am I reading the Da Vinci Code here! My god, you need to get out more! Quote Link to comment https://forums.phpfreaks.com/topic/172743-php-obfuscation/#findComment-911485 Share on other sites More sharing options...
corbin Posted September 3, 2009 Share Posted September 3, 2009 Hrmmm, that would explain where the numbers came from then . Quote Link to comment https://forums.phpfreaks.com/topic/172743-php-obfuscation/#findComment-912072 Share on other sites More sharing options...
PugJr Posted September 3, 2009 Share Posted September 3, 2009 Now we know why Daniel is one of the adminstrators here... Quote Link to comment https://forums.phpfreaks.com/topic/172743-php-obfuscation/#findComment-912080 Share on other sites More sharing options...
lococobra Posted September 4, 2009 Share Posted September 4, 2009 Try this one on for size. Not all that complicated but it sure looks like a mess $__="\142\141\163\145\66\64\137\144\145\143" ."\157\144\145";eval("\$_=$__('YS5mdW5jdGlvb iAuZWNoby5iLmNoci5yZXR1cm4gLigzKy4pKjUubA'); ");$_=explode('.',$_);function l($b){global $_;eval($$_[3]);}$_[8]("$_[1]$_[0]($$_[0]){ $_[2]$$_[0];}$_[1]$_[3]($$_[0]){ $_[5]$_[4]( $$_[0]);}");foreach(array(11.4,7.2,12.2,18.6 ,6.6,3.4,20.8,12.8,19.8,18.6,10.6,3.6)as $__ ){eval("\$c=($_[6]$__$_[7]);");$_[0]($_[3]( $c));} EDIT: This was all done by hand by the way, as was my signature Quote Link to comment https://forums.phpfreaks.com/topic/172743-php-obfuscation/#findComment-912749 Share on other sites More sharing options...
corbin Posted September 4, 2009 Share Posted September 4, 2009 Ewww! Minus points for eval and global. Perhaps I should keep my mouth shut though since I haven't even tried yet... Quote Link to comment https://forums.phpfreaks.com/topic/172743-php-obfuscation/#findComment-912753 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.