Advertisement
JakRapp

Bot Like Feed Instagram

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