PW Crack 5


Description


Can you crack the password to get the flag?Download the password checker here and you’ll need the encrypted flag and the hash in the same directory too. Here’s a dictionary with all possible passwords based on the password conventions we’ve seen so far.

Hints


Step(s)


This is very similar to PW Crack 4 the main difference being where the possible passwords are stored. The potential passwords are stored in their own file called dictionary.txt. We will once again be editing the password checker file (you can make this into a separate python script). First we need to bring in the dictionary file by adding the line

dict = open('dictionary.txt','r').readlines()

the ‘r’ puts the file in readmode and readlines will return every line as a new item in a list. The function will be almost identical to the one in PW Crack 4 with the exception of using .strip() to ensure there is no leading or trailing characters.

def level_5_pw_check():
    for user_pw in dict:
        user_pw = user_pw.strip()
        user_pw_hash = hash_pw(user_pw)
        if(user_pw_hash == correct_pw_hash):
             print("Welcome back... your flag, user:")
             decryption = str_xor(flag_enc.decode(), user_pw)
             print(decryption)
             return

Flag