1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <fstream>
using namespace std;
int main()
{
int x,n,i,r1, r2, r3, r4, r5, r6, r7, r8, r9 ,r10;
string c[37] = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3",
"4", "5", "6", "7", "8", "9", /*" ",*/"_"}; //, "]", "[", ":"};
char name[30];
srand((unsigned)time(0));
cout << "Enter the number of realistic potential passwords to generate :>" << " ";
cin >> n;
cout << "Enter potential password length (1-10 chars) :>" << " ";
cin >> x;
cout << "Enter destination (entries without path save in local folder) :>";
cin >> name;
switch (x) {
case 1:
for(int i = 0; i < n; i++)
{
int r1Rand[1] = {(rand() % 36 +1)};
r1 = r1Rand[0];
string pout[1] = {c[r1]};
string k[1] = {pout[0]};
cout << k[0] << " " << i << "\n";
ofstream output (name, ios::app);
output << k[0] << " " << "\n";
}
break;
case 2:
for(int i = 0; i < n; i++)
{
int r1Rand[2] = {(rand() % 36 +1), (rand() % 36 +1)};
r1 = r1Rand[0];
r2 = r1Rand[1];
string pout[2] = {c[r1], c[r2]};
string k[2] = {pout[0], pout[1]};
cout << k[0] << k[1] << " " << i << "\n";
ofstream output (name, ios::app);
output << k[0] << k[1] << " " << "\n";
}
break;
default: cout << "value unknown";
}
system("PAUSE");
return 0;
}
|