Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $myusername = "Panda";
- $mypassword = "letmein";
- error_reporting(E_ALL);
- include("hhb_inc.php");
- $hc = new hhb_curl('', true);
- //
- //now to fetch the csrf token and cookies
- //
- print "Starting bot...\n";
- $json = $hc->setopt_array(array(
- CURLOPT_URL => 'http://textmmo.tk/',
- CURLOPT_COOKIEJAR => 'LandingCookies.txt',
- CURLOPT_COOKIEFILE => 'LandingCcookies.txt'
- ))->exec()->getStdOut();
- $parsed = json_decode($json, true);
- $cookies_raw = $hc->getResponseHeaders();
- $cookies_parsed = array();
- foreach ($cookies_raw as $tmp) {
- if (false === strpos($tmp, ':')) {
- // don't need this header
- continue;
- }
- $tmp = explode(':', $tmp, 2);
- $cookies_parsed[trim($tmp[0])] = trim($tmp[1]);
- }
- //hhb_var_dump($cookies_parsed);
- $csrftoken_string = $cookies_parsed["Set-Cookie"];
- $csrftoken_imploded = explode(";", $csrftoken_string);
- $csrftoken_full = $csrftoken_imploded[0];
- $csrftoken_peice = explode("=", $csrftoken_full);
- $csrftoken = $csrftoken_peice[1];
- print "grabbed csrf token, login now...\n";
- // build login request now
- $myval = 'value="';
- $myval2 = '"';
- $myhtml_imploded = explode($myval, $json);
- $myhtml_full = $myhtml_imploded[1];
- $myhtml_peice = explode($myval2, $myhtml_full);
- $csrfmiddlewaretoken = $myhtml_peice[0];
- /*print "csrfmiddlewaretoken $csrfmiddlewaretoken";
- print "\n$myusername";
- print "\n$mypassword\n \n \n \n";*/
- $mypostfields = array('csrfmiddlewaretoken' => $csrfmiddlewaretoken, 'username' => $myusername, 'password' => $mypassword);
- $twofactorHeaders = array(
- // 'Connection: keep-alive',
- 'Content-Type: application/x-www-form-urlencoded',
- // 'Cache-Control: max-age=0',
- 'Origin: http://textmmo.tk',
- // 'Upgrade-Insecure-Requests: 1',
- 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
- 'Access-Control-Request-Headers: content-type',
- // 'Referer: http://textmmo.tk/accounts/login/',
- // 'Accept-Encoding: gzip, deflate',
- // 'Accept-Language: en-US,en;q=0.9',
- 'Content-Length: ' . '52',
- );
- //hhb_var_dump($mypostfields) & die();
- $json2 = $hc->setopt_array(array(
- CURLOPT_URL => "http://textmmo.tk/accounts/login/?next=game/train",
- CURLOPT_POST => 1,
- CURLOPT_FOLLOWLOCATION => TRUE,
- CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36',
- CURLOPT_POSTFIELDS => $mypostfields,
- // CURLOPT_HTTPHEADER => json_encode($twofactorHeaders)
- ))->exec()->getStdOut();
- $parsed = json_decode($json2, true);
- print "logged into game...\n";
- $counter = 0;
- while($counter < 49){
- // get secondm csrf token
- $json = $hc->setopt_array(array(
- CURLOPT_URL => 'http://textmmo.tk/game/train/',
- ))->exec()->getStdOut();
- $myval = 'value="';
- $myval2 = '"';
- $myhtml_imploded = explode($myval, $json);
- $myhtml_full = $myhtml_imploded[1];
- $myhtml_peice = explode($myval2, $myhtml_full);
- $csrfmiddlewaretoken = $myhtml_peice[0];
- $myval = 'Energy:';
- $myval2 = '/';
- $myhtml_imploded = explode($myval, $json);
- $myhtml_full = $myhtml_imploded[1];
- $myhtml_peice = explode($myval2, $myhtml_full);
- $myenergy = trim($myhtml_peice[0]);
- $now = time();
- if($myenergy > 0){
- // train now
- $json2 = "";
- $mypostfields = array('csrfmiddlewaretoken' => $csrfmiddlewaretoken, 'statTrain' => '1', 'typeToTrain' => 'strength');
- $json2 = $hc->setopt_array(array(
- CURLOPT_URL => "http://textmmo.tk/game/train/",
- CURLOPT_POST => 1,
- CURLOPT_FOLLOWLOCATION => TRUE,
- CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36',
- CURLOPT_POSTFIELDS => $mypostfields,
- // CURLOPT_HTTPHEADER => json_encode($twofactorHeaders)
- ))->exec()->getStdOut();
- $parsed = json_decode($json2, true);
- if($json2 != ""){
- print "trained a skill.. $counter\n";
- }
- }else{
- print "waiting for energy to refill.. $counter\n";
- }
- $counter++;
- }
- $counter = 0;
- while($counter < 7){
- // get secondm csrf token
- $json = $hc->setopt_array(array(
- CURLOPT_URL => 'http://textmmo.tk/game/quests/',
- ))->exec()->getStdOut();
- $myval = 'value="';
- $myval2 = '"';
- $myhtml_imploded = explode($myval, $json);
- $myhtml_full = $myhtml_imploded[1];
- $myhtml_peice = explode($myval2, $myhtml_full);
- $csrfmiddlewaretoken = $myhtml_peice[0];
- // train now
- $json2 = "";
- $mypostfields = array('csrfmiddlewaretoken' => $csrfmiddlewaretoken, 'questRadio' => '4');
- $json2 = $hc->setopt_array(array(
- CURLOPT_URL => "http://textmmo.tk/game/train/",
- CURLOPT_POST => 1,
- CURLOPT_FOLLOWLOCATION => TRUE,
- CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36',
- CURLOPT_POSTFIELDS => $mypostfields,
- // CURLOPT_HTTPHEADER => json_encode($twofactorHeaders)
- ))->exec()->getStdOut();
- $parsed = json_decode($json2, true);
- if($json2 != ""){
- print "completed a quest..$counter\n";
- }
- $counter++;
- }
- print "=========\n========";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement