c++ brute-force password cracking algorithm.. | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

c++ brute-force password cracking algorithm..

I want to make a simple brute-force password app that can crack a password with 5 to 7 length and also works with letters+numbers password..but I completely have no idea what to do with cracking the characters in the password..only know the password with numbers only..This is my unfinished code.. #include <iostream> using namespace std; int main() { int password; cout << "Enter a password to bruteforce.. : "; cin >> password; for (int i = 0; i < 999999; i++) { if (i == password) { cout << "The brute-forced password is = " << i << endl; break; } cout << "Loading..[" << i << "]\n"; } return 0; } but this will only crack a password with length of 6 since i set the condition in for loop 999999.. Need someone to explain and also teach me how to make the code..i don't care if the brute-force takes too long to crack a longer password.. I just want to know how it works.. :) :)

16th Dec 2016, 12:32 AM
Fluffy Rabbit
Fluffy Rabbit - avatar
19 Respuestas
+ 1
maybe you can use ASCII code. Where each char represent a number. refer to ASCII table, c++ ascii
16th Dec 2016, 12:49 AM
Nahuel
Nahuel - avatar
+ 1
Passwords are usually strings. To simply bruteforce the password you should iterate through all the characters. Assuming you have only letters a, b, you want the code to test: aaa aab aba abb baa bab bba bbb When the last position checks the whole range, you increment the last but one, when you check all options for last but one, increment the last but two and so on until all combinations are checked. Then you increment the length and start over. Since nesting *length* for loops is a bad idea you need another way to iterate. I'd suggest having a string with the current password in memory. After checking you increment the last character and check if it's out of range. If it is not, check the password, if it is, assign it to the first character in range and increment the lust but one and so on. When the first character is out of range, you've checked every combination for the current length. I'd suggest lengths below 5 characters because of rather high amount of combinations :)
16th Dec 2016, 2:05 AM
vtepe
vtepe - avatar
+ 1
strings should work like arrays, you should be able to access individual characters of string s using s[index] where index is a position. characters are of type char, and what their values correspond to is in the ASCII table as was said before. you can compare them and you can += them. good luck ;)
16th Dec 2016, 10:13 AM
vtepe
vtepe - avatar
0
I just don't know what code that can handle the string passwords..like if it found a same character in a string as the password..it will pop out from the variable and assign the value to the other variable..and then start loop back but without the popped out character..and if found a same character in..and so on don't know how to make the pop out thing..or there is another ways to code??
16th Dec 2016, 2:38 AM
Fluffy Rabbit
Fluffy Rabbit - avatar
0
Sorry, my previous post might have misled you, but nice idea with listing the available alphabet. Actually "sting alphabets[26]" will produce an array of 26 strings where you need just one :) Your loop iterates through all of the strings in the "alphabets", once. And the conditional tests if it is the first letter of password. If it is then it concatenates bruted and i-th string in "alphabets" and stores it in "bruted". I'll sugest just altering characters in "bruted". I'll give you a piece of code and leave the fun part for you to fill :) #include <iostream> #include <string> using namespace std; //main int main() { //declarations bool finished = false; bool found = false; string alphabets = "abcdefghijklmnopqrstuvwxyz"; string bruted = "zzzz"; //because we want to iterate first in the loop and check password later, so the first checked will be "aaaa" string password; //get password from the user cout << "Enter a 4 letter password: "; cin >> password; //loop while the password is not found and there are remaining combinations while (!(finished || found)) { //TODO: find next "bruted" value to check //TODO: check if "bruted" is the password and set "found" //TODO: check if it is a last possible option and set "finished" }//while //output findings if (found) { cout << "The password is: " << endl; } else if (finished) { cout << "No 4 character password found" << endl; } else { cout << "This line should never happen" << endl; }//if }//main
17th Dec 2016, 6:21 PM
vtepe
vtepe - avatar
0
I just finished writing one for 2-6 characters in length, and it can be adapted to more characters, but I kept it at 6 due to how long it may take to run at anything more than that. You can check it out on my profile.
19th Dec 2016, 3:32 AM
scott johnson
scott johnson - avatar
0
The two ciphertext’s below were created by either a shift cipher and/or Vigenere cipher. You are to break the ciphers by recovering the key used on each case. Ciphertext A LLGXOGTMWKOBNAEOIZLNGXIGCAUUENWKAXOGSIJDGZTLWCEVEHSCIPVOFRQFMAUUIA OHWZCGOOOXPVDLGKLJSEJOPREHGEOUEILGIFEHWLMFEMSNMNSOEOQAEHWGQYOEJX MFDHWLCVWTSMIOTNSXLNHIFDMEDTGBMNYDZOXYZWWNCCEHWQZBFNVLGGSEUYTQW ACOAUZRWKVQEHWYBUPRLBIIPLWBAPLMWGIYVIFQLBHNLRMGCAUUIAOTZOGAPVWBER YTXEZGSEJXWGSEQXMIPROOVGMAUUBUPNUKUREHWMPHC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VRGEJIZROLAQPGZNEOUBCYDKVRTVWCMRYDWCXRCALSWAPXHVWQP IFDWSWAEOANYDANWAEWSXBGZSWOQGLGSSVSCOEKTYZFLRMFPSAQVFDAQSVTDOJBG OFTOOZRNLGCMQLLDDPRHAQNWJYTZOBRWEYBICSRGKL
18th Jul 2020, 1:48 PM
Thabo T Motlhagodi
Thabo T Motlhagodi - avatar
0
help me with code to generate passwords with brute force . Use a Java program to guess the passwords of Moodle users. This is a brute-force attack. Each group should choose a group leader who in turn will email me to get a list of usernames whose accounts are to be compromised by guessing the account password. Typically passwords have the following characteristics: 1. It is either a 6 digit password or 2. 6 lowercase characters or 3. 6 lowercase/uppercase characters or 4. 6 lowercase/uppercase/digit characters or 5. 8 lowercase characters or 6. 8 lowercase/uppercase characters or 7. 8 lowercase/uppercase/digit characters or 8. 9 lowercase characters or Each group will have exactly 1 user using a password from each group. The users are given in another document included in the assignment folde
18th Jul 2020, 1:49 PM
Thabo T Motlhagodi
Thabo T Motlhagodi - avatar
0
gvgvxsz
9th Mar 2023, 8:50 PM
Andy Sacalxot Peruch
Andy Sacalxot Peruch - avatar
0
help me
9th Mar 2023, 8:50 PM
Andy Sacalxot Peruch
Andy Sacalxot Peruch - avatar
0
Instagram password hack
20th Jul 2023, 3:23 PM
Rashik Machhi
Rashik Machhi - avatar
0
Gujugril_
20th Jul 2023, 3:24 PM
Rashik Machhi
Rashik Machhi - avatar
0
Gujugril_ password hack
20th Jul 2023, 3:24 PM
Rashik Machhi
Rashik Machhi - avatar
0
Is it work ?
4th Jan 2024, 12:53 PM
Hizza 4700
Hizza 4700 - avatar
0
Please unlock my Mobile
5th Apr 2024, 7:10 AM
Mr Crazy
Mr Crazy - avatar
0
#include <iostream> using namespace std; int main() { int password; cout << "Enter a password to bruteforce.. : "; cin >> password; // ō™ōĶō≠ŘĆō≠: ŔÖō≠ōĮŔąōĮŔá ō®ōĪōĪō≥ŘĆ ōĪōß ō™ōß ōĻōĮōĮ ŔąōßōĪōĮ ōīōĮŔá ō™Ŕąō≥ō∑ ŕ©ōßōĪō®ōĪ ō™ōļŘĆŘĆōĪ ŔÖŘĆ‚ÄĆōĮŔáŘĆŔÖ for (int i = 0; i <= password; i++) { if (i == password) { cout << "The brute-forced password is = " << i << endl; break; } cout << "Loading..[" << i << "]\n"; } return 0; }
20th Apr 2024, 4:17 AM
joker Mobarez
joker Mobarez - avatar
0
"These changes make the loop execute up to the number entered by the user and prevent infinite execution."
20th Apr 2024, 4:21 AM
joker Mobarez
joker Mobarez - avatar
0
// Define a list of possible passwords var passwords = ["password123", "qwerty", "letmein", "monkey", "12345678"]; // Define the password to be cracked var targetPassword = "qwerty"; // Loop through the list of passwords and try to guess the target password for (var i = 0; i < passwords.length; i++) { if (passwords[i] === targetPassword) { console.log("Password found: " + targetPassword); break; } }
28th May 2024, 3:10 AM
Kumar Shivam
Kumar Shivam - avatar
- 2
It will be too slow unless you have a super computer
9th Oct 2017, 9:27 AM
John Ray