Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Facebook 'Word Challenge' Brute Forcer


devilsson2010's Avatar
Member
0 0

There is an app on facebook called 'Word Challenge', which is a very common game where it gives you letters then you type in all words you can think of that use those letters. Example:

gives you the letters HRATLM

You can enter HAT, RAT, MAT, etc… It takes 3, 4, 5, and 6 letter words.

Anyway, it seemed like a somewhat easy task to make a brute forcer for it that just emulates the keys for every word using the 6 letters given. It works but it goes too fast and sometimes words get overlapped because it didn't emulate the enter key, or it will miss a letter and mess up the word all together.

So if anyone has any advice on how to make it better, more efficient, or to speed it up more, please share, thanks!

I was using the Sleep() function to slow it down for 1/1000th of a second, which worked really well, but then the timer runs out because the 6 letter words take a whole minute to do without even pausing.

#include <iostream>
#include <windows.h>

using namespace std;


void Title()
{
printf("Facebook Word Challenge Brute Forcer\n\n" );
}


void Instructions()
{
printf("To use:\n1) Enter the 6 letters it gives you (no spaces, not case sensitive)\n2) After hitting ENTER you have 5 seconds to make Word Challenge the active\n   window by clicking in it\n\nONCE THE PROGRAM HAS STARTED RUNNING DO NOT AT ANYTIME CLICK OUTSIDE OF WORD\nCHALLENGE UNTIL THE PROGRAM HAS FINISHED, YOU HAVE BEEN WARNED!!\n\nPlease Enter the 6 Letters\n: " );
}


void Countdown(int time)
{
for (int i=time;i>=0;i--)
{cout << i << endl;
Sleep(1000);}
}


int main()
{

Title();
Instructions();

char keys[6];

cin >> keys;
cout << endl;

Countdown(5);
system("cls" );
Title();
cout << "Using Keys: " << keys << endl << endl;
printf("Creating 3 letter words . . .\n" );

int a=0, b=0, c=0, d=0, e=0, f=0;
while (true)
{
keybd_event(VkKeyScan(keys[a]),0,0,0);
Sleep(5);
keybd_event(VkKeyScan(keys[b]),0,0,0);
Sleep(5);
keybd_event(VkKeyScan(keys[c]),0,0,0);
Sleep(5);
keybd_event(VK_RETURN,0,0,0);
Sleep(5);

if (a==5 && b==5 && c==5)
{break;
} else if (b==5 && c==5)
{a++; b=0; c=0;
} else if (c==5)
{b++; c=0;
} else {c++;}

}

printf("Done with 3 letter words.\n" );
printf("Creating 4 letter words . . .\n" );

a=0; b=0; c=0;
while (true)
{
keybd_event(VkKeyScan(keys[a]),0,0,0);
Sleep(5);
keybd_event(VkKeyScan(keys[b]),0,0,0);
Sleep(5);
keybd_event(VkKeyScan(keys[c]),0,0,0);
Sleep(5);
keybd_event(VkKeyScan(keys[d]),0,0,0);
Sleep(5);
keybd_event(VK_RETURN,0,0,0);
Sleep(5);

if (a==5 && b==5 && c==5 && d==5)
{break;
} else if (b==5 && c==5 && d==5)
{a++; b=0; c=0; d=0;
} else if (c==5 && d==5)
{b++; c=0; d=0;
} else if (d==5)
{c++; d=0;
} else {d++;}

}

printf("Done with 4 letter words.\n" );
printf("Creating 5 letter words . . .\n" );

a=0; b=0; c=0; d=0;
while (true)
{
keybd_event(VkKeyScan(keys[a]),0,0,0);
Sleep(1);
keybd_event(VkKeyScan(keys[b]),0,0,0);
Sleep(1);
keybd_event(VkKeyScan(keys[c]),0,0,0);
Sleep(1);
keybd_event(VkKeyScan(keys[d]),0,0,0);
Sleep(1);
keybd_event(VkKeyScan(keys[e]),0,0,0);
Sleep(1);
keybd_event(VK_RETURN,0,0,0);
Sleep(1);

if (a==5 && b==5 && c==5 && d==5 && e==5)
{break;
} else if (b==5 && c==5 && d==5 && e==5)
{a++; b=0; c=0; d=0; e=0;
} else if (c==5 && d==5 && e==5)
{b++; c=0; d=0; e=0;
} else if (d==5 && e==5)
{c++; d=0; e=0;
} else if (e==5)
{d++; e=0;
} else {e++;}

}

printf("Done with 5 letter words.\n" );
printf("Creating 6 letter words . . .\n" );

a=0; b=0; c=0; d=0, e=0;
while (true)
{
keybd_event(VkKeyScan(keys[a]),0,0,0);
Sleep(1);
keybd_event(VkKeyScan(keys[b]),0,0,0);
Sleep(1);
keybd_event(VkKeyScan(keys[c]),0,0,0);
Sleep(1);
keybd_event(VkKeyScan(keys[d]),0,0,0);
Sleep(1);
keybd_event(VkKeyScan(keys[e]),0,0,0);
Sleep(1);
keybd_event(VkKeyScan(keys[f]),0,0,0);
Sleep(1);
keybd_event(VK_RETURN,0,0,0);
Sleep(1);


if (a==5 && b==5 && c==5 && d==5 && e==5 && f==5)
{break;
} else if (b==5 && c==5 && d==5 && e==5 && f==5)
{a++; b=0; c=0; d=0; e=0; f=0;
} else if (c==5 && d==5 && e==5 && f==5)
{b++; c=0; d=0; e=0; f=0;
} else if (d==5 && e==5 && f==5)
{c++; d=0; e=0; f=0;
} else if (e==5 && f==5)
{d++; e=0; f=0;
} else if (f==5)
{e++; f=0;
} else {f++;}

}

printf("Done with 6 letter words.\n" );
printf("\n* DONE *\n\n" );

system("PAUSE" );
return EXIT_SUCCESS;
}

ghost's Avatar
0 0

you could just use a wordlist, but then it wouldnt be a bruteforcer :P


devilsson2010's Avatar
Member
0 0

Yea I was thinking about using a word list because it'd be faster, but you can never get a good wordlist that has every word needed. There's always a couple missing.

Also it'd be pointless because 95% of the words wouldn't even be usable because it gives you 6 letters to use and that 95% of words will contain other characters.


ghost's Avatar
0 0

Why use C++ if you program (TI-)Basic style?


devilsson2010's Avatar
Member
0 0

Mephisto wrote: Why use C++ if you program (TI-)Basic style?

  1. I don't use (TI-)Basic style

  2. What the fuck is (TI-)Basic style?


ghost's Avatar
0 0

devilsson2010 wrote: Yea I was thinking about using a word list because it'd be faster, but you can never get a good wordlist that has every word needed. There's always a couple missing.

Also it'd be pointless because 95% of the words wouldn't even be usable because it gives you 6 letters to use and that 95% of words will contain other characters.

But the bruteforce is blatanly lower than that! it's like what 0.001-1% useable? And the game has to use some kind of dictionary, probably the official scrabble one. If you had that, the wordlist would be perfect.


devilsson2010's Avatar
Member
0 0

I was using a scrabble word list I got off of some scrabble site for 3 lettered words and the dictionary only had 3 of the 10 or however many words there are.