Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2017
1,288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.75 KB | None | 0 0
  1. <?php
  2. $username = "bagilikeinfo"; // disini untuk username instagram anda
  3. $password = "maqlojeprut0091"; // disini untuk PASSWORD instagram anda
  4.  
  5. // JANGAN GANTI DI BAWAH INI!
  6. function request($ighost, $useragent, $url, $cookie = 0, $data = 0, $httpheader = array(), $proxy = 0, $userpwd = 0, $is_socks5 = 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_FOLLOWLOCATION, 1);
  13. curl_setopt($ch, CURLOPT_TIMEOUT, 20);
  14. if($proxy) curl_setopt($ch, CURLOPT_PROXY, $proxy);
  15. if($userpwd) curl_setopt($ch, CURLOPT_PROXYUSERPWD, $userpwd);
  16. if($is_socks5) curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
  17. if($httpheader) curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
  18. curl_setopt($ch, CURLOPT_HEADER, 1);
  19. if($cookie) curl_setopt($ch, CURLOPT_COOKIE, $cookie);
  20. if ($data):
  21. curl_setopt($ch, CURLOPT_POST, 1);
  22. curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  23. endif;
  24. $response = curl_exec($ch);
  25. $httpcode = curl_getinfo($ch);
  26. if(!$httpcode) return false; else{
  27. $header = substr($response, 0, curl_getinfo($ch, CURLINFO_HEADER_SIZE));
  28. $body = substr($response, curl_getinfo($ch, CURLINFO_HEADER_SIZE));
  29. curl_close($ch);
  30. return array($header, $body);
  31. }
  32. }
  33. function generateDeviceId($seed){
  34. $volatile_seed = filemtime(__DIR__);
  35. return 'android-'.substr(md5($seed.$volatile_seed), 16);
  36. }
  37. function generateSignature($data){
  38. $hash = hash_hmac('sha256', $data, '68a04945eb02970e2e8d15266fc256f7295da123e123f44b88f09d594a5902df');
  39. return 'ig_sig_key_version=4&signed_body='.$hash.'.'.urlencode($data);
  40. }
  41. function generate_useragent($sign_version = '10.8.0'){
  42. $resolusi = array('1080x1776','1080x1920','720x1280', '320x480', '480x800', '1024x768', '1280x720', '768x1024', '480x320');
  43. $versi = array('GT-N7000', 'SM-N9000', 'GT-I9220', 'GT-I9100');
  44. $dpi = array('120', '160', '320', '240');
  45. $ver = $versi[array_rand($versi)];
  46. 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)';
  47. }
  48. function get_csrftoken(){
  49. $fetch = request('si/fetch_headers/', null, null);
  50. $header = $fetch[0];
  51. if (!preg_match('#Set-Cookie: csrftoken=([^;]+)#', $fetch[0], $token)) {
  52. return json_encode(array('result' => false, 'content' => 'Missing csrftoken'));
  53. } else {
  54. return substr($token[0], 22);
  55. }
  56. }
  57. function generateUUID($type){
  58. $uuid = sprintf(
  59. '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
  60. mt_rand(0, 0xffff),
  61. mt_rand(0, 0xffff),
  62. mt_rand(0, 0xffff),
  63. mt_rand(0, 0x0fff) | 0x4000,
  64. mt_rand(0, 0x3fff) | 0x8000,
  65. mt_rand(0, 0xffff),
  66. mt_rand(0, 0xffff),
  67. mt_rand(0, 0xffff)
  68. );
  69.  
  70. return $type ? $uuid : str_replace('-', '', $uuid);
  71. }
  72. function instagram_login($post_username, $post_password){
  73. $postq = json_encode([
  74. 'phone_id' => generateUUID(true),
  75. '_csrftoken' => get_csrftoken(),
  76. 'username' => $post_username,
  77. 'guid' => generateUUID(true),
  78. 'device_id' => generateUUID(true),
  79. 'password' => $post_password,
  80. 'login_attempt_count' => 0
  81. ]);
  82. $a = request(1, generate_useragent(), 'accounts/login/', 0, generateSignature($postq));
  83. $header = $a[0];
  84. $a = json_decode($a[1]);
  85. if($a->status == 'ok'){
  86. preg_match_all('%Set-Cookie: (.*?);%',$header,$d);$cookies = '';
  87. for($o=0;$o<count($d[0]);$o++)$cookies.=$d[1][$o].";";
  88. $id = $a->logged_in_user->pk;
  89. $array = json_encode(['result' => true, 'cookies' => $cookies, 'useragent' => generate_useragent(), 'id' => $id]);
  90. } else {
  91. $msg = $a->message;
  92. $array = json_encode(['result' => false, 'msg' => $msg]);
  93. }
  94. return $array;
  95. }
  96. function hook($data) {
  97. return 'ig_sig_key_version=4&signed_body=' . hash_hmac('sha256', $data, '469862b7e45f078550a0db3687f51ef03005573121a3a7e8d7f43eddb3584a36') . '.' . urlencode($data);
  98. }
  99. function genWaktu($detik){
  100. $detik1 = time()-10;
  101. return "$detik"."_"."$detik1";
  102. }
  103.  
  104. function generate_useragent2($sign_version = '6.22.0'){
  105. $resolusi = array('1080x1776','1080x1920','720x1280', '320x480', '480x800', '1024x768', '1280x720', '768x1024', '480x320');
  106. $versi = array('GT-N7000', 'SM-N9000', 'GT-I9220', 'GT-I9100'); $dpi = array('120', '160', '320', '240');
  107. $ver = $versi[array_rand($versi)];
  108. 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)';
  109. }
  110.  
  111. $post_username = $username;
  112. $post_password = $password;
  113. $jumlah = "50"; // jumlah yang ingin di unfollow
  114.  
  115. $login = json_decode(instagram_login($post_username, $post_password));
  116.  
  117. if($login <> false) {
  118. $id = $login->id;
  119. $cookies = $login->cookies;
  120. $useragent = generate_useragent2();
  121.  
  122. $parameters = ($c>0) ? '?max_id='.$c : '';
  123. $req = request(1, $useragent, 'friendships/'.$id.'/following/'.$parameters, $cookies);
  124. $req = json_decode($req[1]);
  125.  
  126. for($i=1;$i<$jumlah;$i++):
  127. $status1 = request(1, $useragent, 'friendships/show/'.$req->users[$i]->pk.'/', $cookies);
  128. $status = json_decode($status1[1]);
  129. $cek = $status->followed_by;
  130. $iniorangnya = $req->users[$i]->username;
  131.  
  132. if($cek == "1"){
  133. print $i.' '.$iniorangnya.' - Sudah Followback kamu.<br>';
  134. } else {
  135. $idnye = $req->users[$i]->pk;
  136. $unfoll = request(1, $useragent, 'friendships/destroy/'.$idnye.'/', $cookies, hook('{"user_id":"'.$idnye.'"}'));
  137. $unfoll = json_decode($unfoll[1]);
  138. print $i.' '.$iniorangnya.' - Belum Followback kamu [ BERHASIL UNFOLLOW ] .<br>';
  139. }
  140. flush();
  141. endfor;
  142. }
  143. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement