This is my first ever how-to so I apologize in advance for any grammar mistakes or spelling errors.
This is what I'm planning on being a series of c++ coding articles. This one in particular are gonna be a series of programs for various password cracking methods. Mind you, if you are gonna be a script kiddie please at least try to bother learning the language.
Obviously all programs don't just pop out of the air, but take time to plan what's gonna be in the final product.
- Be able to allow the user to input a hash
- Be able to allow the user to input a text file for dictionary attack
- Be able to take each word in text file and compare to the hash
- Be able to tell the user which password matches with the hash
I should mind you that this type of attack requires a rainbow table like file.
So now we must do actual code:
char string inHash()
char string passHash
cout << "Enter in the password hash: \n" <<
cin >> passHash >>
Firstly we must be able to allow to type any hash that we please and store that hash in a variable for future reference. The 'char string inHash()' is pretty much separating this part of the code from the rest so that we may concentrate on this part individually. Pretty simple, eh?
Now the main big part of the code:
cout << "Enter in File: \n" <<
cin >> fileName >>
Obviously for all you educated in this programming language you can tell what I'm doing here. ifstream is part of a declaration that I haven't bothered to mention until now
These are all the declarations that is part of this program and should be at the top before the rest of the code.
Ok so now since we got the file saved in a variable we must now be able to read and compare the contents of the file to the hash right?
int nLine = 1
getline (fileName, line nline);
While nLine != passHash
nNewline = nLine + 1
nLine = nNewline
getline (fileName, line nNewline);
I've actually used a simple equation to check each line by line. The 'getline(fileName, line nNewline);' is where the program takes each line that equals to the equation 'nNewline = nLine + 1' and compares that line to the hash. The while loop was the best option for this type of method, thus this program continues until nLine = passHash.
cout << "The password is: \n" <<
<< passHash "=" nLline <<
cout << "Press Enter to exit" <<
Of course we needed to finish the program up in a nice and tidy way and thus if you can't flatly see, pretty much the program tells what the password is.
Please leave your comments down below and give me some loveins. I would gladly take any ways to improve in both my how-to's and my coding. Finally, feel free to test this code out and edit the code as you like. :D
The link to the full code is down below, mind you that I did add my own little gizmo to the code, but here it is:
Oh, I didn't test the code out ;)
Want to start making money as a white hat hacker? Jump start your White-Hat Hacking career with our 2020 Premium Ethical Hacking Certification Training Bundle from the new Null Byte Shop and get over 60 hours of training from Ethical Hacking Professionals.