Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I create a brute-force method using the alphabet

I want to create a bruteforcing method using the alphabet.

For example :

x = input("What is your password ?")
length = len(x)

Then the program will check every single combination alphabettically like:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

aa,ab,ac,ad and so on.

I have tried one method like:

for c in printable:
    r = c
    status = r
    for c in printable:
        r = (f"{status}{c}")

And this method breaks in the 3rd loop.

Is there a way I can do this?

>Solution :

you can use itertools module of python.

import itertools
import string

length = N

for combinaison in itertools.product(string.ascii_lowercase, repeat=length):
    print(''.join(combinaison ))
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading