password cracker algorithm

Started by
13 comments, last by grhodes_at_work 18 years, 5 months ago
i have tried and failed at making one ( a brute forcer ) :( can someone give me some pointers please? ( i have made an array with possible characters ) BTW brute force. ( every possible password/combination )
-www.freewebs.com/tm1rbrt -> check out my gameboy emulator ( worklog updated regularly )
Advertisement
I believe you have a few ways you can go about doing this.

1) Brute force. Try every combination till one works.
2) Dictonary Hacking. Try every word till something works
3) Break the encryption on the file that stores the password (Good luck)

4) Intimidate or seduce the password owner into giving it to you.
5) stop with that crap since it's illegal to use it.
i dont plan on using it i just want to earn how to go about making all possible combinations. like:

"" - "0" - "1" ... "z" - "00" - "10" - "20" - "zzzz"
-www.freewebs.com/tm1rbrt -> check out my gameboy emulator ( worklog updated regularly )
It's not necessarily illegal to use it. Security auditing companies and consultants do it all the time. It is of course illegal to use this to break into someone else's computer but ot audit your own, not so much.
can what stop posting about whats legal and whats not that has nothing todo with what i asked for.

can we stay ontopic and post something helpful :) plz?
-www.freewebs.com/tm1rbrt -> check out my gameboy emulator ( worklog updated regularly )
Use ACII values. Chars are essentially ints right? use loops and a few condition statements to increment through the alphabet and all other characters in terms of an int. Typecast that int into a char.

for a one char password:

char[] temp;
for(int i = 32; i < 137; i++){
temp[0] = (char)(i);
//check if it's the password; if true, break, else continue
}

for two characters:

for(){
char[0] = (char)(i)
for{
char[1] = (char)(j)
// Check password
{
}

it's not complete code. I'm assuming you can fill in the blanks.
I haven't made any kinda password cracking code either but I'm assuming this is the same idea.
thanks KSops, but i have trouble trying to make this kind of code scaleable, so i can assign a number of characters.
-www.freewebs.com/tm1rbrt -> check out my gameboy emulator ( worklog updated regularly )
I'm going to code this right into the GameDev post textbox, so we'll see how it turns out...

void InitCombo(char **buf, int len){  //We'll store the null-terminated string  //followed by an array of indices into   //the list of legal characters.  *buf = new char[len+1+len];  //Zero out the string  memset(*buf, 0, len+1);  //And set all indices to -1 (==255)  memset((*buf)+len+1, -1, len);}bool NextCombo(char *buf, int len, char *legal){  //number of legal characters.  int legal_len = strlen(legal);  //beginning of our index array.  char *idx = buf+len+1;  while(true)  {    (*idx)++;//increment the current digit's index.        if((*idx) >= legal_len)    {      //We've rolled over this digit.  Reset it to 0      //and go to the next digit.      *idx = 0;      idx++;      //If we've rolled over the last digit, return      //false (no more combos).      if(idx-buf >= len+1+len)        return(false);    }    else //This digit didn't roll over, so exit this loop.      break;  }  //Now that the indices are correctly updated,  //update actual string to represent the indices.  idx = buf+len+1;  for(int i = 0; i < len; i++)    if(idx != -1)      buf = legal[idx];  return(true);}void ReleaseCombo(char *buf){  delete [] buf;}//Then in your code:int main(){  char *buf;  char *legal="abcdefghijklmnopqrstuvwxyz0123456789";  //Get every possible combination up to 15 characters long.  InitCombo(&buf, 15);  while(NextCombo(buf, 15, legal))  {    cout << buf << '\n';  }  ReleaseCombo(buf);  return(0);}


Does that work? It turned out to be a little more code than I'd expected... Okay, I tested in in Visual C++. I should get a medal--it worked on the first compile :-)

A warning: This is VERY SLOW. This is a very fast implementation (it could be optimized in a few spots still), but it still takes a good long while (minutes to hours) to get up to 15 characters. Hopefully the target password is short. This algorithm checks the short ones first.

Hope you're using C++ :-) This isn't very easy code to port to VB or something.



~BenDilts( void );

This topic is closed to new replies.

Advertisement