CHALLENGE: Write a Brute force code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 13

CHALLENGE: Write a Brute force code

Brute force is a trial and error method used to crack passwords. Brute force cracking uses every possible combination of letters, numbers and symbols at every possible lengths to crack the password. Challenge: Write a code that uses the Brute force method to crack a password that has a length of more than 2 characters . Your code must include: • a variable that contains the password • an array of symbols,letters and numbers • a function that will combine all the values from the array to find the password

27th Dec 2017, 10:09 AM
Undertaker
Undertaker - avatar
13 Answers
+ 8
@MrCoder, yes, I totally agree with you, the given code is just an incomplete example due to SL limitations.. Do you have some fully working program? Share it with us! :)
2nd Jan 2018, 6:47 AM
noobcøder
noobcøder - avatar
+ 7
I have not written my own one (yet), but just the other day I found this video. https://youtu.be/0PM10vOtd6o It explains how bruteforce works and I learned a lot from it (It is in java, just like the code of @thex).
28th Dec 2017, 3:57 PM
The Coding Sloth
The Coding Sloth - avatar
+ 6
Another example, this one cracks SHA1 hashes... https://code.sololearn.com/cpZmxS2B8657/#py
29th Dec 2017, 2:13 AM
noobcøder
noobcøder - avatar
+ 6
@MrCoder Thanks for sharing! Here is a little program I wrote some time ago, it uses brute force algorithm to create lists of passwords or dictionaries (like Hashcat does, but easier to use): https://bitbucket.org/ksaver/kranky/src/45d3d1b53e878dc5a7729b34f3745254df7823f2/src/kranky.py
2nd Jan 2018, 7:27 AM
noobcøder
noobcøder - avatar
+ 5
Here is an example code written in Python: https://code.sololearn.com/cd8Y1zz4Qkg5/#py Due to SoloLearn Time Limits, charset contains a limited set of characters, but in your Python interpreter you can try it with some larger samples..
28th Dec 2017, 5:19 AM
noobcøder
noobcøder - avatar
+ 5
How about this :P. Written in Java. https://code.sololearn.com/cdB72Z8jCETo but not working well in playground with many places because of memory limit ;) -------------- Ad: In the meantime I also created a recursive version. Here the link to both projects on Github I uploaded the iterative and the recursive. The iterative is the same like the one I uploaded to Codelearn. https://github.com/thexmanxyz/kata-bruteforce-iterative https://github.com/thexmanxyz/kata-bruteforce-recursive
10th Jan 2018, 12:40 PM
thex
thex - avatar
+ 4
Just giving this info what a REAL Brute Force is Your code must never use the password, You can't use its length and contents in the code. Also it is like aaa aab aac ... aaz aba
2nd Jan 2018, 6:39 AM
MrCoder
MrCoder - avatar
+ 4
You sure do use your own algorithm :) It's nice, my code is shortened because of .next! function in rb
2nd Jan 2018, 7:29 AM
MrCoder
MrCoder - avatar
+ 3
my try...with automatic key length setter... https://code.sololearn.com/c3vprJdNVDJY/?ref=app
28th Dec 2017, 5:21 PM
OR!ON 🛡️
OR!ON 🛡️ - avatar
+ 3
Enjoyed this, thanks. Not the most pythonic and there's at least one too many variables being passed to the sub https://code.sololearn.com/c1lsvj0olzJF/?ref=app
28th Dec 2017, 7:23 PM
Brian F
Brian F - avatar
+ 3
Thank you :), Yes I do have a brute force software I'm afraid it lacks some feature, I'll put it in github then I'll put the link :D
2nd Jan 2018, 6:49 AM
MrCoder
MrCoder - avatar
+ 3
@noobcøder Here you go buddy https://github.com/Z34O/brute-force
2nd Jan 2018, 6:59 AM
MrCoder
MrCoder - avatar
+ 2
@The Coding Sloth, that's a nice recursive solution mine is just iterative :). I watched the video right now. I will try that one later.
28th Dec 2017, 4:17 PM
thex
thex - avatar