SHARE
TWEET

Untitled

a guest Jan 16th, 2019 208 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.2
  8. * @ Author          :   DeZender
  9. * @ Release on      :   02.01.2019
  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 Signatures
  83. {
  84.     static public function generateSignature($data)
  85.     {
  86.         return hash_hmac('sha256', $data, Constants::IG_SIG_KEY);
  87.     }
  88.  
  89.     static public function signData($data, $exclude = [])
  90.     {
  91.         $result = [];
  92.  
  93.         foreach ($exclude as $key) {
  94.             if (isset($data[$key])) {
  95.                 $result[$key] = $data[$key];
  96.                 unset($data[$key]);
  97.             }
  98.         }
  99.  
  100.         foreach ($data as &$value) {
  101.             if (is_scalar($value)) {
  102.                 $value = (string) $value;
  103.             }
  104.         }
  105.  
  106.         unset($value);
  107.         $data = json_encode((object) Utils::reorderByHashCode($data));
  108.         $result['ig_sig_key_version'] = Constants::SIG_KEY_VERSION;
  109.         $result['signed_body'] = '1.' . $data;
  110.         return Utils::reorderByHashCode($result);
  111.     }
  112.  
  113.     static public function generateDeviceId()
  114.     {
  115.         $megaRandomHash = md5(number_format(microtime(true), 7, '', ''));
  116.         return 'android-' . substr($megaRandomHash, 16);
  117.     }
  118.  
  119.     static public function generateUUID($keepDashes = true)
  120.     {
  121.         $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));
  122.         return $keepDashes ? $uuid : str_replace('-', '', $uuid);
  123.     }
  124. }
  125.  
  126. class Utils
  127. {
  128.     const BOUNDARY_CHARS = '-_1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  129.     const BOUNDARY_LENGTH = 30;
  130.  
  131.     /**
  132.          * Last uploadId generated with microtime().
  133.          *
  134.          * @var string|null
  135.          */
  136.     static protected $_lastUploadId;
  137.  
  138.     static public function generateMultipartBoundary()
  139.     {
  140.         $result = '';
  141.         $max = strlen('-_1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') - 1;
  142.  
  143.         for ($i = 0; $i < 30; ++$i) {
  144.             $result .= '-_1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'[mt_rand(0, $max)];
  145.         }
  146.  
  147.         return $result;
  148.     }
  149.  
  150.     static public function hashCode($string)
  151.     {
  152.         $result = 0;
  153.         $len = strlen($string);
  154.  
  155.         for ($i = 0; $i < $len; ++$i) {
  156.             $result = ((-1 * $result) + ($result << 5) + ord($string[$i])) & 4294967295.0;
  157.         }
  158.  
  159.         if (4 < PHP_INT_SIZE) {
  160.             if (2147483647 < $result) {
  161.                 $result -= 4294967296.0;
  162.             }
  163.             else if ($result < -2147483648.0) {
  164.                 $result += 4294967296.0;
  165.             }
  166.         }
  167.  
  168.         return $result;
  169.     }
  170.  
  171.     static public function reorderByHashCode($data)
  172.     {
  173.         $hashCodes = [];
  174.  
  175.         foreach ($data as $key => $value) {
  176.             $hashCodes[$key] = self::hashCode($key);
  177.         }
  178.  
  179.         uksort($data, function($a, $b) use($hashCodes) {
  180.             $a = $hashCodes[$a];
  181.             $b = $hashCodes[$b];
  182.  
  183.             if ($a < $b) {
  184.                 return -1;
  185.             }
  186.             else if ($b < $a) {
  187.                 return 1;
  188.             }
  189.             else {
  190.                 return 0;
  191.             }
  192.         });
  193.         return $data;
  194.     }
  195.  
  196.     static public function generateUploadId($useNano = false)
  197.     {
  198.         $result = NULL;
  199.  
  200.         if (!$useNano) {
  201.             while (true) {
  202.                 $result = number_format(round(microtime(true) * 1000), 0, '', '');
  203.                 if ((self::$_lastUploadId !== NULL) && ($result === self::$_lastUploadId)) {
  204.                     usleep(1000);
  205.                     continue;
  206.                 }
  207.  
  208.                 self::$_lastUploadId = $result;
  209.                 break;
  210.             }
  211.         }
  212.         else {
  213.             $result = number_format(microtime(true) - strtotime('Last Monday'), 6, '', '');
  214.             $result .= str_pad((string) mt_rand(1, 999), 3, '0', STR_PAD_LEFT);
  215.         }
  216.  
  217.         return $result;
  218.     }
  219.  
  220.     static public function generateUserBreadcrumb($size)
  221.     {
  222.         $key = 'iN4$aGr0m';
  223.         $date = (int) microtime(true) * 1000;
  224.         $term = (rand(2, 3) * 1000) + ($size * rand(15, 20) * 100);
  225.         $text_change_event_count = round($size / rand(2, 3));
  226.  
  227.         if ($text_change_event_count == 0) {
  228.             $text_change_event_count = 1;
  229.         }
  230.  
  231.         $data = $size . ' ' . $term . ' ' . $text_change_event_count . ' ' . $date;
  232.         return base64_encode(hash_hmac('sha256', $data, $key, true)) . "\n" . base64_encode($data) . "\n";
  233.     }
  234.  
  235.     static public function cookieToArray($string, $domain)
  236.     {
  237.         $arrCookies = [];
  238.         $fileVals = self::extractCookies($string);
  239.  
  240.         foreach ($fileVals as $cookie) {
  241.             if ($cookie['domain'] == $domain) {
  242.                 $arrCookies[$cookie['name']] = $cookie['value'];
  243.             }
  244.         }
  245.  
  246.         return $arrCookies;
  247.     }
  248.  
  249.     static public function generateAsns($asnsNumber)
  250.     {
  251.         $asnsNumber = intval($asnsNumber);
  252.         if (($asnsNumber == 0) || (intval(Wow::get('ayar/proxyStatus')) == 0)) {
  253.             return [NULL, NULL];
  254.         }
  255.  
  256.         if (Wow::get('ayar/proxyStatus') == 3) {
  257.             $byPassServerCode = trim(Wow::get('ayar/proxyList'));
  258.             $byPassServerUA = (strpos($byPassServerCode, '@') !== false ? explode('@', $byPassServerCode)[0] : NULL);
  259.             $byPassServerRange = (strpos($byPassServerCode, '@') !== false ? explode(':', explode('@', $byPassServerCode)[1]) : explode(':', $byPassServerCode));
  260.             return [$byPassServerRange[0] . ':' . (intval($byPassServerRange[1]) + $asnsNumber), $byPassServerUA];
  261.         }
  262.  
  263.         $asnsNumber--;
  264.         $proxyList = explode("\r\n", Wow::get('ayar/proxyList'));
  265.         $proxyString = (isset($proxyList[$asnsNumber]) ? $proxyList[$asnsNumber] : NULL);
  266.  
  267.         if (empty($proxyString)) {
  268.             return [NULL, NULL];
  269.         }
  270.  
  271.         if (Wow::get('ayar/proxyStatus') == 4) {
  272.             $ipType = (strpos($proxyString, ':') !== false ? CURL_IPRESOLVE_V6 : NULL);
  273.             return [$proxyString, $ipType];
  274.         }
  275.  
  276.         $proxyUserPwd = (strpos($proxyString, '@') !== false ? explode('@', $proxyString)[0] : NULL);
  277.         $proxyHostPort = (strpos($proxyString, '@') !== false ? explode('@', $proxyString)[1] : $proxyString);
  278.         return [$proxyHostPort, $proxyUserPwd];
  279.     }
  280.  
  281.     static public function extractCookies($string)
  282.     {
  283.         $lines = explode(PHP_EOL, $string);
  284.         $cookies = [];
  285.  
  286.         foreach ($lines as $line) {
  287.             $cookie = [];
  288.  
  289.             if (substr($line, 0, 10) == '#HttpOnly_') {
  290.                 $line = substr($line, 10);
  291.                 $cookie['httponly'] = true;
  292.             }
  293.             else {
  294.                 $cookie['httponly'] = false;
  295.             }
  296.             if ((substr($line, 0, 1) != '#') && (substr_count($line, '\\' . "\t") == 6)) {
  297.                 $tokens = explode('\\' . "\t", $line);
  298.                 $tokens = array_map('trim', $tokens);
  299.                 $cookie['domain'] = $tokens[0];
  300.                 $cookie['flag'] = $tokens[1];
  301.                 $cookie['path'] = $tokens[2];
  302.                 $cookie['secure'] = $tokens[3];
  303.                 $cookie['expiration-epoch'] = $tokens[4];
  304.                 $cookie['name'] = urldecode($tokens[5]);
  305.                 $cookie['value'] = urldecode($tokens[6]);
  306.                 $cookie['expiration'] = date('Y-m-d h:i:s', $tokens[4]);
  307.                 $cookies[] = $cookie;
  308.             }
  309.         }
  310.  
  311.         return $cookies;
  312.     }
  313.  
  314.     static public function cookieConverter($cookie, $cnf, $c)
  315.     {
  316.         $confData = [];
  317.  
  318.         if (!empty($cnf)) {
  319.             $separator = "\r\n";
  320.             $line = strtok($cnf, $separator);
  321.  
  322.             while ($line !== false) {
  323.                 if ($line[0] == '#') {
  324.                     continue;
  325.                 }
  326.  
  327.                 $kv = explode('=', $line, 2);
  328.                 $confData[$kv[0]] = trim($kv[1], "\r\n" . ' ');
  329.                 $line = strtok($separator);
  330.             }
  331.         }
  332.  
  333.         if (!isset($confData['username_id'])) {
  334.             $confData['username_id'] = $c['username_id'];
  335.         }
  336.  
  337.         if (isset($confData['user_agent'])) {
  338.             unset($confData['user_agent']);
  339.         }
  340.  
  341.         if (isset($confData['manufacturer'])) {
  342.             unset($confData['manufacturer']);
  343.         }
  344.  
  345.         if (isset($confData['device'])) {
  346.             unset($confData['device']);
  347.         }
  348.  
  349.         if (isset($confData['model'])) {
  350.             unset($confData['model']);
  351.         }
  352.  
  353.         $cookieData = self::cookieToArray($cookie, $c['isWebCookie'] == 1 ? 'www.instagram.com' : 'i.instagram.com');
  354.         $cookie_all = [];
  355.  
  356.         foreach ($cookieData as $k => $v) {
  357.             $cookie_all[] = $k . '=' . urlencode($v);
  358.  
  359.             if ($k == 'csrftoken') {
  360.                 $confData['token'] = $v;
  361.             }
  362.         }
  363.  
  364.         $v3Data = $confData;
  365.         $v3CookieName = ($c['isWebCookie'] == 1 ? 'web_cookie' : 'cookie');
  366.         $v3Data[$v3CookieName] = implode(';', $cookie_all);
  367.         return json_encode($v3Data);
  368.     }
  369. }
  370.  
  371. class Settings
  372. {
  373.     private $path;
  374.     private $sets;
  375.  
  376.     public function __construct($path)
  377.     {
  378.         $this->path = $path;
  379.         $this->sets = [];
  380.  
  381.         if (file_exists($path)) {
  382.             $sets = json_decode(file_get_contents($path), true);
  383.             $this->sets = (is_array($sets) ? $sets : []);
  384.         }
  385.     }
  386.  
  387.     public function get($key, $default = NULL)
  388.     {
  389.         if ($key == 'sets') {
  390.             return $this->sets;
  391.         }
  392.  
  393.         if (isset($this->sets[$key])) {
  394.             return $this->sets[$key];
  395.         }
  396.  
  397.         return $default;
  398.     }
  399.  
  400.     public function set($key, $value)
  401.     {
  402.         if ($key == 'sets') {
  403.             return NULL;
  404.         }
  405.  
  406.         $this->sets[$key] = $value;
  407.     }
  408.  
  409.     public function save()
  410.     {
  411.         file_put_contents($this->path, json_encode($this->sets));
  412.     }
  413.  
  414.     public function setPath($path)
  415.     {
  416.         $this->path = $path;
  417.     }
  418.  
  419.     public function __set($prop, $value)
  420.     {
  421.         $this->set($prop, $value);
  422.     }
  423.  
  424.     public function __get($prop)
  425.     {
  426.         return $this->get($prop);
  427.     }
  428. }
  429.  
  430. class Constants
  431. {
  432.     const API_URL = 'https://i.instagram.com/api/v1/';
  433.     const API_URLb = 'https://b.i.instagram.com/api/v1/';
  434.     const API_URLV2 = 'https://i.instagram.com/api/v2/';
  435.     const IG_VERSION = '42.0.0.19.95';
  436.     const VERSION_CODE = '104766893';
  437.     const IG_SIG_KEY = 'f372b2a5f14d1bebedaaa4ac6f8d506db30ffdd6185b8e0cdfa7dab42f5a9cc6';
  438.     const EXPERIMENTS = 'ig_android_universe_video_production,ig_search_client_h1_2017_holdout,ig_android_carousel_non_square_creation,ig_android_live_analytics,ig_android_realtime_mqtt_logging,ig_branded_content_show_settings_universe,ig_android_stories_server_coverframe,ig_android_live_dash_predictive_streaming,ig_android_video_captions_universe,ig_business_growth_acquisition_holdout_17h2,ig_android_ontact_invite_universe,ig_android_ad_async_ads_universe,ig_android_shopping_tag_creation_carousel_universe,ig_feed_engagement_holdout_universe,ig_direct_pending_inbox_memcache,ig_promote_guided_budget_duration_options_universe,ig_android_verified_comments_universe,ig_feed_lockdown,android_instagram_prefetch_suggestions_universe,ig_android_gallery_order_by_date_taken,ig_shopping_viewer_intent_actions,ig_android_startup_prefetch,ig_android_business_post_insights_v3_universe,ig_android_custom_story_import_intent,ig_video_copyright_whitelist,ig_explore_holdout_universe,ig_android_device_language_reset,ig_android_videocall_consumption_universe,ig_android_live_fault_tolerance_universe,ig_android_main_feed_seen_state_dont_send_info_on_tail_load,ig_android_face_filter_glyph_nux_animation_universe,ig_android_direct_allow_consecutive_likes,ig_android_livewith_guest_adaptive_camera_universe,ig_android_business_new_ads_payment_universe,ig_android_audience_control,ig_promotion_insights_sticky_tab_universe,ig_android_unified_bindergroup_in_staticandpagedadapter,ig_android_ad_new_viewability_logging_universe,ig_android_ad_impression_backtest,ig_android_log_account_switch_usable,ig_android_mas_viewer_list_megaphone_universe,ig_android_photo_fbupload_universe,ig_android_carousel_drafts,ig_android_bug_report_version_warning,ig_fbns_push,ig_android_carousel_no_buffer_10_30,ig_android_sso_family_key,ig_android_profile_tabs_redesign_universe,ig_android_user_url_deeplink_fbpage_endpoint,ig_android_fix_slow_rendering,ig_android_hide_post_in_feed,ig_android_shopping_thumbnail_icon,ig_android_ad_watchbrowse_universe,ig_android_search_people_tag_universe,ig_android_codec_high_profile,ig_android_long_impression_tracking,ig_android_inline_appeal,ig_android_log_mediacodec_info,ig_android_direct_expiring_media_loading_errors,ig_android_camera_face_filter_api_retry,ig_video_use_sve_universe,ig_android_low_data_mode,ig_android_enable_zero_rating,ig_android_sample_ppr,ig_android_force_logout_user_with_mismatched_cookie,ig_android_smartisan_app_badging,ig_android_direct_expiring_media_fix_duplicate_thread,ig_android_reverse_audio,ig_android_branded_content_three_line_ui_universe,ig_android_comments_impression_logger,ig_android_live_encore_production_universe,ig_promote_independent_ctas_universe,ig_android_http_stack_experiment_2017,ig_android_pending_request_search_bar,ig_android_main_feed_carousel_bumping_animation,ig_android_live_thread_delay_for_mute_universe,ig_android_fb_topsearch_sgp_fork_request,ig_android_heap_uploads,ig_android_stories_archive_universe,ig_android_business_ix_fb_autofill_universe,ig_lockdown_feed_shrink_universe,ig_android_stories_create_flow_favorites_tooltip,ig_android_direct_ephemeral_replies_with_context,ig_android_live_viewer_invite_universe,ig_android_promotion_feedback_channel,ig_profile_holdout_2017_universe,ig_android_executor_null_queue,ig_android_stories_video_loading_spinner_improvements,ig_android_direct_share_intent,ig_android_live_capture_translucent_navigation_bar,ig_stories_camera_blur_drawable,ig_android_stories_drawing_sticker,ig_android_facebook_twitter_profile_photos,ig_android_shopping_tag_creation_universe,ig_android_story_decor_image_fbupload_universe,ig_android_comments_ranking_kill_switch_universe,ig_promote_profile_visit_cta_universe,ig_android_story_reactions,ig_android_ppr_main_feed_enhancements,ig_android_used_jpeg_library,ig_carousel_draft_multiselect,ig_android_stories_close_to_left_head,ig_android_video_delay_auto_start,ig_android_live_with_invite_sheet_search_universe,ig_android_stories_archive_calendar,ig_android_ad_watchbrowse_cta_universe,ig_android_ads_manager_pause_resume_ads_universe,ig_android_main_feed_carousel_bumping,ig_stories_in_feed_unit_design_universe,ig_android_explore_iteminfo_universe_exp,ig_android_me_only_universe,ig_android_live_video_reactions_consumption_universe,ig_android_stories_hashtag_text,ig_android_live_reply_to_comments_universe,ig_android_live_save_to_camera_roll_universe,ig_android_sticker_region_tracking,ig_android_unified_inbox,ig_android_realtime_iris,ig_android_search_client_matching_2,ig_lockdown_notifications_universe,ig_android_feed_seen_state_with_view_info,ig_android_media_rows_prepare_10_31,ig_family_bridges_holdout_universe,ig_android_background_explore_fetch,ig_android_following_follower_social_context,ig_android_live_auto_collapse_comments_view_universe,ig_android_insta_video_consumption_infra,ig_android_ad_watchlead_universe,ig_android_direct_prefetch_direct_story_json,ig_android_cache_logger_10_34,ig_android_stories_weblink_creation,ig_android_histogram_reporter,ig_android_network_cancellation,ig_android_shopping_show_shop_tooltip,ig_android_video_delay_auto_start_threshold,ig_android_comment_category_filter_setting_universe,ig_promote_daily_budget_universe,ig_android_stories_camera_enhancements,ig_android_video_use_new_logging_arch,ig_android_ad_add_per_event_counter_to_logging_event,ig_android_feed_stale_check_interval,ig_android_crop_from_inline_gallery_universe,ig_android_direct_reel_options_entry_point,ig_android_stories_gallery_improvements,ig_android_live_broadcaster_invite_universe,ig_android_inline_photos_of_you_universe,ig_android_prefetch_notification_data,ig_android_direct_full_size_gallery_upload_universe_v2,ig_android_direct_app_deeplinking,ig_promotions_unit_in_insights_landing_page,ig_android_reactive_feed_like_count,ig_android_camera_ff_story_open_tray,ig_android_stories_asset_search,ig_android_constrain_image_size_universe,ig_rn_top_posts_stories_nux_universe,ig_ranking_following,ig_android_camera_retain_face_filter,ig_android_direct_inbox_presence,ig_android_live_skin_smooth,ig_android_stories_posting_offline_ui,ig_android_sidecar_video_upload_universe,ig_android_canvas_swipe_to_open_universe,ig_android_qp_features,android_ig_stories_without_storage_permission_universe2,ig_android_reel_raven_video_segmented_upload_universe,ig_android_swipe_navigation_x_angle_universe,ig_android_invite_xout_universe,ig_android_offline_mode_holdout,ig_android_live_send_user_location,ig_android_live_encore_go_live_button_universe,ig_android_analytics_logger_running_background_universe,ig_android_save_all,ig_android_live_report_watch_time_when_update,ig_android_family_bridge_discover,ig_android_startup_manager,instagram_search_and_coefficient_holdout,ig_android_high_res_upload_2,ig_android_dynamic_background_prefetch,ig_android_http_service_same_thread,ig_android_scroll_to_dismiss_keyboard,ig_android_remove_followers_universe,ig_android_skip_video_render,ig_android_crash_native_core_dumping,ig_android_one_tap_nux_upsell,ig_android_segmentation,ig_profile_holdout_universe,ig_dextricks_module_loading_experiment,ig_android_comments_composer_avatar_universe,ig_android_direct_open_thread_with_expiring_media,ig_android_post_capture_filter,ig_android_rendering_controls,ig_android_os_version_blocking,ig_android_no_prefetch_video_bandwidth_threshold,ig_android_encoder_width_safe_multiple_16,ig_android_warm_like_text,ig_android_request_feed_on_back,ig_comments_team_holdout_universe,ig_android_e2e_optimization_universe,ig_shopping_insights,ig_android_direct_async_message_row_building_universe,ig_android_fb_connect_follow_invite_flow,ig_android_direct_24h_replays,ig_android_video_stitch_after_segmenting_universe,ig_android_instavideo_periodic_notif,ig_android_enable_swipe_to_dismiss_for_all_dialogs,ig_android_stories_camera_support_image_keyboard,ig_android_warm_start_fetch_universe,ig_android_marauder_update_frequency,ig_camera_android_aml_face_tracker_model_version_universe,ig_android_ad_connection_manager_universe,ig_android_ad_watchbrowse_carousel_universe,ig_android_branded_content_edit_flow_universe,ig_android_video_feed_universe,ig_android_upload_reliability_universe,ig_android_direct_mutation_manager_universe,ig_android_ad_show_new_bakeoff,ig_heart_with_keyboad_exposed_universe,ig_android_react_native_universe_kill_switch,ig_android_comments_composer_callout_universe,ig_android_search_hash_tag_and_username_universe,ig_android_live_disable_speed_test_ui_timeout_universe,ig_android_miui_notification_badging,ig_android_qp_kill_switch,ig_android_ad_switch_fragment_logging_v2_universe,ig_android_ad_leadgen_single_screen_universe,ig_android_share_to_whatsapp,ig_android_live_snapshot_universe,ig_branded_content_share_to_facebook,ig_android_react_native_email_sms_settings_universe,ig_android_live_join_comment_ui_change,ig_android_camera_tap_smile_icon_to_selfie_universe,ig_android_feed_surface_universe,ig_android_biz_choose_category,ig_android_prominent_live_button_in_camera_universe,ig_android_video_cover_frame_from_original_as_fallback,ig_android_camera_leak_detector_universe,ig_android_live_hide_countdown_universe,ig_android_story_viewer_linear_preloading_count,ig_android_threaded_comments_universe,ig_android_stories_search_reel_mentions_universe,ig_promote_reach_destinations_universe,ig_android_progressive_jpeg_partial_download,ig_fbns_shared,ig_android_capture_slowmo_mode,ig_android_live_ff_fill_gap,ig_promote_clicks_estimate_universe,ig_android_video_single_surface,ig_android_video_download_logging,ig_android_foreground_location_collection,ig_android_last_edits,ig_android_pending_actions_serialization,ig_android_post_live_viewer_count_privacy_universe,ig_stories_engagement_2017_h2_holdout_universe,ig_android_image_cache_tweak_for_n,ig_android_direct_increased_notification_priority,ig_android_search_top_search_surface_universe,ig_android_live_dash_latency_manager,instagram_interests_holdout,ig_android_user_detail_endpoint,ig_android_videocall_production_universe,ig_android_ad_watchmore_entry_point_universe,ig_android_video_detail,ig_save_insights,ig_camera_android_new_face_effects_api_universe,ig_comments_typing_universe,ig_android_exoplayer_settings,ig_android_progressive_jpeg,ig_android_offline_story_stickers,ig_android_live_webrtc_audience_expansion_universe,ig_explore_android_universe,ig_android_video_prefetch_for_connectivity_type,ig_android_ad_holdout_watchandmore_universe,ig_promote_default_cta,ig_direct_stories_recipient_picker_button,ig_android_direct_notification_lights,ig_android_insights_relay_modern,ig_android_insta_video_abr_resize,ig_android_insta_video_sound_always_on,ig_android_fb_content_provider_anr_fix,ig_android_in_app_notifications_queue,ig_android_live_follow_from_comments_universe,ig_android_comments_new_like_button_position_universe,ig_android_hyperzoom,ig_android_live_broadcast_blacklist,ig_android_camera_perceived_perf_universe,ig_android_search_clear_layout_universe,ig_promote_reachbar_universe,ig_android_ad_one_pixel_logging_for_reel_universe,ig_android_stories_surface_universe,ig_android_stories_highlights_universe,ig_android_reel_viewer_fetch_missing_reels_universe,ig_android_arengine_separate_prepare,ig_android_direct_video_segmented_upload_universe,ig_android_direct_search_share_sheet_universe,ig_android_business_promote_tooltip,ig_android_direct_blue_tab,ig_android_instavideo_remove_nux_comments,ig_android_draw_rainbow_client_universe,ig_android_use_simple_video_player,ig_android_rtc_reshare,ig_android_enable_swipe_to_dismiss_for_favorites_dialogs,ig_android_auto_retry_post_mode,ig_fbns_preload_default,ig_android_emoji_sprite_sheet,ig_android_cover_frame_blacklist,ig_android_gesture_dismiss_reel_viewer,ig_android_gallery_grid_column_count_universe,ig_android_ad_logger_funnel_logging_universe,ig_android_live_encore_consumption_settings_universe,ig_perf_android_holdout,ig_android_list_redesign,ig_android_stories_separate_overlay_creation,ig_android_ad_show_new_interest_survey,ig_android_live_encore_reel_chaining_universe,ig_android_vod_abr_universe,ig_android_audience_profile_icon_badge,ig_android_immersive_viewer,ig_android_analytics_use_a2,ig_android_react_native_universe,ig_android_direct_thread_name_as_notification,ig_android_su_rows_preparer,ig_android_leak_detector_universe,ig_android_video_loopcount_int,ig_android_qp_sticky_exposure_universe,ig_android_enable_main_feed_reel_tray_preloading,ig_android_camera_upsell_dialog,ig_android_live_time_adjustment_universe,ig_android_internal_research_settings,ig_android_prod_lockout_universe,ig_android_react_native_ota,ig_android_main_camera_share_to_direct,ig_android_cold_start_feed_request,ig_android_fb_family_navigation_badging_user,ig_stories_music_sticker,ig_android_send_impression_via_real_time,ig_android_sc_ru_ig,ig_android_animation_perf_reporter_timeout,ig_android_warm_headline_text,ig_android_post_live_expanded_comments_view_universe,ig_android_new_block_flow,ig_android_long_form_video,ig_android_sign_video_url,ig_android_image_task_cancel_logic_fix,ig_android_stories_video_prefetch_kb,ig_android_video_render_prevent_cancellation_feed_universe,ig_android_live_stop_broadcast_on_404,android_face_filter_universe,ig_android_render_iframe_interval,ig_business_claim_page_universe,ig_android_live_move_video_with_keyboard_universe,ig_stories_vertical_list,ig_android_stories_server_brushes,ig_android_live_viewers_canned_comments_universe,ig_android_collections_cache,ig_android_payment_settings_universe,ig_android_live_face_filter,ig_android_canvas_preview_universe,ig_android_screen_recording_bugreport_universe,ig_story_camera_reverse_video_experiment,ig_downloadable_modules_experiment,ig_direct_core_holdout_q4_2017,ig_promote_updated_copy_universe,ig_android_search,ig_android_logging_metric_universe,ig_promote_budget_duration_slider_universe,ig_android_insta_video_consumption_titles,ig_android_video_proxy,ig_android_find_loaded_classes,ig_android_direct_expiring_media_replayable,ig_android_reduce_rect_allocation,ig_android_camera_universe,ig_android_post_live_badge_universe,ig_stories_holdout_h2_2017,ig_android_video_server_coverframe,ig_promote_relay_modern,ig_android_search_users_universe,ig_android_video_controls_universe,ig_creation_growth_holdout,android_segmentation_filter_universe,ig_qp_tooltip,ig_android_live_encore_consumption_universe,ig_android_experimental_filters,ig_android_shopping_profile_shoppable_feed,ig_android_save_collection_pivots,ig_android_business_conversion_value_prop_v2,ig_android_ad_browser_warm_up_improvement_universe,ig_promote_guided_ad_preview_newscreen,ig_android_livewith_universe,ig_android_whatsapp_invite_option,ig_android_video_keep_screen_on,ig_promote_automatic_audience_universe,ig_android_direct_remove_animations,ig_android_live_align_by_2_universe,ig_android_friend_code,ig_android_top_live_profile_pics_universe,ig_android_async_network_tweak_universe_15,ig_android_direct_init_post_launch,ig_android_camera_new_early_show_smile_icon_universe,ig_android_live_go_live_at_viewer_end_screen_universe,ig_android_live_bg_download_face_filter_assets_universe,ig_android_background_reel_fetch,ig_android_insta_video_audio_encoder,ig_android_video_segmented_media_needs_reupload_universe,ig_promote_budget_duration_split_universe,ig_android_upload_prevent_upscale,ig_android_business_ix_universe,ig_android_ad_browser_new_tti_universe,ig_android_self_story_layout,ig_android_business_choose_page_ui_universe,ig_android_camera_face_filter_animation_on_capture,ig_android_rtl,ig_android_comment_inline_expansion_universe,ig_android_live_request_to_join_production_universe,ig_android_share_spinner,ig_android_video_resize_operation,ig_android_stories_eyedropper_color_picker,ig_android_disable_explore_prefetch,ig_android_universe_reel_video_production,ig_android_react_native_push_settings_refactor_universe,ig_android_power_metrics,ig_android_sfplt,ig_android_story_resharing_universe,ig_android_direct_inbox_search,ig_android_direct_share_story_to_facebook,ig_android_exoplayer_creation_flow,ig_android_non_square_first,ig_android_insta_video_drawing,ig_android_swipeablefilters_universe,ig_android_direct_visual_replies_fifty_fifty,ig_android_reel_viewer_data_buffer_size,ig_android_video_segmented_upload_multi_thread_universe,ig_android_react_native_restart_after_error_universe,ig_android_direct_notification_actions,ig_android_profile,ig_android_additional_contact_in_nux,ig_stories_selfie_sticker,ig_android_live_use_rtc_upload_universe,ig_android_story_reactions_producer_holdout,ig_android_stories_reply_composer_redesign,ig_android_story_viewer_segments_bar_universe,ig_explore_netego,ig_android_audience_control_sharecut_universe,ig_android_direct_fix_top_of_thread_scrolling,ig_video_holdout_h2_2017,ig_android_insights_metrics_graph_universe,ig_android_ad_swipe_up_threshold_universe,ig_android_one_tap_send_sheet_universe,ig_android_international_add_payment_flow_universe,ig_android_live_see_fewer_videos_like_this_universe,ig_android_live_view_profile_from_comments_universe,ig_fbns_blocked,ig_android_direct_inbox_suggestions,ig_android_video_segmented_upload_universe,ig_carousel_post_creation_tag_universe,ig_android_mqtt_region_hint_universe,ig_android_suggest_password_reset_on_oneclick_login,ig_android_live_special_codec_size_list,ig_android_continuous_contact_uploading,ig_android_story_viewer_item_duration_universe,ig_promote_budget_duration_client_server_switch,ig_android_enable_share_to_messenger,ig_android_background_main_feed_fetch,promote_media_picker,ig_android_live_video_reactions_creation_universe,ig_android_sidecar_gallery_universe,ig_android_business_id,ig_android_story_import_intent,ig_android_feed_follow_button_redesign,ig_android_section_based_recipient_list_universe,ig_android_insta_video_broadcaster_infra_perf,ig_android_live_webrtc_livewith_params,ig_android_comment_audience_control_group_selection_universe,android_ig_fbns_kill_switch,ig_android_su_card_view_preparer_qe,ig_android_unified_camera_universe,ig_android_all_videoplayback_persisting_sound,ig_android_live_pause_upload,ig_android_branded_content_brand_remove_self,ig_android_direct_search_recipients_controller_universe,ig_android_ad_show_full_name_universe,ig_android_anrwatchdog,ig_android_camera_video_universe,ig_android_2fac,ig_android_audio_segment_report_info,ig_android_scroll_main_feed,ig_direct_bypass_group_size_limit_universe,ig_android_story_captured_media_recovery,ig_android_skywalker_live_event_start_end,ig_android_comment_hint_text_universe,ig_android_direct_search_story_recipients_universe,ig_android_ad_browser_gesture_control,ig_android_grid_cell_count,ig_promote_marketing_funnel_universe,ig_android_immersive_viewer_ufi_footer,ig_android_ad_watchinstall_universe,ig_android_comments_notifications_universe,ig_android_shortcuts,ig_android_new_optic,ig_android_audience_control_nux,favorites_home_inline_adding,ig_android_canvas_tilt_to_pan_universe,ig_internal_ui_for_lazy_loaded_modules_experiment,ig_android_direct_expiring_media_from_notification_behavior_universe,ig_android_fbupload_check_status_code_universe,ig_android_offline_reel_feed,ig_android_stories_viewer_modal_activity,ig_android_shopping_creation_flow_onboarding_entry_point,ig_android_activity_feed_click_state,ig_android_direct_expiring_image_quality_universe,ig_android_gl_drawing_marks_after_undo_backing,ig_android_story_gallery_behavior,ig_android_mark_seen_state_on_viewed_impression,ig_android_configurable_retry,ig_android_live_monotonic_pts,ig_android_live_webrtc_livewith_h264_supported_decoders,ig_story_ptr_timeout,ig_android_comment_tweaks_universe,ig_android_location_media_count_exp_ig,ig_android_image_cache_log_mismatch_fetch,ig_android_personalized_feed_universe,ig_android_direct_double_tap_to_like_messages,ig_android_comment_activity_feed_deeplink_to_comments_universe,ig_android_insights_holdout,ig_android_video_render_prevent_cancellation,ig_android_blue_token_conversion_universe,ig_android_tabbed_hashtags_locations_universe,ig_android_sfplt_tombstone,ig_android_live_with_guest_viewer_list_universe,ig_android_explore_chaining_universe,ig_android_gqls_typing_indicator,ig_android_comment_audience_control_universe,ig_android_direct_show_inbox_loading_banner_universe,ig_android_near_bottom_fetch,ig_promote_guided_creation_flow,ig_ads_increase_connection_step2_v2,ig_android_draw_chalk_client_universe';
  439.     const LOGIN_EXPERIMENTS = 'ig_growth_android_profile_pic_prefill_with_fb_pic_2,ig_android_icon_perf2,ig_android_autosubmit_password_recovery_universe,ig_android_background_voice_phone_confirmation_prefilled_phone_number_only,ig_android_report_nux_completed_device,ig_account_recovery_via_whatsapp_universe,ig_android_stories_reels_tray_media_count_check,ig_android_background_voice_confirmation_block_argentinian_numbers,ig_android_device_verification_fb_signup,ig_android_reg_nux_headers_cleanup_universe,ig_android_reg_omnibox,ig_android_background_voice_phone_confirmation,ig_android_gmail_autocomplete_account_over_one_tap,ig_android_phone_reg_redesign_universe,ig_android_skip_signup_from_one_tap_if_no_fb_sso,ig_android_reg_login_profile_photo_universe,ig_android_access_flow_prefill,ig_android_email_suggestions_universe,ig_android_contact_import_placement_universe,ig_android_ask_for_permissions_on_reg,ig_android_onboarding_skip_fb_connect,ig_account_identity_logged_out_signals_global_holdout_universe,ig_android_hide_fb_connect_for_signup,ig_android_account_switch_infra_universe,ig_restore_focus_on_reg_textbox_universe,ig_android_login_identifier_fuzzy_match,ig_android_suma_biz_account,ig_android_session_scoping_facebook_account,ig_android_security_intent_switchoff,ig_android_do_not_show_back_button_in_nux_user_list,ig_android_aymh_signal_collecting_kill_switch,ig_android_persistent_duplicate_notif_checker,ig_android_multi_tap_login_new,ig_android_nux_add_email_device,ig_android_login_safetynet,ig_android_fci_onboarding_friend_search,ig_android_editable_username_in_reg,ig_android_phone_auto_login_during_reg,ig_android_one_tap_fallback_auto_login,ig_android_device_detection_info_upload,ig_android_updated_copy_user_lookup_failed,ig_fb_invite_entry_points,ig_android_hsite_prefill_new_carrier,ig_android_gmail_oauth_in_reg,ig_two_fac_login_screen,ig_android_reg_modularization_universe,ig_android_passwordless_auth,ig_android_sim_info_upload,ig_android_universe_noticiation_channels,ig_android_realtime_manager_cleanup_universe,ig_android_analytics_accessibility_event,ig_android_direct_main_tab_universe,ig_android_email_one_tap_auto_login_during_reg,ig_android_prefill_full_name_from_fb,ig_android_directapp_camera_open_and_reset_universe,ig_challenge_kill_switch,ig_android_video_bug_report_universe,ig_account_recovery_with_code_android_universe,ig_prioritize_user_input_on_switch_to_signup,ig_android_modularized_nux_universe_device,ig_android_account_recovery_auto_login,ig_android_hide_typeahead_for_logged_users,ig_android_targeted_one_tap_upsell_universe,ig_android_caption_typeahead_fix_on_o_universe,ig_android_crosshare_feed_post,ig_android_retry_create_account_universe,ig_android_abandoned_reg_flow,ig_android_remember_password_at_login,ig_android_smartlock_hints_universe,ig_android_2fac_auto_fill_sms_universe,ig_android_onetaplogin_optimization,ig_type_ahead_recover_account,ig_android_family_apps_user_values_provider_universe,ig_android_direct_inbox_account_switching,ig_android_smart_prefill_killswitch,ig_android_exoplayer_settings,ig_android_bottom_sheet,ig_android_publisher_integration,ig_sem_resurrection_logging,ig_android_login_forgot_password_universe,ig_android_hindi,ig_android_hide_fb_flow_in_add_account_flow,ig_android_dialog_email_reg_error_universe,ig_android_low_priority_notifications_universe,ig_android_device_sms_retriever_plugin_universe,ig_android_device_verification_separate_endpoint';
  440.     const SIG_KEY_VERSION = '4';
  441.     const USER_AGENT_LOCALE = 'tr_TR';
  442.     const ACCEPT_LANGUAGE = 'tr-TR';
  443.     const CONTENT_TYPE = 'application/x-www-form-urlencoded; charset=UTF-8';
  444.     const X_FB_HTTP_Engine = 'Liger';
  445.     const X_IG_Connection_Type = 'WIFI';
  446.     const X_IG_Capabilities = '3brTBw==';
  447.     const FACEBOOK_OTA_FIELDS = 'update%7Bdownload_uri%2Cdownload_uri_delta_base%2Cversion_code_delta_base%2Cdownload_uri_delta%2Cfallback_to_full_update%2Cfile_size_delta%2Cversion_code%2Cpublished_date%2Cfile_size%2Cota_bundle_type%2Cresources_checksum%7D';
  448.     const FACEBOOK_ORCA_PROTOCOL_VERSION = 20150314;
  449.     const FACEBOOK_ORCA_APPLICATION_ID = '124024574287414';
  450.     const FACEBOOK_ANALYTICS_APPLICATION_ID = '567067343352427';
  451.     const PLATFORM = 'android';
  452.     const FBNS_APPLICATION_NAME = 'MQTT';
  453.     const INSTAGRAM_APPLICATION_NAME = 'InstagramForAndroid';
  454.     const PACKAGE_NAME = 'com.instagram.android';
  455.     const SURFACE_PARAM = 4715;
  456.     const WEB_URL = 'https://www.instagram.com/';
  457. }
  458.  
  459. class GoodDevices
  460. {
  461.     const DEVICES = ['24/7.0; 380dpi; 1080x1920; OnePlus; ONEPLUS A3010; OnePlus3T; qcom', '23/6.0.1; 640dpi; 1440x2392; LGE/lge; RS988; h1; h1', '24/7.0; 640dpi; 1440x2560; HUAWEI; LON-L29; HWLON; hi3660', '23/6.0.1; 640dpi; 1440x2560; ZTE; ZTE A2017U; ailsa_ii; qcom', '23/6.0.1; 640dpi; 1440x2560; samsung; SM-G935F; hero2lte; samsungexynos8890', '23/6.0.1; 640dpi; 1440x2560; samsung; SM-G930F; herolte; samsungexynos8890'];
  462.  
  463.     static public function getRandomGoodDevice()
  464.     {
  465.         $randomIdx = array_rand(['24/7.0; 380dpi; 1080x1920; OnePlus; ONEPLUS A3010; OnePlus3T; qcom', '23/6.0.1; 640dpi; 1440x2392; LGE/lge; RS988; h1; h1', '24/7.0; 640dpi; 1440x2560; HUAWEI; LON-L29; HWLON; hi3660', '23/6.0.1; 640dpi; 1440x2560; ZTE; ZTE A2017U; ailsa_ii; qcom', '23/6.0.1; 640dpi; 1440x2560; samsung; SM-G935F; hero2lte; samsungexynos8890', '23/6.0.1; 640dpi; 1440x2560; samsung; SM-G930F; herolte; samsungexynos8890'], 1);
  466.         return ['24/7.0; 380dpi; 1080x1920; OnePlus; ONEPLUS A3010; OnePlus3T; qcom', '23/6.0.1; 640dpi; 1440x2392; LGE/lge; RS988; h1; h1', '24/7.0; 640dpi; 1440x2560; HUAWEI; LON-L29; HWLON; hi3660', '23/6.0.1; 640dpi; 1440x2560; ZTE; ZTE A2017U; ailsa_ii; qcom', '23/6.0.1; 640dpi; 1440x2560; samsung; SM-G935F; hero2lte; samsungexynos8890', '23/6.0.1; 640dpi; 1440x2560; samsung; SM-G930F; herolte; samsungexynos8890'][$randomIdx];
  467.     }
  468. }
  469.  
  470. class Device
  471. {
  472.     const REQUIRED_ANDROID_VERSION = '2.2';
  473.  
  474.     protected $_appVersion;
  475.     protected $_userLocale;
  476.     protected $_deviceString;
  477.     protected $_userAgent;
  478.     protected $_androidVersion;
  479.     protected $_androidRelease;
  480.     protected $_dpi;
  481.     protected $_resolution;
  482.     protected $_manufacturer;
  483.     protected $_brand;
  484.     protected $_model;
  485.     protected $_device;
  486.     protected $_cpu;
  487.  
  488.     public function __construct($appVersion, $userLocale, $deviceString = NULL, $autoFallback = true)
  489.     {
  490.         $this->_appVersion = $appVersion;
  491.         $this->_userLocale = $userLocale;
  492.         if ($autoFallback && !is_string($deviceString)) {
  493.             $deviceString = GoodDevices::getRandomGoodDevice();
  494.         }
  495.  
  496.         $this->_initFromDeviceString($deviceString);
  497.     }
  498.  
  499.     protected function _initFromDeviceString($deviceString)
  500.     {
  501.         if (!is_string($deviceString) || empty($deviceString)) {
  502.             throw new RuntimeException('Device string is empty.');
  503.         }
  504.  
  505.         $parts = explode('; ', $deviceString);
  506.  
  507.         if (count($parts) !== 7) {
  508.             throw new RuntimeException(sprintf('Device string "%s" does not conform to the required device format.', $deviceString));
  509.         }
  510.  
  511.         $androidOS = explode('/', $parts[0], 2);
  512.  
  513.         if (version_compare($androidOS[1], '2.2', '<')) {
  514.             throw new RuntimeException(sprintf('Device string "%s" does not meet the minimum required Android version "%s" for Instagram.', $deviceString, '2.2'));
  515.         }
  516.  
  517.         $manufacturerAndBrand = explode('/', $parts[3], 2);
  518.         $this->_deviceString = $deviceString;
  519.         $this->_androidVersion = $androidOS[0];
  520.         $this->_androidRelease = $androidOS[1];
  521.         $this->_dpi = $parts[1];
  522.         $this->_resolution = $parts[2];
  523.         $this->_manufacturer = $manufacturerAndBrand[0];
  524.         $this->_brand = (isset($manufacturerAndBrand[1]) ? $manufacturerAndBrand[1] : NULL);
  525.         $this->_model = $parts[4];
  526.         $this->_device = $parts[5];
  527.         $this->_cpu = $parts[6];
  528.         $this->_userAgent = UserAgent::buildUserAgent($this->_appVersion, $this->_userLocale, $this);
  529.     }
  530.  
  531.     public function getDeviceString()
  532.     {
  533.         return $this->_deviceString;
  534.     }
  535.  
  536.     public function getUserAgent()
  537.     {
  538.         return $this->_userAgent;
  539.     }
  540.  
  541.     public function getAndroidVersion()
  542.     {
  543.         return $this->_androidVersion;
  544.     }
  545.  
  546.     public function getAndroidRelease()
  547.     {
  548.         return $this->_androidRelease;
  549.     }
  550.  
  551.     public function getDPI()
  552.     {
  553.         return $this->_dpi;
  554.     }
  555.  
  556.     public function getResolution()
  557.     {
  558.         return $this->_resolution;
  559.     }
  560.  
  561.     public function getManufacturer()
  562.     {
  563.         return $this->_manufacturer;
  564.     }
  565.  
  566.     public function getBrand()
  567.     {
  568.         return $this->_brand;
  569.     }
  570.  
  571.     public function getModel()
  572.     {
  573.         return $this->_model;
  574.     }
  575.  
  576.     public function getDevice()
  577.     {
  578.         return $this->_device;
  579.     }
  580.  
  581.     public function getCPU()
  582.     {
  583.         return $this->_cpu;
  584.     }
  585. }
  586.  
  587. class UserAgent
  588. {
  589.     const USER_AGENT_FORMAT = 'Instagram %s Android (%s/%s; %s; %s; %s; %s; %s; %s; %s; 104766893)';
  590.  
  591.     static public function buildUserAgent($appVersion, $userLocale, Device $device)
  592.     {
  593.         if (!($device instanceof Device)) {
  594.             throw new InvalidArgumentException('The device parameter must be a Device class instance.');
  595.         }
  596.  
  597.         $manufacturerWithBrand = $device->getManufacturer();
  598.  
  599.         if ($device->getBrand() !== NULL) {
  600.             $manufacturerWithBrand .= '/' . $device->getBrand();
  601.         }
  602.  
  603.         return sprintf('Instagram %s Android (%s/%s; %s; %s; %s; %s; %s; %s; %s; 104766893)', $appVersion, $device->getAndroidVersion(), $device->getAndroidRelease(), $device->getDPI(), $device->getResolution(), $manufacturerWithBrand, $device->getModel(), $device->getDevice(), $device->getCPU(), $userLocale);
  604.     }
  605. }
  606.  
  607. class ApiService
  608. {
  609.     private $db;
  610.     private $data;
  611.  
  612.     public function __construct()
  613.     {
  614.     }
  615.  
  616.     public function addData($data)
  617.     {
  618.         $this->data = $data;
  619.         $this->db = \Wow\Database\Database::getInstance();
  620.  
  621.         if ($this->data['islemTip'] == 'follow') {
  622.             $this->db->query('INSERT INTO bayi_islem (bayiID,islemTip,userID,userName,imageUrl,krediTotal,krediLeft,excludedInstaIDs,start_count,talepPrice,isApi) VALUES(:bayiID,:islemTip,:userID,:userName,:imageUrl,:krediTotal,:krediLeft,:excludedInstaIDs,:start_count,:talepPrice,:isapi)', ['bayiID' => $this->data['bayiID'], 'islemTip' => $this->data['islemTip'], 'userID' => $this->data['userID'], 'userName' => $this->data['userName'], 'imageUrl' => $this->data['imageUrl'], 'krediTotal' => $this->data['krediTotal'], 'krediLeft' => $this->data['krediLeft'], 'excludedInstaIDs' => $this->data['excludedInstaIDs'], 'start_count' => $this->data['start_count'], 'talepPrice' => $this->data['tutar'], 'isapi' => 1]);
  623.             $orderID = $this->db->lastInsertId();
  624.         }
  625.         else if ($this->data['islemTip'] == 'like') {
  626.             $this->db->query('INSERT INTO bayi_islem (bayiID,islemTip,mediaID,mediaCode,userID,userName,imageUrl,krediTotal,krediLeft, excludedInstaIDs,start_count,talepPrice,isApi) VALUES(:bayiID,:islemTip,:mediaID,:mediaCode,:userID,:userName,:imageUrl,:krediTotal,:krediLeft, :excludedInstaIDs,:start_count,:talepPrice,:isapi)', ['bayiID' => $this->data['bayiID'], 'islemTip' => $this->data['islemTip'], 'mediaID' => $this->data['mediaID'], 'mediaCode' => $this->data['mediaCode'], 'userID' => $this->data['userID'], 'userName' => $this->data['userName'], 'imageUrl' => $this->data['imageUrl'], 'krediTotal' => $this->data['krediTotal'], 'krediLeft' => $this->data['krediLeft'], 'excludedInstaIDs' => $this->data['excludedInstaIDs'], 'start_count' => $this->data['start_count'], 'talepPrice' => $this->data['tutar'], 'isapi' => 1]);
  627.             $orderID = $this->db->lastInsertId();
  628.         }
  629.         else if ($this->data['islemTip'] == 'comment') {
  630.             $this->db->query('INSERT INTO bayi_islem (bayiID,islemTip,mediaID,mediaCode,userID,userName,imageUrl,krediTotal,krediLeft, excludedInstaIDs,allComments,start_count,talepPrice,isApi) VALUES(:bayiID,:islemTip,:mediaID,:mediaCode,:userID,:userName,:imageUrl,:krediTotal,:krediLeft, :excludedInstaIDs,:allComments,:start_count,:talepPrice,:isapi)', ['bayiID' => $this->data['bayiID'], 'islemTip' => $this->data['islemTip'], 'mediaID' => $this->data['mediaID'], 'mediaCode' => $this->data['mediaCode'], 'userID' => $this->data['userID'], 'userName' => $this->data['userName'], 'imageUrl' => $this->data['imageUrl'], 'krediTotal' => $this->data['krediTotal'], 'krediLeft' => $this->data['krediLeft'], 'excludedInstaIDs' => $this->data['excludedInstaIDs'], 'allComments' => $this->data['comments'], 'start_count' => $this->data['start_count'], 'talepPrice' => $this->data['tutar'], 'isapi' => 1]);
  631.             $orderID = $this->db->lastInsertId();
  632.         }
  633.         else if ($this->data['islemTip'] == 'story') {
  634.             $this->db->query('INSERT INTO bayi_islem (bayiID,islemTip,userID,userName,imageUrl,krediTotal,krediLeft,allStories,start_count,talepPrice,isApi) VALUES(:bayiID,:islemTip,:userID,:userName,:imageUrl,:krediTotal,:krediLeft,:allStories,:start_count,:talepPrice,:isapi)', ['bayiID' => $this->data['bayiID'], 'islemTip' => $this->data['islemTip'], 'userID' => $this->data['userID'], 'userName' => $this->data['userName'], 'imageUrl' => $this->data['imageUrl'], 'krediTotal' => $this->data['krediTotal'], 'krediLeft' => $this->data['krediLeft'], 'allStories' => $this->data['allStories'], 'start_count' => $this->data['start_count'], 'talepPrice' => $this->data['tutar'], 'isapi' => 1]);
  635.             $orderID = $this->db->lastInsertId();
  636.         }
  637.         else if ($this->data['islemTip'] == 'videoview') {
  638.             $this->db->query('INSERT INTO bayi_islem (bayiID,islemTip,mediaID,mediaCode,userID,userName,imageUrl,krediTotal,krediLeft,start_count,talepPrice,isApi) VALUES(:bayiID,:islemTip,:mediaID,:mediaCode,:userID,:userName,:imageUrl,:krediTotal,:krediLeft,:start_count,:talepPrice,:isapi)', ['bayiID' => $this->data['bayiID'], 'islemTip' => $this->data['islemTip'], 'mediaID' => $this->data['mediaID'], 'mediaCode' => $this->data['mediaCode'], 'userID' => $this->data['userID'], 'userName' => $this->data['userName'], 'imageUrl' => $this->data['imageUrl'], 'krediTotal' => $this->data['krediTotal'], 'krediLeft' => $this->data['krediLeft'], 'start_count' => $this->data['start_count'], 'talepPrice' => $this->data['tutar'], 'isapi' => 1]);
  639.             $orderID = $this->db->lastInsertId();
  640.         }
  641.         else if ($this->data['islemTip'] == 'save') {
  642.             $this->db->query('INSERT INTO bayi_islem (bayiID,islemTip,mediaID,mediaCode,userID,userName,imageUrl,krediTotal,krediLeft,start_count,talepPrice,isApi) VALUES(:bayiID,:islemTip,:mediaID,:mediaCode,:userID,:userName,:imageUrl,:krediTotal,:krediLeft,:start_count,:talepPrice,:isapi)', ['bayiID' => $this->data['bayiID'], 'islemTip' => $this->data['islemTip'], 'mediaID' => $this->data['mediaID'], 'mediaCode' => $this->data['mediaCode'], 'userID' => $this->data['userID'], 'userName' => $this->data['userName'], 'imageUrl' => $this->data['imageUrl'], 'krediTotal' => $this->data['krediTotal'], 'krediLeft' => $this->data['krediLeft'], 'start_count' => $this->data['start_count'], 'talepPrice' => $this->data['tutar'], 'isapi' => 1]);
  643.             $orderID = $this->db->lastInsertId();
  644.         }
  645.         else if ($this->data['islemTip'] == 'commentlike') {
  646.             $this->db->query('INSERT INTO bayi_islem (bayiID,islemTip,mediaID,likedComment,likedCommentID,userName,krediTotal,krediLeft,talepPrice,isApi) VALUES(:bayiID,:islemTip,:mediaID,:likedComment,:likedCommentID,:userName,:krediTotal,:krediLeft,:talepPrice,:isapi)', ['bayiID' => $this->data['bayiID'], 'islemTip' => $this->data['islemTip'], 'mediaID' => $this->data['media_id'], 'likedComment' => $this->data['likedComment'], 'likedCommentID' => $this->data['likedCommentID'], 'userName' => $this->data['username'], 'krediTotal' => $this->data['krediTotal'], 'krediLeft' => $this->data['krediLeft'], 'talepPrice' => $this->data['tutar'], 'isapi' => 1]);
  647.             $orderID = $this->db->lastInsertId();
  648.         }
  649.         else if ($this->data['islemTip'] == 'canliyayin') {
  650.             $this->db->query('INSERT INTO bayi_islem (bayiID,islemTip,userID,userName,broadcastID,krediTotal,krediLeft,talepPrice,isApi) VALUES(:bayiID,:islemTip,:userID,:userName,:broadcastID,:krediTotal,:krediLeft,:talepPrice,:isapi)', ['bayiID' => $this->data['bayiID'], 'islemTip' => $this->data['islemTip'], 'userID' => $this->data['userID'], 'userName' => $this->data['userName'], 'broadcastID' => $this->data['broadcastID'], 'krediTotal' => $this->data['krediTotal'], 'krediLeft' => $this->data['krediLeft'], 'talepPrice' => $this->data['tutar'], 'isapi' => 1]);
  651.             $orderID = $this->db->lastInsertId();
  652.         }
  653.  
  654.         if (!empty($orderID)) {
  655.             $this->db->query('UPDATE bayi SET bakiye = bakiye - :tutar WHERE bayiID=:bayiID', ['bayiID' => $this->data['bayiID'], 'tutar' => $this->data['tutar']]);
  656.         }
  657.  
  658.         return $orderID;
  659.     }
  660. }
  661.  
  662. class BulkReaction
  663. {
  664.     protected $users = [];
  665.     protected $simultanepostsize;
  666.     protected $IGDataPath;
  667.  
  668.     public function __construct($users, $simultanepostsize = 100)
  669.     {
  670.         if (!is_array($users) || empty($users)) {
  671.             throw new Exception('Invalid user array!');
  672.         }
  673.  
  674.         $this->simultanepostsize = $simultanepostsize;
  675.         $this->IGDataPath = Wow::get('project/cookiePath') . 'instagramv3/';
  676.         $userIndex = 0;
  677.  
  678.         foreach ($users as $user) {
  679.             $this->users[] = ['data' => array_merge($user, ['index' => $userIndex]), 'object' => new Instagram($user['kullaniciAdi'], $user['sifre'], $user['instaID'])];
  680.             $userIndex++;
  681.         }
  682.     }
  683.  
  684.     public function DeviceId()
  685.     {
  686.         return 'E' . rand(0, 9) . 'CD' . rand(0, 9) . '' . rand(0, 9) . '' . rand(0, 9) . '' . rand(0, 9) . '-' . rand(0, 9) . '' . rand(0, 9) . '' . rand(0, 9) . '' . rand(0, 9) . '-' . rand(0, 9) . '' . rand(0, 9) . '' . rand(0, 9) . '' . rand(0, 9) . '-' . rand(0, 9) . 'A' . rand(0, 9) . '' . rand(0, 9) . '-C' . rand(0, 9) . 'F' . rand(0, 9) . '' . rand(0, 9) . 'D' . rand(0, 9) . 'F' . rand(0, 9) . 'AEE';
  687.     }
  688.  
  689.     public function SessionId()
  690.     {
  691.         return 'DC' . rand(0, 9) . '' . rand(0, 9) . '' . rand(0, 9) . '' . rand(0, 9) . '' . rand(0, 9) . 'C-' . rand(0, 9) . '' . rand(0, 9) . 'A' . rand(0, 9) . '-' . rand(0, 9) . 'F' . rand(0, 9) . '' . rand(0, 9) . '-B' . rand(0, 9) . '' . rand(0, 9) . '' . rand(0, 9) . '-' . rand(0, 9) . '' . rand(0, 9) . '' . rand(0, 9) . 'A' . rand(0, 9) . '' . rand(0, 9) . '' . rand(0, 9) . '' . rand(0, 9) . '' . rand(0, 9) . 'FB' . rand(0, 9) . '';
  692.     }
  693.  
  694.     public function izlenme($mediaCode)
  695.     {
  696.         $totalSuccessCount = 0;
  697.         $triedUsers = [];
  698.         $postlar = [];
  699.         $rollingCurl = new \RollingCurl\RollingCurl();
  700.         $DeviceId = $this->DeviceId();
  701.         $SessionId = $this->SessionId();
  702.  
  703.         foreach ($this->users as $user) {
  704.             $headers = ['Connection: keep-alive', 'Proxy-Connection: keep-alive', 'X-IG-Connection-Type: WiFi', 'X-IG-Capabilities: Fw==', 'Accept-Language:tr'];
  705.             $objInstagram = $user['object'];
  706.             $objData = $objInstagram->getData();
  707.             $userAsns = Utils::generateAsns($objData[INSTAWEB_ASNS_KEY]);
  708.             $options = [CURLOPT_USERAGENT => 'Instagram 9.4.0 Android (24/7.0; 380dpi; 1080x1920; OnePlus; ONEPLUS A3010; OnePlus3T; qcom; tr_TR)', CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_VERBOSE => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_ENCODING => '', CURLOPT_COOKIE => $objData['cookie']];
  709.  
  710.             if ($userAsns[0]) {
  711.                 $optionKey = (Wow::get('ayar/proxyStatus') == 4 ? CURLOPT_INTERFACE : CURLOPT_PROXY);
  712.                 $options[$optionKey] = $userAsns[0];
  713.  
  714.                 if ($userAsns[1]) {
  715.                     $optionKey = (Wow::get('ayar/proxyStatus') == 4 ? CURLOPT_IPRESOLVE : CURLOPT_PROXYUSERPWD);
  716.                     $options[$optionKey] = $userAsns[1];
  717.                 }
  718.             }
  719.  
  720.             $rollingCurl->get('https://www.instagram.com/p/' . $mediaCode . '/?__a=1', $headers, $options, $user['data']);
  721.             $rollingCurl->get('https://www.instagram.com/p/' . $mediaCode . '/?__a=1', $headers, $options, $user['data']);
  722.         }
  723.         $rollingCurl->setCallback(function(\RollingCurl\Request $request, \RollingCurl\RollingCurl $rollingCurl) use(&$triedUsers, &$totalSuccessCount, &$logData, &$DeviceId, &$SessionId, &$postlar) {
  724.             $triedUser = ['userID' => $request->identifierParams['uyeID'], 'instaID' => $request->identifierParams['instaID'], 'userNick' => $request->identifierParams['kullaniciAdi'], 'status' => 'na'];
  725.             $postveri = ['post' => ''];
  726.             $isErrored = $request->getResponseError();
  727.  
  728.             if (empty($isErrored)) {
  729.                 $responseInfo = $request->getResponseInfo();
  730.  
  731.                 if ($responseInfo['http_code'] == 200) {
  732.                     $donenSonuc = json_decode($request->getResponseText(), true);
  733.                     if (isset($donenSonuc['graphql']) && ($donenSonuc['graphql']['shortcode_media']['__typename'] == 'GraphVideo')) {
  734.                         $totalSuccessCount++;
  735.                         $triedUser['status'] = 'success';
  736.                         $insta_id = $triedUser['instaID'];
  737.                         $tracking_token = $donenSonuc['graphql']['shortcode_media']['tracking_token'];
  738.                         $Ts = $donenSonuc['graphql']['shortcode_media']['taken_at_timestamp'];
  739.                         $ResimUserId = $donenSonuc['graphql']['shortcode_media']['owner']['id'];
  740.                         $ResimUsername = $donenSonuc['graphql']['shortcode_media']['owner']['username'];
  741.                         $MediaId = '' . $donenSonuc['graphql']['shortcode_media']['id'] . '_' . $insta_id . '';
  742.                         $TimeHack = time() * 86400;
  743.                         $CookieId = $insta_id;
  744.                         $RusMasajYapanlar = "\n" . '{' . "\n" . '"seq":0,' . "\n" . '"app_id":"567067343352427",' . "\n" . '"app_ver":"9.0.1",' . "\n" . '"build_num":"35440032",' . "\n" . '"device_id":"' . $DeviceId . '",' . "\n" . '"session_id":"' . $SessionId . '",' . "\n" . '"uid":"0","data":[' . "\n" . '{"name":"navigation","time":"' . $TimeHack . '.178","module":"profile","extra":{"click_point":"video_thumbnail","nav_depth":2,"grid_index":"10","media_id":"' . $MediaId . '","dest_module":"video_view","seq":4,"nav_time_taken":2,"user_id":"' . $ResimUserId . '","username":"chnknz","pk":"' . $CookieId . '"}},' . "\n" . '{"name":"navigation","time":"' . $TimeHack . '.178","module":"profile","extra":{"click_point":"video_thumbnail","nav_depth":2,"grid_index":"10","media_id":"' . $MediaId . '","dest_module":"video_view","seq":4,"nav_time_taken":2,"user_id":"' . $ResimUserId . '","username":"chnknz","pk":"' . $CookieId . '"}},' . "\n" . '{"name":"instagram_organic_impression","time":"' . $TimeHack . '.201","module":"video_view","extra":{"m_pk":"' . $MediaId . '","a_pk":"' . $ResimUserId . '","m_ts":' . $TimeHack . ',"m_t":2,"tracking_token":"' . $tracking_token . '","source_of_action":"video_view","follow_status":"following","m_ix":0,"pk":"' . $CookieId . '"}},' . "\n" . '{"name":"video_displayed","time":"' . $TimeHack . '.201","module":"video_view","extra":{"m_pk":"' . $MediaId . '","a_pk":"' . $ResimUserId . '","m_ts":' . $TimeHack . ',"tracking_token":"' . $tracking_token . '","follow_status":"following","m_ix":0,"initial":"1","a_i":"organic","pk":"' . $CookieId . '"}},' . "\n" . '{"name":"video_should_start","time":"' . $TimeHack . '.201","module":"video_view","extra":{"m_pk":"' . $MediaId . '","a_pk":"' . $ResimUserId . '","m_ts":1500707308,"tracking_token":"' . $tracking_token . '","follow_status":"following","reason":"start","a_i":"organic","pk":"' . $CookieId . '"}},' . "\n" . '{"name":"video_download_completed","time":"' . $TimeHack . '.568","extra":{"url":"https://scontent-frt3-2.cdninstagram.com/vp/8f4c306c142f5859dc4a6a14d2126f76/5A1C1BCC/t50.2886-16/20248700_1381451691971906_8775822576162177024_n.mp4","bytes_downloaded":644944,"bytes_full_content":644944,"total_request_time_ms":362,"connection_type":"WIFI","pk":"' . $CookieId . '"}},' . "\n" . '{"name":"video_started_playing","time":"' . $TimeHack . '.641","module":"video_view","extra":{"m_pk":"' . $MediaId . '","a_pk":"' . $ResimUserId . '","m_ts":' . $TimeHack . ',"tracking_token":"' . $tracking_token . '","follow_status":"following","m_ix":0,"playing_audio":"0","reason":"autoplay","start_delay":1439,"cached":false,"system_volume":"0.5","streaming":true,"prefetch_size":512,"a_i":"organic","pk":"' . $CookieId . '"}},' . "\n" . '{"name":"video_paused","time":"' . $TimeHack . '.756","module":"video_view","extra":{"m_pk":"' . $MediaId . '","a_pk":"' . $ResimUserId . '","m_ts":' . $TimeHack . ',"tracking_token":"' . $tracking_token . '","follow_status":"following","m_ix":0,"time":5.7330000400543213,"duration":10.355000019073486,"timeAsPercent":1.6971055088702147,"playing_audio":"0","original_start_reason":"autoplay","reason":"fragment_paused","lsp":0.0,"system_volume":"0.5","loop_count":1.6971055269241333,"a_i":"organic","pk":"' . $CookieId . '"}},' . "\n" . '{"name":"instagram_organic_viewed_impression","time":"' . $TimeHack . '.757","module":"video_view","extra":{"m_pk":"' . $MediaId . '","a_pk":"' . $ResimUserId . '","m_ts":' . $TimeHack . ',"m_t":2,"tracking_token":"' . $tracking_token . '","source_of_action":"video_view","follow_status":"following","m_ix":0,"pk":"' . $CookieId . '"}},' . "\n" . '{"name":"instagram_organic_time_spent","time":"' . $TimeHack . '.757","module":"video_view","extra":{"m_pk":"' . $MediaId . '","a_pk":"' . $ResimUserId . '","m_ts":' . $TimeHack . ',"m_t":2,"tracking_token":"' . $tracking_token . '","source_of_action":"video_view","follow_status":"following","m_ix":0,"timespent":10556,"avgViewPercent":1.0,"maxViewPercent":1.0,"pk":"' . $CookieId . '"}},' . "\n" . '{"name":"app_state","time":"' . $TimeHack . '.764","module":"video_view","extra":{"state":"background","pk":"' . $CookieId . '"}},' . "\n" . '{"name":"time_spent_bit_array","time":"' . $TimeHack . '.764","extra":{"tos_id":"hb58md","start_time":' . $TimeHack . ',"tos_array":"[1, 0]","tos_len":16,"tos_seq":1,"tos_cum":5,"pk":"' . $CookieId . '"}},{"name":"video_started_playing","time":"' . $TimeHack . '.780","module":"video_view_profile","extra":{"video_type":"feed","m_pk":"' . $MediaId . '","a_pk":"' . $ResimUserId . '","m_ts":' . $TimeHack . ',"tracking_token":"' . $tracking_token . '","follow_status":"following","m_ix":0,"playing_audio":"0","reason":"autoplay","start_delay":45,"cached":false,"system_volume":"1.0","streaming":true,"prefetch_size":512,"video_width":0,"video_height":0,"is_dash_eligible":1,"playback_format":"dash","a_i":"organic","pk":"' . $CookieId . '","release_channel":"beta","radio_type":"wifi-none"}}],"log_type":"client_event"}';
  745.                         $postveri['post'] = $RusMasajYapanlar;
  746.                     }
  747.                 }
  748.                 else {
  749.                     $triedUser['status'] = 'fail';
  750.                 }
  751.             }
  752.  
  753.             $triedUsers[] = $triedUser;
  754.             $postlar[] = $postveri;
  755.             $rollingCurl->clearCompleted();
  756.             $rollingCurl->prunePendingRequestQueue();
  757.         });
  758.         $rollingCurl->setSimultaneousLimit($this->simultanepostsize);
  759.         $rollingCurl->execute();
  760.  
  761.         foreach ($postlar as $user) {
  762.             $headers = ['Accept: ', 'X-IG-Connection-Type: WiFi', 'X-IG-Capabilities: 36oD', 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8', 'Accept-Language: tr;q=1', 'Connection: keep-alive', 'User-Agent: Instagram 9.0.1 (iPad2,5; iPhone OS 8_3; tr_TR; tr; scale=' . rand(0, 9) . '.' . rand(0, 9) . '' . rand(0, 9) . '; gamut=normal; ' . rand(0, 9) . '' . rand(0, 9) . '' . rand(0, 9) . 'x9' . rand(0, 9) . '' . rand(0, 9) . ') AppleWebKit/' . rand(0, 9) . '' . rand(0, 9) . '' . rand(0, 9) . '+'];
  763.             $options = [CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_VERBOSE => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_ENCODING => ''];
  764.             $post = 'message=' . $user['post'] . '&format=json';
  765.  
  766.             if ($userAsns[0]) {
  767.                 $optionKey = (Wow::get('ayar/proxyStatus') == 4 ? CURLOPT_INTERFACE : CURLOPT_PROXY);
  768.                 $options[$optionKey] = $userAsns[0];
  769.  
  770.                 if ($userAsns[1]) {
  771.                     $optionKey = (Wow::get('ayar/proxyStatus') == 4 ? CURLOPT_IPRESOLVE : CURLOPT_PROXYUSERPWD);
  772.                     $options[$optionKey] = $userAsns[1];
  773.                 }
  774.             }
  775.  
  776.             $rollingCurl->post('https://graph.instagram.com/logging_client_events', $post, $headers, $options, '');
  777.         }
  778.         $rollingCurl->setCallback(function(\RollingCurl\Request $request, \RollingCurl\RollingCurl $rollingCurl) use(&$veriler) {
  779.             $rollingCurl->clearCompleted();
  780.             $rollingCurl->prunePendingRequestQueue();
  781.         });
  782.         $rollingCurl->setSimultaneousLimit($this->simultanepostsize);
  783.         $rollingCurl->execute();
  784.         return ['totalSuccessCount' => intval($totalSuccessCount) / 2, 'users' => $triedUsers];
  785.     }
  786.  
  787.     public function playLive($broadcastID)
  788.     {
  789.         $totalSuccessCount = 0;
  790.         $triedUsers = [];
  791.         $rollingCurl = new \RollingCurl\RollingCurl();
  792.  
  793.         foreach ($this->users as $user) {
  794.             $objInstagram = $user['object'];
  795.             $objData = $objInstagram->getData();
  796.             $requestPosts = ['_uuid' => $objData['uuid'], '_uid' => $objData['username_id'], '_csrftoken' => $objData['token'], 'radio_type' => 'wifi-none'];
  797.             $requestPosts = Signatures::signData($requestPosts);
  798.             $postData = http_build_query(Utils::reorderByHashCode($requestPosts));
  799.             $headers = ['Connection: close', 'Accept: */*', 'X-IG-Capabilities: 3brTBw==', 'X-IG-Connection-Type: WIFI', 'X-IG-Connection-Speed: ' . mt_rand(1000, 3700) . 'kbps', 'X-FB-HTTP-Engine: Liger', 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8', 'Accept-Language: tr-TR'];
  800.             $options = [CURLOPT_USERAGENT => $objData['user_agent'], CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_VERBOSE => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_ENCODING => '', CURLOPT_COOKIE => $objData['cookie']];
  801.             $rollingCurl->post('https://i.instagram.com/api/v1/live/' . $broadcastID . '/heartbeat_and_get_viewer_count/', $postData, $headers, $options, $user['data']);
  802.         }
  803.  
  804.         $rollingCurl->setSimultaneousLimit(500);
  805.         $rollingCurl->execute();
  806.         return ['totalSuccessCount' => $totalSuccessCount, 'users' => $triedUsers];
  807.     }
  808.  
  809.     public function save($mediaID, $mediaCode)
  810.     {
  811.         $totalSuccessCount = 0;
  812.         $triedUsers = [];
  813.         $rollingCurl = new \RollingCurl\RollingCurl();
  814.         $arrMediaID = explode('_', $mediaID);
  815.         $mediaIDBeforer = $arrMediaID[0];
  816.  
  817.         foreach ($this->users as $user) {
  818.             $objInstagram = $user['object'];
  819.             $objData = $objInstagram->getData();
  820.             $userAsns = Utils::generateAsns($objData[INSTAWEB_ASNS_KEY]);
  821.             $requestPosts = ['_uuid' => $objData['uuid'], '_uid' => $objData['username_id'], '_csrftoken' => $objData['token'], 'media_id' => $mediaID];
  822.             $requestPosts = Signatures::signData($requestPosts);
  823.             $postData = http_build_query(Utils::reorderByHashCode($requestPosts));
  824.             $headers = ['Connection: close', 'Accept: */*', 'X-IG-Capabilities: 3brTBw==', 'X-IG-App-ID: 567067343352427', 'X-IG-Connection-Type: WIFI', 'X-IG-Connection-Speed: ' . mt_rand(1000, 3700) . 'kbps', 'X-IG-Bandwidth-Speed-KBPS: -1.000', 'X-IG-Bandwidth-TotalBytes-B: 0', 'X-IG-Bandwidth-TotalTime-MS: 0', 'X-FB-HTTP-Engine: Liger', 'Accept-Language: tr-TR'];
  825.             $options = [CURLOPT_USERAGENT => $objData['user_agent'], CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_VERBOSE => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_ENCODING => '', CURLOPT_COOKIE => $objData['cookie']];
  826.  
  827.             if ($userAsns[0]) {
  828.                 $optionKey = (Wow::get('ayar/proxyStatus') == 4 ? CURLOPT_INTERFACE : CURLOPT_PROXY);
  829.                 $options[$optionKey] = $userAsns[0];
  830.  
  831.                 if ($userAsns[1]) {
  832.                     $optionKey = (Wow::get('ayar/proxyStatus') == 4 ? CURLOPT_IPRESOLVE : CURLOPT_PROXYUSERPWD);
  833.                     $options[$optionKey] = $userAsns[1];
  834.                 }
  835.             }
  836.  
  837.             $rollingCurl->post('https://i.instagram.com/api/v1/media/' . $mediaID . '/save/', $postData, $headers, $options, $user['data']);
  838.         }
  839.         $rollingCurl->setCallback(function(\RollingCurl\Request $request, \RollingCurl\RollingCurl $rollingCurl) use(&$triedUsers, &$totalSuccessCount, &$logData) {
  840.             $triedUser = ['userID' => $request->identifierParams['uyeID'], 'instaID' => $request->identifierParams['instaID'], 'userNick' => $request->identifierParams['kullaniciAdi'], 'status' => 'na'];
  841.             $isErrored = $request->getResponseError();
  842.  
  843.             if (empty($isErrored)) {
  844.                 $responseInfo = $request->getResponseInfo();
  845.  
  846.                 if ($responseInfo['http_code'] == 200) {
  847.                     $donenSonuc = json_decode($request->getResponseText(), true);
  848.  
  849.                     if ($donenSonuc) {
  850.                         if (strpos($request->getResponseHeaders(), 'Set-Cookie') !== false) {
  851.                             $obj = $this->users[$request->identifierParams['index']]['object'];
  852.                             $obj->organizeCookies($request->getResponseHeaders());
  853.                         }
  854.  
  855.                         if ($request->identifierParams['isWebCookie'] == 1) {
  856.                             if ($donenSonuc['status'] == 'ok') {
  857.                                 $totalSuccessCount++;
  858.                                 $triedUser['status'] = 'success';
  859.                             }
  860.                             else {
  861.                                 $triedUser['status'] = 'fail';
  862.                             }
  863.                         }
  864.                         else if ($donenSonuc['status'] == 'ok') {
  865.                             $totalSuccessCount++;
  866.                             $triedUser['status'] = 'success';
  867.                         }
  868.                         else {
  869.                             $triedUser['status'] = 'fail';
  870.                         }
  871.                     }
  872.  
  873.                     $triedUser['info'] = $donenSonuc;
  874.                     $triedUser['total'] = $totalSuccessCount;
  875.                 }
  876.                 else {
  877.                     $triedUser['status'] = 'fail';
  878.                 }
  879.             }
  880.  
  881.             $triedUsers[] = $triedUser;
  882.             $rollingCurl->clearCompleted();
  883.             $rollingCurl->prunePendingRequestQueue();
  884.         });
  885.         $rollingCurl->setSimultaneousLimit($this->simultanepostsize);
  886.         $rollingCurl->execute();
  887.         return ['totalSuccessCount' => $totalSuccessCount, 'users' => $triedUsers];
  888.     }
  889.  
  890.     public function like($mediaID, $mediaUsername, $mediaUserID)
  891.     {
  892.         $totalSuccessCount = 0;
  893.         $triedUsers = [];
  894.         $rollingCurl = new \RollingCurl\RollingCurl();
  895.  
  896.         foreach ($this->users as $user) {
  897.             $objInstagram = $user['object'];
  898.             $objData = $objInstagram->getData();
  899.             $userAsns = Utils::generateAsns($objData[INSTAWEB_ASNS_KEY]);
  900.             $objInstagram->getLoginTimelineFeed();
  901.             $requestPosts = ['module_name' => 'profile', 'media_id' => $mediaID, '_csrftoken' => $objData['token'], 'username' => $mediaUsername, 'user_id' => $mediaUserID, 'radio_type' => 'wifi-none', '_uid' => $objData['username_id'], '_uuid' => $objData['uuid'], 'd' => 0];
  902.             $requestPosts = Signatures::signData($requestPosts, ['d']);
  903.             $postData = http_build_query(Utils::reorderByHashCode($requestPosts));
  904.             $headers = ['Connection: close', 'Accept: */*', 'X-IG-Capabilities: 3brTBw==', 'X-IG-App-ID: 567067343352427', 'X-IG-Connection-Type: WIFI', 'X-IG-Connection-Speed: ' . mt_rand(1000, 3700) . 'kbps', 'X-IG-Bandwidth-Speed-KBPS: 514.297', 'X-IG-Bandwidth-TotalBytes-B: 15502891', 'X-IG-Bandwidth-TotalTime-MS: 25064', 'X-IG-ABR-Connection-Speed-KBPS: 162', 'X-FB-HTTP-Engine: Liger', 'Accept-Language: tr-TR'];
  905.             $options = [CURLOPT_USERAGENT => $objData['user_agent'], CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_VERBOSE => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_ENCODING => '', CURLOPT_COOKIE => $objData['cookie']];
  906.  
  907.             if ($userAsns[0]) {
  908.                 $optionKey = (Wow::get('ayar/proxyStatus') == 4 ? CURLOPT_INTERFACE : CURLOPT_PROXY);
  909.                 $options[$optionKey] = $userAsns[0];
  910.  
  911.                 if ($userAsns[1]) {
  912.                     $optionKey = (Wow::get('ayar/proxyStatus') == 4 ? CURLOPT_IPRESOLVE : CURLOPT_PROXYUSERPWD);
  913.                     $options[$optionKey] = $userAsns[1];
  914.                 }
  915.             }
  916.  
  917.             $rollingCurl->post('https://i.instagram.com/api/v1/media/' . $mediaID . '/like/', $postData, $headers, $options, $user['data']);
  918.             $rollingCurl->get('https://i.instagram.com/api/v1/users/' . $mediaUsername . '/usernameinfo/', $headers, $options, $user['data']);
  919.         }
  920.         $rollingCurl->setCallback(function(\RollingCurl\Request $request, \RollingCurl\RollingCurl $rollingCurl) use(&$triedUsers, &$totalSuccessCount, &$logData) {
  921.             $triedUser = ['userID' => $request->identifierParams['uyeID'], 'instaID' => $request->identifierParams['instaID'], 'userNick' => $request->identifierParams['kullaniciAdi'], 'status' => 'na'];
  922.             $isErrored = $request->getResponseError();
  923.             if (empty($isErrored) && stristr($request->getUrl(), '/like/')) {
  924.                 $responseInfo = $request->getResponseInfo();
  925.  
  926.                 if ($responseInfo['http_code'] == 200) {
  927.                     $donenSonuc = json_decode($request->getResponseText(), true);
  928.  
  929.                     if ($donenSonuc) {
  930.                         if (strpos($request->getResponseHeaders(), 'Set-Cookie') !== false) {
  931.                             $obj = $this->users[$request->identifierParams['index']]['object'];
  932.                             $obj->organizeCookies($request->getResponseHeaders());
  933.                         }
  934.  
  935.                         if ($donenSonuc['status'] == 'ok') {
  936.                             $totalSuccessCount++;
  937.                             $triedUser['status'] = 'success';
  938.                         }
  939.                         else {
  940.                             $triedUser['status'] = 'fail';
  941.                         }
  942.                     }
  943.  
  944.                     $triedUser['info'] = $donenSonuc;
  945.                 }
  946.                 else {
  947.                     $triedUser['status'] = 'fail';
  948.                     $triedUser['info'] = $responseInfo;
  949.                     $triedUser['text'] = $request->getResponseText();
  950.                     $kontrol = json_decode($request->getResponseText(), true);
  951.                     if (($kontrol['message'] == 'login_required') || ($kontrol['message'] == 'challenge_required')) {
  952.                         $triedUser['durum'] = 0;
  953.                     }
  954.                 }
  955.             }
  956.  
  957.             $triedUsers[] = $triedUser;
  958.             $rollingCurl->clearCompleted();
  959.             $rollingCurl->prunePendingRequestQueue();
  960.         });
  961.         $rollingCurl->setSimultaneousLimit($this->simultanepostsize);
  962.         $rollingCurl->execute();
  963.         return ['totalSuccessCount' => $totalSuccessCount, 'users' => $triedUsers];
  964.     }
  965.  
  966.     public function commentlike($mediaID, $commentID)
  967.     {
  968.         $totalSuccessCount = 0;
  969.         $triedUsers = [];
  970.         $rollingCurl = new \RollingCurl\RollingCurl();
  971.         $arrMediaID = explode('_', $mediaID);
  972.         $mediaIDBeforer = $arrMediaID[0];
  973.  
  974.         foreach ($this->users as $user) {
  975.             $objInstagram = $user['object'];
  976.             $objData = $objInstagram->getData();
  977.             $userAsns = Utils::generateAsns($objData[INSTAWEB_ASNS_KEY]);
  978.             $requestPosts = ['_uuid' => $objData['uuid'], '_uid' => $objData['username_id'], '_csrftoken' => $objData['token'], 'media_id' => $mediaIDBeforer];
  979.             $requestPosts = Signatures::signData($requestPosts);
  980.             $postData = http_build_query(Utils::reorderByHashCode($requestPosts));
  981.             $headers = ['Connection: close', 'Accept: */*', 'X-IG-Capabilities: 3brTBw==', 'X-IG-App-ID: 567067343352427', 'X-IG-Connection-Type: WIFI', 'X-IG-Connection-Speed: ' . mt_rand(1000, 3700) . 'kbps', 'X-IG-Bandwidth-Speed-KBPS: -1.000', 'X-IG-Bandwidth-TotalBytes-B: 0', 'X-IG-Bandwidth-TotalTime-MS: 0', 'X-IG-ABR-Connection-Speed-KBPS: 162', 'X-FB-HTTP-Engine: Liger', 'Accept-Language: tr-TR'];
  982.             $options = [CURLOPT_USERAGENT => $objData['user_agent'], CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_VERBOSE => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_ENCODING => '', CURLOPT_COOKIE => $objData['cookie']];
  983.  
  984.             if ($userAsns[0]) {
  985.                 $optionKey = (Wow::get('ayar/proxyStatus') == 4 ? CURLOPT_INTERFACE : CURLOPT_PROXY);
  986.                 $options[$optionKey] = $userAsns[0];
  987.  
  988.                 if ($userAsns[1]) {
  989.                     $optionKey = (Wow::get('ayar/proxyStatus') == 4 ? CURLOPT_IPRESOLVE : CURLOPT_PROXYUSERPWD);
  990.                     $options[$optionKey] = $userAsns[1];
  991.                 }
  992.             }
  993.  
  994.             $rollingCurl->post('https://i.instagram.com/api/v1/media/' . $commentID . '/comment_like/', $postData, $headers, $options, $user['data']);
  995.         }
  996.         $rollingCurl->setCallback(function(\RollingCurl\Request $request, \RollingCurl\RollingCurl $rollingCurl) use(&$triedUsers, &$totalSuccessCount, &$logData) {
  997.             $triedUser = ['userID' => $request->identifierParams['uyeID'], 'instaID' => $request->identifierParams['instaID'], 'userNick' => $request->identifierParams['kullaniciAdi'], 'status' => 'na'];
  998.             $isErrored = $request->getResponseError();
  999.  
  1000.             if (empty($isErrored)) {
  1001.                 $responseInfo = $request->getResponseInfo();
  1002.  
  1003.                 if ($responseInfo['http_code'] == 200) {
  1004.                     $donenSonuc = json_decode($request->getResponseText(), true);
  1005.  
  1006.                     if ($donenSonuc) {
  1007.                         if (strpos($request->getResponseHeaders(), 'Set-Cookie') !== false) {
  1008.                             $obj = $this->users[$request->identifierParams['index']]['object'];
  1009.                             $obj->organizeCookies($request->getResponseHeaders());
  1010.                         }
  1011.  
  1012.                         if ($donenSonuc['status'] == 'ok') {
  1013.                             $totalSuccessCount++;
  1014.                             $triedUser['status'] = 'success';
  1015.                         }
  1016.                         else {
  1017.                             $triedUser['status'] = 'fail';
  1018.                             $triedUser['info'] = $donenSonuc;
  1019.                         }
  1020.                     }
  1021.                 }
  1022.                 else {
  1023.                     $triedUser['status'] = 'fail';
  1024.                     $triedUser['info'] = $responseInfo;
  1025.                 }
  1026.             }
  1027.  
  1028.             $triedUsers[] = $triedUser;
  1029.             $rollingCurl->clearCompleted();
  1030.             $rollingCurl->prunePendingRequestQueue();
  1031.         });
  1032.         $rollingCurl->setSimultaneousLimit($this->simultanepostsize);
  1033.         $rollingCurl->execute();
  1034.         return ['totalSuccessCount' => $totalSuccessCount, 'users' => $triedUsers];
  1035.     }
  1036.  
  1037.     public function storyview($items, $sourceId = NULL)
  1038.     {
  1039.         $reels = [];
  1040.         $maxSeenAt = time();
  1041.         $seenAt = $maxSeenAt - (3 * count($items));
  1042.  
  1043.         foreach ($items as $item) {
  1044.             $itemTakenAt = $item['getTakenAt'];
  1045.  
  1046.             if ($seenAt < $itemTakenAt) {
  1047.                 $seenAt = $itemTakenAt + 2;
  1048.             }
  1049.  
  1050.             if ($maxSeenAt < $seenAt) {
  1051.                 $seenAt = $maxSeenAt;
  1052.             }
  1053.  
  1054.             $reelId = $item['itemID'] . '_' . $item['userPK'];
  1055.             $reels[$reelId] = [$itemTakenAt . '_' . $seenAt];
  1056.             $seenAt += rand(1, 3);
  1057.         }
  1058.  
  1059.         $totalSuccessCount = 0;
  1060.         $triedUsers = [];
  1061.         $rollingCurl = new \RollingCurl\RollingCurl();
  1062.  
  1063.         foreach ($this->users as $user) {
  1064.             $objInstagram = $user['object'];
  1065.             $objData = $objInstagram->getData();
  1066.             $userAsns = Utils::generateAsns($objData[INSTAWEB_ASNS_KEY]);
  1067.             $requestPosts = [
  1068.                 '_uuid'      => $objData['uuid'],
  1069.                 '_uid'       => $objData['username_id'],
  1070.                 '_csrftoken' => $objData['token'],
  1071.                 'reels'      => $reels,
  1072.                 'live_vods'  => [],
  1073.                 'reel'       => 1,
  1074.                 'live_vod'   => 0
  1075.             ];
  1076.             $requestPosts = Signatures::signData($requestPosts);
  1077.             $postData = http_build_query(Utils::reorderByHashCode($requestPosts));
  1078.             $headers = ['Connection: close', 'Accept: */*', 'X-IG-Capabilities: 3brTBw==', 'X-IG-App-ID: 567067343352427', 'X-IG-Connection-Type: WIFI', 'X-IG-Connection-Speed: ' . mt_rand(1000, 3700) . 'kbps', 'X-IG-Bandwidth-Speed-KBPS: -1.000', 'X-IG-Bandwidth-TotalBytes-B: 0', 'X-IG-Bandwidth-TotalTime-MS: 0', 'X-FB-HTTP-Engine: Liger', 'Accept-Language: tr-TR'];
  1079.             $options = [CURLOPT_USERAGENT => $objData['user_agent'], CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_VERBOSE => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_ENCODING => '', CURLOPT_COOKIE => $objData['cookie']];
  1080.  
  1081.             if ($userAsns[0]) {
  1082.                 $optionKey = (Wow::get('ayar/proxyStatus') == 4 ? CURLOPT_INTERFACE : CURLOPT_PROXY);
  1083.                 $options[$optionKey] = $userAsns[0];
  1084.  
  1085.                 if ($userAsns[1]) {
  1086.                     $optionKey = (Wow::get('ayar/proxyStatus') == 4 ? CURLOPT_IPRESOLVE : CURLOPT_PROXYUSERPWD);
  1087.                     $options[$optionKey] = $userAsns[1];
  1088.                 }
  1089.             }
  1090.  
  1091.             $rollingCurl->post('https://i.instagram.com/api/v2/media/seen/', $postData, $headers, $options, $user['data']);
  1092.         }
  1093.         $rollingCurl->setCallback(function(\RollingCurl\Request $request, \RollingCurl\RollingCurl $rollingCurl) use(&$triedUsers, &$totalSuccessCount, &$logData) {
  1094.             $triedUser = ['userID' => $request->identifierParams['uyeID'], 'instaID' => $request->identifierParams['instaID'], 'userNick' => $request->identifierParams['kullaniciAdi'], 'status' => 'na'];
  1095.             $isErrored = $request->getResponseError();
  1096.  
  1097.             if (empty($isErrored)) {
  1098.                 $responseInfo = $request->getResponseInfo();
  1099.  
  1100.                 if ($responseInfo['http_code'] == 200) {
  1101.                     $donenSonuc = json_decode($request->getResponseText(), true);
  1102.  
  1103.                     if ($donenSonuc) {
  1104.                         if (strpos($request->getResponseHeaders(), 'Set-Cookie') !== false) {
  1105.                             $obj = $this->users[$request->identifierParams['index']]['object'];
  1106.                             $obj->organizeCookies($request->getResponseHeaders());
  1107.                         }
  1108.  
  1109.                         if ($request->identifierParams['isWebCookie'] == 1) {
  1110.                             if ($donenSonuc['status'] == 'ok') {
  1111.                                 $totalSuccessCount++;
  1112.                                 $triedUser['status'] = 'success';
  1113.                             }
  1114.                             else {
  1115.                                 $triedUser['status'] = 'fail';
  1116.                             }
  1117.                         }
  1118.                         else if ($donenSonuc['status'] == 'ok') {
  1119.                             $totalSuccessCount++;
  1120.                             $triedUser['status'] = 'success';
  1121.                         }
  1122.                         else {
  1123.                             $triedUser['status'] = 'fail';
  1124.                         }
  1125.                     }
  1126.                 }
  1127.                 else {
  1128.                     $triedUser['status'] = 'fail';
  1129.                 }
  1130.             }
  1131.  
  1132.             $triedUsers[] = $triedUser;
  1133. ...................................................................
  1134. ......................................
  1135. ............
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