SHARE
TWEET

Whitespace obfuscator

a guest Nov 12th, 2013 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top