Advertisement
Guest User

bruteforce

a guest
Aug 20th, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. #include <ctime>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     const string s = "0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";
  10.     const short aSize = 62;
  11.     const short pSize = 8;
  12.     string pass = "00000000";
  13.     ofstream out ("t.txt");
  14.  
  15.     out << pass << endl;
  16.  
  17.     time_t now = time(0);
  18.  
  19.     for (int j = 0, c = 0; j < pSize; ++j)
  20.     {
  21.         if (pass[j] != s[aSize-1])
  22.         {
  23.             for (short h = j - 1; h >= 0; --h)
  24.                 pass[h] = s[0];
  25.  
  26.             pass[j] = s[s.find(pass[j]) + 1];
  27.             out << pass << endl;
  28.             j = -1;
  29.             ++c;
  30.         }
  31.  
  32.         if (time(0) - now > 1)
  33.         {
  34.             cout << c << " passwords per second" << endl;
  35.             c = 0;
  36.             now = time(0);
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement