Advertisement
RafiVadra

Untitled

Dec 16th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.65 KB | None | 0 0
  1. <?php
  2. set_time_limit(0);
  3. ignore_user_abort(1);
  4. $usernameig = "..."; //Ganti ... Dengan Username ig mu
  5. $passwordig = "..."; //Ganti ... Dengan Password ig mu
  6.     function proccess($ighost, $useragent, $url, $cookie = 0, $data = 0, $httpheader = array(), $proxy = 0){
  7.     $url = $ighost ? 'https://i.instagram.com/api/v1/' . $url : $url;
  8.     $ch = curl_init($url);
  9.     curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
  10.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  11.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  12.     curl_setopt($ch, CURLOPT_TIMEOUT, 20);
  13.     if($proxy):
  14.       curl_setopt($ch, CURLOPT_PROXY, $proxy);
  15.     endif;
  16.     if($httpheader) curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
  17.     curl_setopt($ch, CURLOPT_HEADER, 1);
  18.     if($cookie) curl_setopt($ch, CURLOPT_COOKIE, $cookie);
  19.     if ($data):
  20.       curl_setopt($ch, CURLOPT_POST, 1);
  21.       curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  22.     endif;
  23.     $response = curl_exec($ch);
  24.     $httpcode = curl_getinfo($ch);
  25.     if(!$httpcode) return false; else{
  26.       $header = substr($response, 0, curl_getinfo($ch, CURLINFO_HEADER_SIZE));
  27.       $body = substr($response, curl_getinfo($ch, CURLINFO_HEADER_SIZE));
  28.       curl_close($ch);
  29.       return array($header, $body);
  30.     }
  31.   }
  32.  
  33.  
  34. function SendRequest($url, $post, $post_data, $user_agent, $cookies) {
  35.     $ch = curl_init();
  36.   curl_setopt($ch, CURLOPT_URL, 'https://instagram.com/api/v1/'.$url);
  37.   curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
  38.   curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  39.   curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept-Language: id'));
  40.  
  41.   if($post) {
  42.     curl_setopt($ch, CURLOPT_POST, true);
  43.     curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
  44.   }
  45.    
  46.   if($cookies) {
  47.     curl_setopt($ch, CURLOPT_COOKIEFILE, 'likefeed.txt');
  48.   } else {
  49.     curl_setopt($ch, CURLOPT_COOKIEJAR, 'likefeed.txt');
  50.   }
  51.    
  52.   $response = curl_exec($ch);
  53.   $http = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  54.   curl_close($ch);
  55.    
  56.   return array($http, $response);
  57. }
  58.  
  59. function GenerateGuid() {
  60.   return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
  61.       mt_rand(0, 65535),
  62.       mt_rand(0, 65535),
  63.       mt_rand(0, 65535),
  64.       mt_rand(16384, 20479),
  65.       mt_rand(32768, 49151),
  66.       mt_rand(0, 65535),
  67.       mt_rand(0, 65535),
  68.       mt_rand(0, 65535));
  69. }
  70.  
  71.   function generate_useragent($sign_version = '6.22.0'){
  72.     $resolusi = array('1080x1776','1080x1920','720x1280', '320x480', '480x800', '1024x768', '1280x720', '768x1024', '480x320');
  73.     $versi = array('GT-N7000', 'SM-N9000', 'GT-I9220', 'GT-I9100');   $dpi = array('120', '160', '320', '240');
  74.     $ver = $versi[array_rand($versi)];
  75.     return 'Instagram '.$sign_version.' Android ('.mt_rand(10,11).'/'.mt_rand(1,3).'.'.mt_rand(3,5).'.'.mt_rand(0,5).'; '.$dpi[array_rand($dpi)].'; '.$resolusi[array_rand($resolusi)].'; samsung; '.$ver.'; '.$ver.'; smdkc210; en_US)';
  76.   }
  77.  
  78. function GenerateSignature($data) {
  79.      return hash_hmac('sha256', $data, '55e91155636eaa89ba5ed619eb4645a4daf1103f2161dbfe6fd94d5ea7716095');
  80. }
  81.  
  82. function GetPostData_profil($filename) {
  83.   if(!$filename) {
  84.     echo "The image doesn't exist ".$filename;
  85.   } else {
  86.     $post_data = array('profile_pic' => '@'.$filename);
  87.     return $post_data;
  88.   }
  89. }
  90.  
  91. function GetPostData($filename) {
  92.   if(!$filename) {
  93.     echo "The image doesn't exist ".$filename;
  94.   } else {
  95.     $post_data = array('device_timestamp' => time(),
  96.               'photo' => '@'.$filename);
  97.     return $post_data;
  98.   }
  99. }
  100. function hook($data) {
  101.     return 'ig_sig_key_version=4&signed_body=' . hash_hmac('sha256', $data, '469862b7e45f078550a0db3687f51ef03005573121a3a7e8d7f43eddb3584a36') . '.' . urlencode($data);
  102.   }
  103.   function generate_device_id(){
  104.     return 'android-' . md5(rand(1000, 9999)).rand(2, 9);
  105.   }
  106.   function generate_guid($tipe = 0){
  107.     $guid = sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
  108.     mt_rand(0, 65535),
  109.     mt_rand(0, 65535),
  110.     mt_rand(0, 65535),
  111.     mt_rand(16384, 20479),
  112.     mt_rand(32768, 49151),
  113.     mt_rand(0, 65535),
  114.     mt_rand(0, 65535),
  115.     mt_rand(0, 65535));
  116.     return $tipe ? $guid : str_replace('-', '', $guid);
  117.   }
  118. $guid = GenerateGuid();
  119. $device_id = "android-".$guid;
  120.     $ua = generate_useragent();
  121.         $devid = generate_device_id();
  122.         $login = proccess(1, $ua, 'accounts/login/', 0, hook('{"device_id":"'.$devid.'","guid":"'.generate_guid().'","username":"'.$usernameig.'","password":"'.$passwordig.'","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}'));
  123.         $data = json_decode($login[1]);
  124.         if($data->status != 'ok')
  125.             print ' <html>
  126.        <body>
  127.        <center>Username / Password Instagrammu salah</center>';
  128.         else{
  129.             preg_match_all('%Set-Cookie: (.*?);%',$login[0],$d);$cookie = '';
  130.             for($o=0;$o<count($d[0]);$o++)$cookie.=$d[1][$o].";";
  131.             $_SESSION['data'] = array('cookies' => $cookie, 'useragent' => $ua, 'device_id' => $devid, 'username' => $data->logged_in_user->username, 'id' => $data->logged_in_user->pk);
  132.     //Beres
  133. //INi Fungsi Asli
  134. $ui = $_SESSION['data'];
  135. $rank_token = $ui['id'].'_'.$guid ;
  136. $isi_komen = $_POST['komen'];
  137. $req = proccess(1, $ui['useragent'], 'feed/timeline/?rank_token='.$rank_token.'&ranked_content=true&max_id=0', $ui['cookies']);
  138. $req = json_decode($req[1]);
  139. foreach ($req->items as $items) {
  140.     $mau_ngelike = $items->has_liked;
  141.     $ID = $items->id;
  142.     if($mau_ngelike != '1') {
  143.         $user = " @". $items->user->username;
  144.         $like = proccess(1, $ui['useragent'], 'media/'.$ID.'/like/', $ui['cookies'], hook('{"media_id":"'.$ID.'"}'));
  145.              sleep(2);
  146.     }
  147.     flush();
  148.     ob_flush();
  149. }
  150. }
  151.     ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement