Guest User

Cheetos bot by VANS v2

a guest
May 1st, 2015
74
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program Project1;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. uses
  6.   Windows,
  7.   SysUtils,
  8.   Classes,
  9.   HTTPSend,
  10.   SSL_OpenSSL,
  11.   Clipbrd;
  12.  
  13. type
  14.   TRes=record
  15.     page:string;
  16.     redirect:string;
  17.   end;
  18.  
  19.   TCheetos=record
  20.     image:integer;
  21.     active:boolean;
  22.   end;
  23.  
  24. var
  25.   Cookie, page, CheCookie, red, useragent:string;
  26.   i, j, n, CardCount, q:integer;
  27.   NextLevel:boolean;
  28.   card:array [0..40] of TCheetos;
  29.   send:TStringStream;
  30.   HTTP:THTTPSend;
  31.   rez:TStringList;
  32.  
  33. function Pars(T_, ForS, _T:string):string;
  34.   var a, b:integer;
  35. begin
  36.   Result := '';
  37.   if (T_='') or (ForS='') or (_T='') then Exit;
  38.   a:=Pos(T_, ForS);
  39.   if a=0 then Exit else a:=a+Length(T_);
  40.   ForS:=Copy(ForS, a, Length(ForS)-a+1);
  41.   b:=Pos(_T, ForS);
  42.   if b>0 then
  43.   Result:=Copy(ForS, 1, b - 1);
  44. end;
  45.  
  46. function GetLocation(const headers:TStringList):string;
  47. var i:integer;
  48. begin
  49.   result:='';
  50.   for I := 0 to headers.Count - 1 do
  51.     if pos('Location: ',headers[i])>0 then
  52.         begin
  53.           Result:=copy(headers[i],11,length(headers[i]));
  54.           break;
  55.         end;
  56. end;
  57.  
  58. function LoginVK: boolean;
  59. var str, ip_h, sid, login, pass:string; i:integer;
  60. begin
  61.   write('Copy to clipboard User-Agent and press ENTER');
  62.   readln;
  63.   useragent:=clipboard.AsText;
  64.   write('Enter login: ');
  65.   readln(login);
  66.   write('Enter password: ');
  67.   readln(pass);
  68.  
  69.   HTTP:=THTTPSend.Create;
  70.   HTTP.UserAgent:=useragent;
  71.   HTTP.Protocol:='1.1';
  72.   HTTP.HTTPMethod('GET', 'https://vk.com/login.php');
  73.   Cookie:=HTTP.Cookies.Text;
  74.   rez:=TStringList.Create;
  75.   rez.LoadFromStream(HTTP.Document);
  76.   str:=rez.Text;
  77.   rez.Free;
  78.   HTTP.Free;
  79.  
  80.   ip_h:=Pars('name="ip_h" value="', str, '"');
  81.  
  82.   HTTP:=THTTPSend.Create;
  83.   HTTP.UserAgent:=useragent;
  84.   HTTP.Protocol:='1.1';
  85.   HTTP.Cookies.Text:=Cookie;
  86.   HTTP.MimeType:='application/x-www-form-urlencoded';
  87.   send:=TStringStream.Create('');
  88.   send.WriteString('act=login&_origin=https%3A%2F%2Fvk.com&ip_h='+ip_h+'&email='+login+'&pass='+pass);
  89.   HTTP.Document.LoadFromStream(send);
  90.   send.Free;
  91.   HTTP.Cookies.Text:=Cookie;
  92.   HTTP.HTTPMethod('POST', 'https://login.vk.com/?act=login');
  93.   Cookie:=HTTP.Cookies.Text;
  94.   red:=GetLocation(HTTP.Headers);
  95.   HTTP.Free;
  96.  
  97.   if pos('hash=', red)<>0 then begin
  98.     HTTP:=THTTPSend.Create;
  99.     HTTP.UserAgent:=useragent;
  100.     HTTP.Protocol:='1.1';
  101.     HTTP.Cookies.Text:=Cookie;
  102.     HTTP.HTTPMethod('GET', red);
  103.     Cookie:=HTTP.Cookies.Text;
  104.     rez:=TStringList.Create;
  105.     rez.LoadFromStream(HTTP.Document);
  106.     str:=rez.Text;
  107.     rez.Free;
  108.     HTTP.Free;
  109.     result:=true;
  110.   end else result:=false;
  111. end;
  112.  
  113. function HTTPGet(url: string; var Cookies:string):TRes;
  114. begin
  115.   HTTP:=THTTPSend.Create;
  116.   HTTP.Cookies.Text:=Cookies;
  117.   HTTP.AddPortNumberToHost:=false;
  118.   HTTP.UserAgent:=useragent;
  119.   HTTP.Protocol:='1.1';
  120.   HTTP.HTTPMethod('GET', url);
  121.   Cookies:=HTTP.Cookies.Text;
  122.   rez:=TStringList.Create;
  123.   rez.LoadFromStream(HTTP.Document);
  124.   result.page:=rez.Text;
  125.   rez.Free;
  126.   result.redirect:=GetLocation(HTTP.Headers);
  127.   HTTP.Free;
  128. end;
  129.  
  130. begin
  131.   writeln('===============================================================================');
  132.   writeln('=========================== Cheetos.ru Game bot ===============================');
  133.   writeln('====================== Coded by VANS - VANS-SOFT.RU ===========================');
  134.   writeln('===============================================================================');
  135.   useragent:='Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.94 Safari/537.36';
  136.   Cookie:='';
  137.   CheCookie:='';
  138.   NextLevel:=false;
  139.  
  140.   readln;
  141.  
  142.   HTTPGet('https://cheetos.ru/', CheCookie);
  143.     //авторизация по логину/паролю без ВК
  144.   HTTP:=THTTPSend.Create;
  145.   HTTP.UserAgent:=useragent;
  146.   HTTP.Protocol:='1.1';
  147.   HTTP.Cookies.Text:=CheCookie;
  148.   HTTP.Headers.Add('X-Requested-With:XMLHttpRequest');
  149.   HTTP.Headers.Add('Referer:https://cheetos.ru/');
  150.   HTTP.MimeType:='application/x-www-form-urlencoded';
  151.   send:=TStringStream.Create('');
  152.   send.WriteString('email=*youmail*&password=*youpassw*&three_weeks=false');
  153.   HTTP.Document.LoadFromStream(send);
  154.   send.Free;
  155.   HTTP.Cookies.Text:=Cookie;
  156.   HTTP.HTTPMethod('POST', 'https://cheetos.ru/api/users/log_in');
  157.   CheCookie:=HTTP.Cookies.Text;
  158.   rez:=TStringList.Create;
  159.   rez.LoadFromStream(HTTP.Document);
  160.   page:=rez.Text;
  161.   rez.Free;
  162.   HTTP.Free;
  163.  
  164.   if pos('{}', page)<>0 then begin
  165.     writeln('Login Success!');
  166.     page:=HTTPGet('https://cheetos.ru/api/users/current', CheCookie).page;
  167.     writeln('Points: '+Pars('"points_all":"', page, '"'));
  168.  
  169.     for n:=1 to 3 do begin
  170.       if not NextLevel then begin
  171.         writeln('Create new game...');
  172.         page:=HTTPGet('https://cheetos.ru/api/game/new', CheCookie).page;
  173.         NextLevel:=true;
  174.       end else begin
  175.         writeln('Next game...');
  176.         page:=HTTPGet('https://cheetos.ru/api/game/next_level', CheCookie).page;
  177.       end;
  178.  
  179.       CardCount:=StrToInt(Pars('"card":', page, ','))-1;
  180.       writeln('Level: '+Pars('"level":', page, ','));
  181.       writeln('Card: '+IntToStr(CardCount+1));
  182.       writeln('Time: '+Pars('"time":', page, '}'));
  183.  
  184.       page:=HTTPGet('https://cheetos.ru/api/users/code_is_activate', CheCookie).page;
  185.       writeln('Activate: '+Pars('"activate":', page, '}'));
  186.  
  187.       writeln('Get card, please wait...');
  188.       i:=0;
  189.       q:=0;
  190.       while q < (CardCount+1) do begin
  191.         page:=HTTPGet('https://cheetos.ru/api/game/card_get?number='+IntToStr(i), CheCookie).page;
  192.         card[i].image:=StrToInt(Pars('"image":', page, ','));
  193.         card[i].active:=(Pars('"success":', page, ',')='true');
  194.         writeln('['+IntToStr(i)+'] '+IntToStr(card[i].image)+' = ', card[i].active, ' success: '+Pars('"success":', page, ','));
  195.  
  196.         if card[i].active then begin
  197.           card[i-1].active:=true;
  198.           inc(q, 2);
  199.         end else begin
  200.           for j:=i-1 downto 0 do begin
  201.             if (card[i].image=card[j].image) then begin //and (i<>j)
  202.               if card[i].active and card[j].active then break;
  203.               Write(IntToStr(i)+'('+IntToStr(card[i].image)+') + '+IntToStr(j)+'('+IntToStr(card[j].image)+') = ');
  204.               if Pars('"success":', page, ',')<>'null' then begin
  205.                 page:=HTTPGet('https://cheetos.ru/api/game/card_get?number='+IntToStr(j), CheCookie).page;
  206.                 page:=HTTPGet('https://cheetos.ru/api/game/card_get?number='+IntToStr(i), CheCookie).page;
  207.               end else
  208.                 page:=HTTPGet('https://cheetos.ru/api/game/card_get?number='+IntToStr(j), CheCookie).page;
  209.               card[i].active:=true;
  210.               card[j].active:=true;
  211.               inc(q, 2);
  212.               writeln(Pars('"success":', page, ','));
  213.               if Pars('"finish":', page, ',')='true' then begin
  214.                 writeln('GAME WINNER');  
  215.                 writeln(Pars('"score":', page, '}'));
  216.               end;
  217.               break;
  218.             end;
  219.           end;
  220.         end;
  221.         inc(i);
  222.         sleep(Random(4000));
  223.       end;
  224.     end;
  225.   end else writeln('VK Auth Error');
  226.   readln;
  227. end.
RAW Paste Data