Since some people have asked for a bruteforcer source I decided to write a bruteforcer core. This generates all possible combinations with the specified length. Character set can be customized with the createCharSet function(a-z, A-Z, 0-9). The example usage in the main function demonstrates combinations with lengths 1-4 and a character set of a-z.
Code
#include <iostream>
#include <cstring>
void generator(char* charSet, unsigned char targetLength, char* buffer, unsigned char length);
char* createCharSet(bool charSet_az, bool charSet_AZ, bool charSet_09);
int main(void)
{
char* charSet = createCharSet(true, false, false);
char* buffer = new char[10];
memset(buffer, '\0', 10);
for (unsigned char i = 1; i <= 4; i++)
{
generator(charSet, i, buffer, 0);
}
delete [] charSet;
charSet = 0;
delete [] buffer;
buffer = 0;
std::cout << "DONE." << std::endl;
std::cin.sync();
std::cin.get();
return 0;
}
void generator(char* charSet, unsigned char targetLength, char* buffer, unsigned char length)
{
if (length == targetLength)
{
std::cout << buffer << std::endl;
}
else
{
for (unsigned char i = 0; i < 62; i++)
{
if (charSet[i] != '\0')
{
buffer[length] = charSet[i];
generator(charSet, targetLength, buffer, length + 1);
}
else
{
break;
}
}
}
}
char* createCharSet(bool charSet_az, bool charSet_AZ, bool charSet_09)
{
char* charSet = new char[62];
memset(charSet, '\0', 62);
unsigned char index = 0;
if (charSet_az)
{
for (char i = 'a'; i <= 'z'; i++)
{
charSet[index] = i;
index++;
}
}
if (charSet_AZ)
{
for (char i = 'A'; i <= 'Z'; i++)
{
charSet[index] = i;
index++;
}
}
if (charSet_09)
{
for (char i = '0'; i <= '9'; i++)
{
charSet[index] = i;
index++;
}
}
return charSet;
}