Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.54 KB | None | 0 0
  1. <?php
  2. session_start();
  3. function proccess($ighost, $useragent, $url, $cookie = 0, $data = 0, $httpheader = array(), $proxy = 0, $userpwd = 0, $is_socks5 = 0){
  4. $url = $ighost ? 'https://i.instagram.com/api/v1/' . $url : $url;
  5. $ch = curl_init($url);
  6. curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
  7. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  8. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  9. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  10. curl_setopt($ch, CURLOPT_TIMEOUT, 20);
  11. if($proxy) curl_setopt($ch, CURLOPT_PROXY, $proxy);
  12. if($userpwd) curl_setopt($ch, CURLOPT_PROXYUSERPWD, $userpwd);
  13. if($is_socks5) curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
  14. if($httpheader) curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
  15. curl_setopt($ch, CURLOPT_HEADER, 1);
  16. if($cookie) curl_setopt($ch, CURLOPT_COOKIE, $cookie);
  17. if ($data):
  18. curl_setopt($ch, CURLOPT_POST, 1);
  19. curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  20. endif;
  21. $response = curl_exec($ch);
  22. $httpcode = curl_getinfo($ch);
  23. if(!$httpcode) return false; else{
  24. $header = substr($response, 0, curl_getinfo($ch, CURLINFO_HEADER_SIZE));
  25. $body = substr($response, curl_getinfo($ch, CURLINFO_HEADER_SIZE));
  26. curl_close($ch);
  27. return array($header, $body);
  28. }
  29. }
  30. function generate_useragent($sign_version = '6.22.0'){
  31. $resolusi = array('1080x1776','1080x1920','720x1280', '320x480', '480x800', '1024x768', '1280x720', '768x1024', '480x320');
  32. $versi = array('GT-N7000', 'SM-N9000', 'GT-I9220', 'GT-I9100'); $dpi = array('120', '160', '320', '240');
  33. $ver = $versi[array_rand($versi)];
  34. 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)';
  35. }
  36. function hook($data) {
  37. return 'ig_sig_key_version=4&signed_body=' . hash_hmac('sha256', $data, '469862b7e45f078550a0db3687f51ef03005573121a3a7e8d7f43eddb3584a36') . '.' . urlencode($data);
  38. }
  39. function generate_device_id(){
  40. return 'android-' . md5(rand(1000, 9999)).rand(2, 9);
  41. }
  42. function generate_guid($tipe = 0){
  43. $guid = sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
  44. mt_rand(0, 65535),
  45. mt_rand(0, 65535),
  46. mt_rand(0, 65535),
  47. mt_rand(16384, 20479),
  48. mt_rand(32768, 49151),
  49. mt_rand(0, 65535),
  50. mt_rand(0, 65535),
  51. mt_rand(0, 65535));
  52. return $tipe ? $guid : str_replace('-', '', $guid);
  53. }
  54. ?>
  55. <form action="" method="post">
  56. <title>Unfoll</title>
  57. Username : <br/>
  58. <input type="text" name="username"/><br/>
  59. Password : <br/>
  60. <input type="password" name="password"/><br/>
  61. <button type="submit">Unfoll</button>
  62.  
  63. <?php
  64. if(isset($_POST['username']) || isset($_POST['password'])){
  65. $ua = generate_useragent();
  66. $devid = generate_device_id();
  67. $login = proccess(1, $ua, 'accounts/login/', 0, hook('{"device_id":"'.$devid.'","guid":"'.generate_guid().'","username":"'.trim($_POST['username']).'","password":"'.($_POST['password']).'","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}'));
  68. $data = json_decode($login[1]);
  69. if($data->status<>ok){
  70. print 'Username / password salah';
  71. } else {
  72. preg_match_all('%Set-Cookie: (.*?);%',$login[0],$d);$cookie = '';
  73. for($o=0;$o<count($d[0]);$o++)$cookie.=$d[1][$o].";";
  74. $_SESSION['data'] = array('cookies' => $cookie, 'useragent' => $ua, 'device_id' => $devid, 'username' => $data->logged_in_user->username, 'id' => $data->logged_in_user->pk);
  75. $data_session = $_SESSION['data'];
  76. $c = 0;
  77. $listids = array();
  78. do{
  79. $parameters = ($c>0) ? '?max_id='.$c : '';
  80. $req = proccess(1, $data_session['useragent'], 'friendships/'.$data_session['id'].'/following/'.$parameters, $data_session['cookies']);
  81. $req = json_decode($req[1]);
  82. for($i=0;$i<count($req->users);$i++):
  83. if(count($listids)<=$limit)
  84. $status = proccess($data_session['useragent'], 'friendships/show/'.$req->users[$i]->pk.'/', $data_session['cookies']);
  85. $status = json_decode($status[1]);
  86. if(!$status->followed_by)
  87. $listids[count($listids)] = $req->users[$i]->pk;
  88. endfor;
  89. $c = (isset($req->next_max_id)) ? $req->next_max_id : 0;
  90. }while($c>0);
  91. for($i=0;$i<count($listids);$i++):
  92. $cross = proccess(1, $data_session['useragent'], 'friendships/destroy/'.$listids[$i].'/', $data_session['cookies'], hook('{"user_id":"'.$listids[$i].'"}'));
  93. $cross = json_decode($cross[1]);
  94. print $i.'. <b>@'.$data_session['username'].'</b> <font color="green">Sukses Unfollow => </font><b style="color:gray;">[ @'.$listids[$i].' ]</b><br>';
  95. flush();
  96. endfor;
  97. }
  98. }?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement