Advertisement
Guest User

Whitespace obfuscator

a guest
Nov 12th, 2013
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.93 KB | None | 0 0
  1. function obfuscate($code)
  2. {
  3.     $len = strlen($code);
  4.     $obf = '';
  5.    
  6.     for ($i = 0; $i < $len; $i++) {
  7.         $bin = decbin(ord($code[$i]));
  8.         $bin = ($binLen = strlen($bin) > 7)
  9.                  ? ''
  10.                  : implode('', array_fill(0, 8 - strlen($bin), '0')) . $bin;
  11.         $obf .= str_replace(array('1', '0'), array(chr(9), chr(32)), $bin);
  12.     }
  13.    
  14.     return $obf;
  15. }
  16.  
  17. function include_o($file)
  18. {
  19.     $file = trim($file);
  20.     if ( empty($file)
  21.      || !is_readable($file)
  22.     ) {
  23.         throw new Exception("Filename is empty or file isn't readable");
  24.     }
  25.    
  26.     $string = file_get_contents($file);
  27.     $len    = strlen($string);
  28.     $out    = '';
  29.    
  30.     for ($i = 0; $i < $len; $i++) {
  31.         $out .= chr(bindec(str_replace(array(chr(9), chr(32)), array('1', '0'), substr($string, $i, 8))));
  32.         $i += 7;
  33.     }
  34.    
  35.     if (!empty($out)) {
  36.         eval($out);
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement