SHARE
TWEET

Untitled

a guest Dec 28th, 2018 129 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP7 Decoder for ionCube Encoder)
  6. *
  7. * @ Version         :   4.0.8.0
  8. * @ Author          :   DeZender
  9. * @ Release on      :   12.11.2018
  10. * @ Official site   :   http://DeZender.Net
  11. *
  12. */
  13.  
  14. class AntiFlood
  15. {
  16.     const OPTION_COUNTER_RESET_SECONDS = 'COUNTER_RESET_SECONDS';
  17.     const OPTION_BAN_REMOVE_SECONDS = 'BAN_REMOVE_SECONDS';
  18.     const OPTION_MAX_REQUESTS = 'MAX_REQUESTS';
  19.     const OPTION_DATA_PATH = 'DATA_PATH';
  20.  
  21.     private $options;
  22.     private $ip;
  23.  
  24.     public function __construct($overrideOptions = [])
  25.     {
  26.         $this->options = array_merge(['COUNTER_RESET_SECONDS' => 2, 'MAX_REQUESTS' => 5, 'BAN_REMOVE_SECONDS' => 60, 'DATA_PATH' => '/tmp/antiflood_' . str_replace(['www.', '.'], ['', '_'], $_SERVER['SERVER_NAME'])], $overrideOptions);
  27.         @mkdir($this->options['DATA_PATH']);
  28.         $this->ip = $_SERVER['REMOTE_ADDR'];
  29.     }
  30.  
  31.     public function isBanned()
  32.     {
  33.         $controlLockFile = $this->options['DATA_PATH'] . '/' . str_replace('.', '_', $this->ip);
  34.  
  35.         if (file_exists($controlLockFile)) {
  36.             if ($this->options['BAN_REMOVE_SECONDS'] < (time() - filemtime($controlLockFile))) {
  37.                 unlink($controlLockFile);
  38.             }
  39.             else {
  40.                 touch($controlLockFile);
  41.                 return true;
  42.             }
  43.         }
  44.  
  45.         $controlFile = $this->options['DATA_PATH'] . '/ctrl';
  46.         $control = [];
  47.  
  48.         if (file_exists($controlFile)) {
  49.             $fh = fopen($controlFile, 'r');
  50.             $fileContentsArr = (0 < filesize($controlFile) ? json_decode(fread($fh, filesize($controlFile)), true) : []);
  51.             $control = array_merge($control, $fileContentsArr);
  52.             fclose($fh);
  53.         }
  54.  
  55.         if (isset($control[$this->ip])) {
  56.             if ((time() - $control[$this->ip]['t']) < $this->options['COUNTER_RESET_SECONDS']) {
  57.                 $control[$this->ip]['c']++;
  58.             }
  59.             else {
  60.                 $control[$this->ip]['c'] = 1;
  61.             }
  62.         }
  63.         else {
  64.             $control[$this->ip]['c'] = 1;
  65.         }
  66.  
  67.         $control[$this->ip]['t'] = time();
  68.  
  69.         if ($this->options['MAX_REQUESTS'] < $control[$this->ip]['c']) {
  70.             $fh = fopen($controlLockFile, 'w');
  71.             fwrite($fh, '');
  72.             fclose($fh);
  73.         }
  74.  
  75.         $fh = fopen($controlFile, 'w');
  76.         fwrite($fh, json_encode($control));
  77.         fclose($fh);
  78.         return false;
  79.     }
  80. }
  81.  
  82. class SmmApi
  83. {
  84.     static public function registerSmm($username, $password, $repassword)
  85.     {
  86.         if ((strlen($username) < 5) || ($password != $repassword) || (strlen($password) < 6)) {
  87.             return ['status' => 0, 'error' => 'Kullanıcı Adınız en 5 karakter olmalı, Şifreniz 6 yada daha uzun karakter ve tekrar yazdığınız şifreniz ile eşleşmelidir.'];
  88.         }
  89.  
  90.         return self::request('register', 'username=' . $username . '&password=' . $password);
  91.     }
  92.  
  93.     static public function postDataSmm($endpoint, $post = NULL)
  94.     {
  95.         return self::request($endpoint, $post ? http_build_query($post) : $post);
  96.     }
  97.  
  98.     static public function getDataSmm($endpoint, $get = NULL)
  99.     {
  100.         return self::request($endpoint, $get ? http_build_query($get) : $get);
  101.     }
  102.  
  103.     static private function request($endpoint, $post = NULL)
  104.     {
  105.         $headers = ['INSTAWEBAUTH: ' . Wow::get('ayar/InstaWebSmmAuth')];
  106.         $ch = curl_init();
  107.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  108.         curl_setopt($ch, CURLOPT_USERAGENT, md5('InstaWebBot google'));
  109.         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  110.         curl_setopt($ch, CURLOPT_HEADER, true);
  111.         curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  112.         curl_setopt($ch, CURLOPT_VERBOSE, false);
  113.         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  114.         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  115.         curl_setopt($ch, CURLOPT_ENCODING, '');
  116.         curl_setopt($ch, CURLOPT_URL, 'https://lsd.insta.web.tr/smm-api/' . $endpoint);
  117.  
  118.         if ($post) {
  119.             curl_setopt($ch, CURLOPT_POST, true);
  120.             curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  121.         }
  122.  
  123.         $resp = curl_exec($ch);
  124.         $header_len = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
  125.         $header = substr($resp, 0, $header_len);
  126.         $body = substr($resp, $header_len);
  127.         curl_close($ch);
  128.         return json_decode($body, true, 512, JSON_BIGINT_AS_STRING);
  129.     }
  130. }
  131.  
  132. class Signatures
  133. {
  134.     static public function generateSignature($data)
  135.     {
  136.         return hash_hmac('sha256', $data, Constants::IG_SIG_KEY);
  137.     }
  138.  
  139.     static public function signData(array $data, array $exclude = [])
  140.     {
  141.         $result = [];
  142.  
  143.         foreach ($exclude as $key) {
  144.             if (isset($data[$key])) {
  145.                 $result[$key] = $data[$key];
  146.                 unset($data[$key]);
  147.             }
  148.         }
  149.  
  150.         foreach ($data as &$value) {
  151.             if (is_scalar($value)) {
  152.                 $value = (string) $value;
  153.             }
  154.         }
  155.  
  156.         unset($value);
  157.         $data = json_encode((object) Utils::reorderByHashCode($data));
  158.         $result['ig_sig_key_version'] = Constants::SIG_KEY_VERSION;
  159.         $result['signed_body'] = self::generateSignature($data) . '.' . $data;
  160.         return Utils::reorderByHashCode($result);
  161.     }
  162.  
  163.     static public function generateDeviceId()
  164.     {
  165.         $megaRandomHash = md5(number_format(microtime(true), 7, '', ''));
  166.         return 'android-' . substr($megaRandomHash, 16);
  167.     }
  168.  
  169.     static public function generateUUID($keepDashes = true)
  170.     {
  171.         $uuid = sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 4095) | 16384, mt_rand(0, 16383) | 32768, mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
  172.         return $keepDashes ? $uuid : str_replace('-', '', $uuid);
  173.     }
  174. }
  175.  
  176. class Utils
  177. {
  178.     const BOUNDARY_CHARS = '-_1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  179.     const BOUNDARY_LENGTH = 30;
  180.  
  181.     static public function generateMultipartBoundary()
  182.     {
  183.         $result = '';
  184.         $max = strlen('-_1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') - 1;
  185.  
  186.         for ($i = 0; $i < 30; ++$i) {
  187.             $result .= '-_1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'[mt_rand(0, $max)];
  188.         }
  189.  
  190.         return $result;
  191.     }
  192.  
  193.     static public function hashCode($string)
  194.     {
  195.         $result = 0;
  196.         $len = strlen($string);
  197.  
  198.         for ($i = 0; $i < $len; ++$i) {
  199.             $result = ((-1 * $result) + ($result << 5) + ord($string[$i])) & 4294967295.0;
  200.         }
  201.  
  202.         if (4 < PHP_INT_SIZE) {
  203.             if (2147483647 < $result) {
  204.                 $result -= 4294967296.0;
  205.             }
  206.             else if ($result < -2147483648.0) {
  207.                 $result += 4294967296.0;
  208.             }
  209.         }
  210.  
  211.         return $result;
  212.     }
  213.  
  214.     static public function reorderByHashCode(array $data)
  215.     {
  216.         $hashCodes = [];
  217.  
  218.         foreach ($data as $key => $value) {
  219.             $hashCodes[$key] = self::hashCode($key);
  220.         }
  221.  
  222.         uksort($data, function($a, $b) use($hashCodes) {
  223.             $a = $hashCodes[$a];
  224.             $b = $hashCodes[$b];
  225.  
  226.             if ($a < $b) {
  227.                 return -1;
  228.             }
  229.             else if ($b < $a) {
  230.                 return 1;
  231.             }
  232.             else {
  233.                 return 0;
  234.             }
  235.         });
  236.         return $data;
  237.     }
  238.  
  239.     static public function generateUploadId()
  240.     {
  241.         return number_format(round(microtime(true) * 1000), 0, '', '');
  242.     }
  243.  
  244.     static public function generateUserBreadcrumb($size)
  245.     {
  246.         $key = 'iN4$aGr0m';
  247.         $date = (int) microtime(true) * 1000;
  248.         $term = (rand(2, 3) * 1000) + ($size * rand(15, 20) * 100);
  249.         $text_change_event_count = round($size / rand(2, 3));
  250.  
  251.         if ($text_change_event_count == 0) {
  252.             $text_change_event_count = 1;
  253.         }
  254.  
  255.         $data = $size . ' ' . $term . ' ' . $text_change_event_count . ' ' . $date;
  256.         return base64_encode(hash_hmac('sha256', $data, $key, true)) . "\n" . base64_encode($data) . "\n";
  257.     }
  258.  
  259.     static public function cookieToArray($string, $domain)
  260.     {
  261.         $arrCookies = [];
  262.         $fileVals = self::extractCookies($string);
  263.  
  264.         foreach ($fileVals as $cookie) {
  265.             if ($cookie['domain'] == $domain) {
  266.                 $arrCookies[$cookie['name']] = $cookie['value'];
  267.             }
  268.         }
  269.  
  270.         return $arrCookies;
  271.     }
  272.  
  273.     static public function generateAsns($asnsNumber)
  274.     {
  275.         $asnsNumber = intval($asnsNumber);
  276.         if (($asnsNumber == 0) || (intval(Wow::get('ayar/proxyStatus')) == 0)) {
  277.             return [NULL, NULL];
  278.         }
  279.  
  280.         if (Wow::get('ayar/proxyStatus') == 3) {
  281.             $byPassServerCode = trim(Wow::get('ayar/proxyList'));
  282.             $byPassServerUA = (strpos($byPassServerCode, '@') !== false ? explode('@', $byPassServerCode)[0] : NULL);
  283.             $byPassServerRange = (strpos($byPassServerCode, '@') !== false ? explode(':', explode('@', $byPassServerCode)[1]) : explode(':', $byPassServerCode));
  284.             return [$byPassServerRange[0] . ':' . (intval($byPassServerRange[1]) + $asnsNumber), $byPassServerUA];
  285.         }
  286.  
  287.         $asnsNumber--;
  288.         $proxyList = explode("\r\n", Wow::get('ayar/proxyList'));
  289.         $proxyString = (isset($proxyList[$asnsNumber]) ? $proxyList[$asnsNumber] : NULL);
  290.  
  291.         if (empty($proxyString)) {
  292.             return [NULL, NULL];
  293.         }
  294.  
  295.         if (Wow::get('ayar/proxyStatus') == 4) {
  296.             $ipType = (strpos($proxyString, ':') !== false ? CURL_IPRESOLVE_V6 : NULL);
  297.             return [$proxyString, $ipType];
  298.         }
  299.  
  300.         $proxyUserPwd = (strpos($proxyString, '@') !== false ? explode('@', $proxyString)[0] : NULL);
  301.         $proxyHostPort = (strpos($proxyString, '@') !== false ? explode('@', $proxyString)[1] : $proxyString);
  302.         return [$proxyHostPort, $proxyUserPwd];
  303.     }
  304.  
  305.     static public function extractCookies($string)
  306.     {
  307.         $lines = explode(PHP_EOL, $string);
  308.         $cookies = [];
  309.  
  310.         foreach ($lines as $line) {
  311.             $cookie = [];
  312.  
  313.             if (substr($line, 0, 10) == '#HttpOnly_') {
  314.                 $line = substr($line, 10);
  315.                 $cookie['httponly'] = true;
  316.             }
  317.             else {
  318.                 $cookie['httponly'] = false;
  319.             }
  320.             if ((substr($line, 0, 1) != '#') && (substr_count($line, '\\' . "\t") == 6)) {
  321.                 $tokens = explode('\\' . "\t", $line);
  322.                 $tokens = array_map('trim', $tokens);
  323.                 $cookie['domain'] = $tokens[0];
  324.                 $cookie['flag'] = $tokens[1];
  325.                 $cookie['path'] = $tokens[2];
  326.                 $cookie['secure'] = $tokens[3];
  327.                 $cookie['expiration-epoch'] = $tokens[4];
  328.                 $cookie['name'] = urldecode($tokens[5]);
  329.                 $cookie['value'] = urldecode($tokens[6]);
  330. .......................................................................
  331. ......................................
  332. .............
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
 
Top