Advertisement
Guest User

Untitled

a guest
Mar 10th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.92 KB | None | 0 0
  1. <?php
  2.  
  3. $myusername = "Panda";
  4. $mypassword = "letmein";
  5. error_reporting(E_ALL);
  6.  
  7. include("hhb_inc.php");
  8.  
  9. $hc = new hhb_curl('', true);
  10.  
  11. //
  12. //now to fetch the csrf token and cookies
  13. //
  14.  
  15. print "Starting bot...\n";
  16.  
  17. $json = $hc->setopt_array(array(
  18.         CURLOPT_URL => 'http://textmmo.tk/',
  19.         CURLOPT_COOKIEJAR => 'LandingCookies.txt',
  20.         CURLOPT_COOKIEFILE => 'LandingCcookies.txt'
  21.     ))->exec()->getStdOut();
  22.  
  23.     $parsed = json_decode($json, true);
  24.  
  25.     $cookies_raw = $hc->getResponseHeaders();
  26.     $cookies_parsed = array();
  27.     foreach ($cookies_raw as $tmp) {
  28.         if (false === strpos($tmp, ':')) {
  29.             // don't need this header
  30.             continue;
  31.         }
  32.         $tmp = explode(':', $tmp, 2);
  33.         $cookies_parsed[trim($tmp[0])] = trim($tmp[1]);
  34.     }
  35.  
  36.     //hhb_var_dump($cookies_parsed);
  37.  
  38.     $csrftoken_string = $cookies_parsed["Set-Cookie"];
  39.     $csrftoken_imploded = explode(";", $csrftoken_string);
  40.     $csrftoken_full = $csrftoken_imploded[0];
  41.     $csrftoken_peice = explode("=", $csrftoken_full);
  42.     $csrftoken = $csrftoken_peice[1];
  43.  
  44.     print "grabbed csrf token, login now...\n";
  45.  
  46.     // build login request now
  47.  
  48.     $myval = 'value="';
  49.     $myval2 = '"';
  50.     $myhtml_imploded = explode($myval, $json);
  51.     $myhtml_full = $myhtml_imploded[1];
  52.     $myhtml_peice = explode($myval2, $myhtml_full);
  53.     $csrfmiddlewaretoken = $myhtml_peice[0];
  54.  
  55.  
  56.     /*print "csrfmiddlewaretoken $csrfmiddlewaretoken";
  57.     print "\n$myusername";
  58.     print "\n$mypassword\n \n \n \n";*/
  59.  
  60.     $mypostfields = array('csrfmiddlewaretoken' => $csrfmiddlewaretoken, 'username' => $myusername, 'password' => $mypassword);
  61.  
  62.     $twofactorHeaders = array(
  63.           //  'Connection: keep-alive',
  64.             'Content-Type: application/x-www-form-urlencoded',
  65.      //       'Cache-Control: max-age=0',
  66.             'Origin: http://textmmo.tk',
  67.        //     'Upgrade-Insecure-Requests: 1',
  68.             'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
  69.             'Access-Control-Request-Headers: content-type',
  70.       //      'Referer: http://textmmo.tk/accounts/login/',
  71.      //       'Accept-Encoding: gzip, deflate',
  72.     //        'Accept-Language: en-US,en;q=0.9',            
  73.             'Content-Length: ' . '52',
  74.         );
  75.  
  76.     //hhb_var_dump($mypostfields) & die();
  77.     $json2 = $hc->setopt_array(array(
  78.         CURLOPT_URL => "http://textmmo.tk/accounts/login/?next=game/train",
  79.         CURLOPT_POST => 1,
  80.         CURLOPT_FOLLOWLOCATION => TRUE,
  81.         CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36',
  82.         CURLOPT_POSTFIELDS => $mypostfields,
  83.   //      CURLOPT_HTTPHEADER => json_encode($twofactorHeaders)
  84.     ))->exec()->getStdOut();
  85.     $parsed = json_decode($json2, true);
  86.  
  87.     print "logged into game...\n";
  88.  
  89.     $counter = 0;
  90.     while($counter < 49){
  91.  
  92.         // get secondm csrf token
  93.         $json = $hc->setopt_array(array(
  94.             CURLOPT_URL => 'http://textmmo.tk/game/train/',
  95.         ))->exec()->getStdOut();
  96.  
  97.         $myval = 'value="';
  98.         $myval2 = '"';
  99.         $myhtml_imploded = explode($myval, $json);
  100.         $myhtml_full = $myhtml_imploded[1];
  101.         $myhtml_peice = explode($myval2, $myhtml_full);
  102.         $csrfmiddlewaretoken = $myhtml_peice[0];
  103.  
  104.  
  105.         $myval = 'Energy:';
  106.         $myval2 = '/';
  107.         $myhtml_imploded = explode($myval, $json);
  108.         $myhtml_full = $myhtml_imploded[1];
  109.         $myhtml_peice = explode($myval2, $myhtml_full);
  110.         $myenergy = trim($myhtml_peice[0]);
  111.         $now = time();
  112.  
  113.         if($myenergy > 0){
  114.  
  115.             // train now
  116.             $json2 = "";
  117.  
  118.             $mypostfields = array('csrfmiddlewaretoken' => $csrfmiddlewaretoken, 'statTrain' => '1', 'typeToTrain' => 'strength');
  119.             $json2 = $hc->setopt_array(array(
  120.                 CURLOPT_URL => "http://textmmo.tk/game/train/",
  121.                 CURLOPT_POST => 1,
  122.                 CURLOPT_FOLLOWLOCATION => TRUE,
  123.                 CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36',
  124.                 CURLOPT_POSTFIELDS => $mypostfields,
  125.           //      CURLOPT_HTTPHEADER => json_encode($twofactorHeaders)
  126.             ))->exec()->getStdOut();
  127.             $parsed = json_decode($json2, true);
  128.  
  129.  
  130.             if($json2 != ""){
  131.                 print "trained a skill.. $counter\n";
  132.             }
  133.  
  134.         }else{
  135.             print "waiting for energy to refill.. $counter\n";
  136.         }
  137.        
  138.         $counter++;
  139.     }
  140.  
  141.     $counter = 0;
  142.    while($counter < 7){
  143.  
  144.         // get secondm csrf token
  145.         $json = $hc->setopt_array(array(
  146.             CURLOPT_URL => 'http://textmmo.tk/game/quests/',
  147.         ))->exec()->getStdOut();
  148.  
  149.         $myval = 'value="';
  150.         $myval2 = '"';
  151.         $myhtml_imploded = explode($myval, $json);
  152.         $myhtml_full = $myhtml_imploded[1];
  153.         $myhtml_peice = explode($myval2, $myhtml_full);
  154.         $csrfmiddlewaretoken = $myhtml_peice[0];
  155.        
  156.         // train now
  157.         $json2 = "";
  158.  
  159.         $mypostfields = array('csrfmiddlewaretoken' => $csrfmiddlewaretoken, 'questRadio' => '4');
  160.         $json2 = $hc->setopt_array(array(
  161.             CURLOPT_URL => "http://textmmo.tk/game/train/",
  162.             CURLOPT_POST => 1,
  163.             CURLOPT_FOLLOWLOCATION => TRUE,
  164.             CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36',
  165.             CURLOPT_POSTFIELDS => $mypostfields,
  166.       //      CURLOPT_HTTPHEADER => json_encode($twofactorHeaders)
  167.         ))->exec()->getStdOut();
  168.         $parsed = json_decode($json2, true);
  169.  
  170.         if($json2 != ""){
  171.             print "completed a quest..$counter\n";
  172.         }
  173.         $counter++;
  174.     }
  175.  
  176.     print "=========\n========";
  177.  
  178. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement