Share your repls and programming experiences

← Back to all posts
Brute Force Password Cracker
[deleted]

This code tries to use trial and error to find a password. However, it takes very, very long even to find abc123. Still, it's cool. Any suggestions?

Commentshotnewtop
Codemonkey51 (803)

PANIK my passwords are under siege!!!!

aerodynamicar (1)

nooooo I'm hacked!!!!!!

jaddison06 (0)

instead of str(input('What is your password?'))
import getpass
pas = getpass.getpass(prompt='What is your password?')

[deleted]

Thank you, I will try [email protected]

StudentFires (341)

As someone who isn't familiar with Python, can you explain what itertools.product(chars, repeat = password_length) does or means?

I'm transpiling this code to JavaScript, then to C++.
https://repl.it/@StudentFires/Trial-and-Error-Password-Cracker

[deleted]

@StudentFires , This code assigns using the itertools function to give a number to each letter so that it can be correctly encoded with the key.

StudentFires (341)

@hendryxu No, I know that, but what does the function do? Can you explain it without (or with minimal) code?

[deleted]

It gives a number to each letter in the string that you input. This command is in a loop, so for every letter of the phrase that you input, it will assign a number to each letter. @StudentFires

[deleted]

Well, it just repeats the loop, trying out new combinations until it gets the correct one @StudentFires

[deleted]

It doesn't stop...
But it's cool

DannyIsCoding (523)

My code broke after 19.120.609 , lol

DannyIsCoding (523)

WOAH! This code is amazing! More amazing is the fact that it's only 26 lines long

tsana (47)

Really nice.Good job

AidanCashman (3)

This might sound a little weird, but how would you edit the code to work if the password was unknown to the user

[deleted]

I cannot seem to check whether my string is in the file commonpass, so can anyone help me?

HenryCommandeur (2)

Traceback (most recent call last):
File "main.py", line 5, in <module>
with open ('commonpass.txt','r') as f_open:
FileNotFoundError: [Errno 2] No such file or directory: 'commonpass.txt'

KeyboardInterrupt
That's exactly what it says for me now.

[deleted]

NOTE: I understand there is an error, and I will fix it. please be patient and do not spam with error comments

KobeFF (416)

Um... there's an error... It wont work:

I want to thank ChezCoder for giving me the list of common passwords so I can speed up the process
What is your password? kobeni199

Right? and then it says this...

Traceback (most recent call last): File "main.py", line 35, in <module> print(guess_password(pas)) File "main.py", line 20, in guess_password for guess in myfile.product(chars, repeat = password_length): AttributeError: '_io.TextIOWrapper' object has no attribute 'product'

[deleted]

I know, I am trying to fix [email protected]

KobeFF (416)

@hendryxu Oh sorry, I didn't know. I didn't mean to upset you... 😅

[deleted]

its OK. Its just that i've gotten many of these error messages. @KobeFF

KobeFF (416)

@hendryxu Lol Oof 😂... I would help you but I don't know Python! 😝

[deleted]

Its OK. I'm very near to finishing my [email protected]

Bookie0 (3285)

Also I found one with exactly same name... suspicious

[deleted]

if you check that code, it is completly different
@Bookie0

Bookie0 (3285)

Oh ok cool! I believe you! Sorry for doubting you, must be just a mere coincidence! 😊 @hendryxu

[deleted]

:) I was doing my ciphers, and I thought that it would be cool to expand on the idea of password cracking.
@Bookie0

Bookie0 (3285)

But I’ll still give it an upvote!

Bookie0 (3285)

How did it find it so fast? Like I tried many different complex random passwords..., and it only took none guesses.

[deleted]

Yes, that is a bad problem, I am trying to fix it, please be patient. :)@Bookie0

[deleted]

Thank you for understanding! @Bookie0

CodeLongAndPros (963)

I would use fuzzy string matching to give a guess if it is not found.

[deleted]

ok, I will do [email protected]

[deleted]

What did the error say? @HenryCommandeur

HenryCommandeur (2)

It said that there was an error on line 11 and one minute ago it said Repl.it process died unexpectedly @hendryxu

[deleted]

Oh yes, I will fix that, [email protected]

[deleted]

Ok, I have fixed it
@HenryCommandeur

[deleted]

ok, I will check and debug, @HenryCommandeur

ChezCoder (1484)

Recommendation to speed up the process, compile a file with 10,000 top most common password. Need help with that? Get it from here: https://repl.it/@ChezCoder/Password-Strength-Tester Go to the file called commonPasswords.txt

[deleted]

@ChezCoder Thank you very much, I will give you credit for this in my program!

CodingCactus (2824)

can you make it so that we can input a password pls

[deleted]

@CodingCactus OK, but you could just change the parameter in this:print(guess_password('abc'))

[deleted]

OK I made it so you can [email protected]

CodingCactus (2824)

@hendryxu i would have to fork it :(

[deleted]

@CodingCactus I changed it again

[deleted]

Its this now:
pas = str(input('What is your password? '))
print(guess_password(pas))
@CodingCactus