Reputation: 1
I am trying to try and program a bruteforce attack using all the letters in the alphabet and numbers from 0-9.
I have used string permutation which allows me to generate all combinations possible from characters in a string. e.g abc would give me abc, acb, bca.. etc. I have a problem though as it displays a line of 36 characters. I am able to resize the strings so it outputs in 5, 10 and 15 character lines, but some of my string characters (mainly starting from abcde...etc) are missing. I want it to generate all the characters and numbers in the string, not just a chunk of them so when it generates the combinations on the console window it will use every character in the string. Does anyone know why it only outputs a chunk of characters rather than all of them? Especially the length 5 string, which only prints out numbers, 10 printing z and numbers and 15 printing from u-z and numbers. Here is what comes up on the console window:
class Attack
{
public:
string username;
string password;
int x;
string wordonlist;
string combinations;
};
void BruteforceAtt()
{
Attack bruteforce;
bruteforce.combinations = "abcdefghijklmnopqrstuvwxyz123456789";
cout<<"BruteForce Attack is a go..."<<endl;
cout<<"Searching..."<<endl;
cout<<""<<endl;
{
cout<<bruteforce.combinations.substr(bruteforce.combinations.length() - 5)<<endl;
cout<<bruteforce.combinations.substr(bruteforce.combinations.length() - 10)<<endl;
cout<<bruteforce.combinations.substr(bruteforce.combinations.length() - 15)<<endl;
} while (next_permutation(bruteforce.combinations.begin(), bruteforce.combinations.end()));
system("Pause");
};
Upvotes: 0
Views: 123
Reputation: 70929
next_combination
expects the input to be sorted in order to iterate over all permutations and your input is not sorted - 1
is before a
in terms of ASCII code. Also note that even if you fix your code you will have to perform 36!
steps which is enormous(371993326789901217467999448150835200000000
) - even on the fastest computer up to date this will take more than the universe is supposed to live by far.
Upvotes: 1