4.6 DICTIONARY ATTACKS

EXERCISE 4.6: DICTIONARY ATTACKS

It should be pretty clear that it will take longer than your probable attention span to try all possible lowercase ASCII words of length much greather than four or five. But we already saw this same problem in previous chapters. Let’s try the same solutions. Modify your brute-force program to take a dictionary as input for trying arbirary English words.


We just have to change the generate function inside of ex4_4.py (look at solution of Exercise 4.4).

The following might be a good replacement:

def generate(dictionary_path: str): 
    with open(dictionary_path, 'r') as f: 
        for single_line in f: 
            yield single_line
    return