Advertisement
humarb

K

May 15th, 2017
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.25 KB | None | 0 0
  1. <?php
  2. error_reporting(0);
  3. /**
  4. *
  5. */
  6. class Instagram
  7. {
  8.     public function sdata($url , $custom , $delCookies = null){
  9.         $ch = curl_init();
  10.         curl_setopt($ch, CURLOPT_URL, $url);
  11.         curl_setopt($ch, CURLOPT_HEADER, false);
  12.         if($custom[uagent]){
  13.             curl_setopt($ch, CURLOPT_USERAGENT, $custom[uagent]);
  14.         }else{
  15.             curl_setopt($ch, CURLOPT_USERAGENT, "msnbot/1.0 (+http://search.msn.com/msnbot.htm)");
  16.         }
  17.         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  18.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  19.         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  20.         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  21.         curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,0);
  22.         if($custom[rto]){
  23.             curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
  24.         }else{
  25.             curl_setopt($ch, CURLOPT_TIMEOUT, 60);
  26.         }
  27.         if($custom[header]){
  28.             curl_setopt($ch, CURLOPT_HTTPHEADER, $custom[header]);
  29.         }
  30.         curl_setopt($ch, CURLOPT_COOKIEJAR,  getcwd()."/cookies.txt");
  31.         curl_setopt($ch, CURLOPT_COOKIEFILE, getcwd()."/cookies.txt");
  32.         curl_setopt($ch, CURLOPT_VERBOSE, false);
  33.         if($custom[post]){
  34.             if(is_array($custom[post])){
  35.                 $query = http_build_query($custom[post]);
  36.             }else{
  37.                 $query = $custom[post];
  38.             }
  39.             curl_setopt($ch, CURLOPT_POST, true);
  40.             curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
  41.         }
  42.         $data           = curl_exec($ch);
  43.         $httpcode       = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  44.         curl_close($ch);
  45.         return array(
  46.             'data'      => json_decode($data , true),
  47.             'html'      => $data ,
  48.             'httpcode'  => $httpcode,
  49.         );
  50.     }
  51.     public function getID($username){
  52.         echo "[Instagram Mining] Mengambil ID : ".$username."\r\n";
  53.         $custom = array(
  54.             'header' =>  array(
  55.                 "cache-control: no-cache",
  56.                 "connection: Keep-Alive",
  57.                 "host: www.instagram.com",
  58.                 "user-agent: okhttp/2.5.0"
  59.             ),
  60.         );
  61.         $curl   = $this->sdata("https://www.instagram.com/".$username."/?__a=1",$custom);
  62.         if($curl[data][user][id]){
  63.             echo "[Instagram Mining] Mendapatkan ID ".$username." ===> ".$curl[data][user][id]."\r\n";
  64.         }
  65.         return array(
  66.             'id' => $curl[data][user][id],
  67.             'fullname' => $curl[data][user][full_name],
  68.         );
  69.     }
  70.     public function passession($userid){
  71.         $custom = array(
  72.             'header' =>  array(
  73.                 "cache-control: no-cache",
  74.                 "connection: Keep-Alive",
  75.                 "host: mandiritrading.com",
  76.                 "user-agent: okhttp/2.5.0"
  77.               ),
  78.         );
  79.         $curl   = $this->sdata("http://mandiritrading.com/min/api2.php?userid=".$userid,$custom);
  80.         return array(
  81.             'session'   => $curl[data][session],
  82.             'key'       => $curl[data][parsekey]
  83.         );
  84.     }
  85.     public function sig($session,$key,$id){
  86.         $payload = '{"deviceId":"","imei":"","parseKey":"'.$key.'","platform":"0","sessionToken":"'.$session.'","viPassword":"","viUserId":"'.$id.'","viUserName":"instagram"}';
  87.         $miningAPI = $this->sdata("http://mandiritrading.com/min/api2.php?sig=".$payload);
  88.         return array(
  89.             'session'   => $miningAPI[data][session],
  90.             'key'       => $miningAPI[data][parsekey],
  91.             'sig'       => $miningAPI[data][sig],
  92.         );
  93.     }
  94.     public function login($session,$key,$sig,$uid){
  95.         $custom = array(
  96.             'header' =>  array(
  97.                 "appversion: 12",
  98.                 "cache-control: no-cache",
  99.                 "connection: Keep-Alive",
  100.                 "content-type: application/json; charset=utf-8",
  101.                 "host: 52.8.205.19",
  102.                 "signature: ".$sig,
  103.                 "systemversion: realfollowersdimiandroid/ ()",
  104.                 "user-agent: realfollowersdimi 12"
  105.             ),
  106.             'post' => "{\"deviceId\":\"\",\"imei\":\"\",\"parseKey\":\"".$key."\",\"platform\":\"0\",\"sessionToken\":\"".$session."\",\"viPassword\":\"\",\"viUserId\":\"".$uid."\",\"viUserName\":\"instagram\"}"
  107.         );
  108.         $login = $this->sdata("http://52.8.205.19/user/login ",$custom);
  109.         return array(
  110.             'status' => $login[data][status][status],
  111.             'level' => $login[data][data][accountLevel],
  112.             'point' => $login[data][data][coins],
  113.         );
  114.     }
  115.     public function getboard($session,$sig,$id){
  116.         $custom = array(
  117.             'header' =>  array(
  118.                 "appversion: 12",
  119.                 "cache-control: no-cache",
  120.                 "connection: Keep-Alive",
  121.                 "content-type: application/json; charset=utf-8",
  122.                 "host: 52.8.205.19",
  123.                 "signature: ".$sig,
  124.                 "systemversion: realfollowersdimiandroid/ ()",
  125.                 "user-agent: realfollowersdimi 12"
  126.             ),
  127.         );
  128.         $board = $this->sdata("http://52.8.205.19/user/".$id."/getBoard/1/".$session,$custom);
  129.         if($board[data][status][status] == "200"){
  130.             foreach ($board[data][data][boardList] as $kunci => $data) {
  131.                 $dump[] = array(
  132.                     'id'            => $data[viUserId],
  133.                     'orderid'       => $data[orderId],
  134.                     'username'      => $data[username],
  135.                     'targetUserId'  => $data[targetUserId],
  136.                     'freez'         => $data[actionCoolDown],
  137.                     'point'         => $data[coinsReward]
  138.                 );
  139.             }
  140.             return $dump;
  141.         }
  142.     }
  143.     public function trackAction($session,$orderid,$sig,$id){
  144.         $custom = array(
  145.             'header' =>  array(
  146.                 "appversion: 12",
  147.                 "cache-control: no-cache",
  148.                 "connection: Keep-Alive",
  149.                 "content-type: application/json; charset=utf-8",
  150.                 "host: 52.8.205.19",
  151.                 "signature: ".$sig,
  152.                 "systemversion: realfollowersdimiandroid/ ()",
  153.                 "user-agent: realfollowersdimi 12"
  154.             ),
  155.             'post' => "{\"actionToken\":\"D97814A263EB9F757AB4FEE5F9984956\",\"action\":0,\"orderId\": \"".$orderid."\"}"
  156.         );
  157.         $board = $this->sdata("http://52.8.205.19/user/".$id."/trackAction/".$session,$custom);
  158.         if($board[data][status][status] == "200"){
  159.             return array(
  160.                 'orderid' => $orderid,
  161.                 'point'   => $board[data][data][coinsInAccount],
  162.             );
  163.         }
  164.     }
  165.     public function getFollow($session,$sig,$id,$good){
  166.         $custom = array(
  167.             'header' =>  array(
  168.                 "appversion: 12",
  169.                 "cache-control: no-cache",
  170.                 "connection: Keep-Alive",
  171.                 "content-type: application/json; charset=utf-8",
  172.                 "host: 52.8.205.19",
  173.                 "signature: ".$sig,
  174.                 "systemversion: realfollowersdimiandroid/ ()",
  175.                 "user-agent: realfollowersdimi 12"
  176.             ),
  177.             'post' => "{\"avatarUrl\":\"https://scontent-sin6-1.cdninstagram.com/t51.2885-15/e35/17493489_1482913915072171_8961846015002935296_n.jpg\",\"goodsId\":\"".$good."\",\"userName\":\"instagram\",\"startAt\":0}"
  178.         );
  179.         $follow = $this->sdata("http://52.8.205.19/user/".$id."/getFollowers/".$session,$custom);
  180.         return $follow;
  181.     }
  182.     public function rollBack($session,$sig,$id,$good){
  183.         $follow = $this->getFollow($session,$sig,$id,$good);
  184.         if($follow[data][status][status] == "200"){
  185.             //echo "[Instagram Mining] ====> Telah mendapatkan followers ".$good." | Point :".$follow[data][data][coinsInAccount]." <====\r\n";
  186.             echo "[Instagram Mining]---===>> [Klaim Followers] ".$good." | Sisa Point : ".$follow[data][data][coinsInAccount]."  <===------\r\n";
  187.             $this->rollBack($session,$sig,$id);
  188.         }else{
  189.             $this->minings($id,$session,$sig);
  190.         }
  191.     }
  192.     public function minings($id,$session,$sig){
  193.         $randem = "20000";
  194.         echo "[Instagram Mining]========> Mengambil Task <========\r\n";
  195.         $board = $this->getboard($session,$sig,$id);
  196.         if($board == ""){
  197.             $this->run($id);
  198.         }
  199.         foreach ($board as $numkunci => $boardata) {
  200.             sleep($data[actionCoolDown]);
  201.             echo "[Instagram Mining][".($numkunci+1)."/".count($board)."] ";
  202.             $action = $this->trackAction($session,$boardata[orderid],$sig,$id);
  203.             echo "==> Reward : ".$boardata[point]." Point |".$action[point] ."/".$randem."|".($action[point]-$randem)." <==----\r\n";
  204.             $point = $action[point] ;
  205.         }
  206.         //echo "[Instagram Mining]        ---===>> Total Poin : ".$action[point]."/".$randem."  <===------\r\n";
  207.         /*if($point >= $randem){
  208.             $this->rollBack($session,$sig,$id,"com.ty.vl.follower6"); //400
  209.             $this->minings($id,$session,$sig);
  210.         }*/
  211.         /*if($point >= 20000){
  212.             $this->rollBack($session,$sig,$id,"com.ty.vl.follower6"); //40000
  213.             $this->minings($id,$session,$sig);
  214.         }
  215.         if($point >= 6000){
  216.             $this->rollBack($session,$sig,$id,"com.ty.vl.follower5"); //1000
  217.             $this->minings($id,$session,$sig);
  218.         }
  219.         if($point >= 2500){
  220.             $this->rollBack($session,$sig,$id,"com.ty.vl.follower4"); //400
  221.             $this->minings($id,$session,$sig);
  222.         }
  223.         if($point >= 500){
  224.             $this->rollBack($session,$sig,$id,"com.ty.vl.follower3"); //75
  225.             $this->minings($id,$session,$sig);
  226.         }
  227.         if($point >= 250){
  228.             $this->rollBack($session,$sig,$id,"com.ty.vl.follower2"); //35
  229.             $this->minings($id,$session,$sig);
  230.         }
  231.         if($point >= 80){
  232.             $this->rollBack($session,$sig,$id,"com.ty.vl.follower1"); //10
  233.             $this->minings($id,$session,$sig);
  234.         }*/
  235.             $this->minings($id,$session,$sig);
  236.     }
  237.     public function run($id){
  238.  
  239.         $name   = $id[fullname];
  240.         $id     = $id[id];
  241.  
  242.         echo "[Instagram Mining] Sedang mengambil akses token\r\n";
  243.         $token  = $this->passession($id);
  244.         echo "[Instagram Mining] Sedang mengambil sertifikat\r\n";
  245.         $sig = $this->sig($token[session],$token[key],$id);
  246.         echo "[Instagram Mining] Mencoba mengambil task mining\r\n";
  247.         $login = $this->login($token[session],$token[key],$sig[sig],$id);
  248.         echo "[Instagram Mining] Akun anda memiliki ".$login['point']." & Level ".$login[level]."\r\n";
  249.         $this->minings($id,$token[session],$sig[sig]);
  250.    
  251.     }
  252. }
  253. $Instagram   = new Instagram;
  254. $InstagramID = $Instagram->getID("powtteer");
  255. $Instagram->run($InstagramID); //
  256. //9990010700291059|2409
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement