diff --git a/Protecting_Passwords/intelburn_check_recovered.py b/Protecting_Passwords/intelburn_check_recovered.py new file mode 100644 index 0000000..03ee82e --- /dev/null +++ b/Protecting_Passwords/intelburn_check_recovered.py @@ -0,0 +1,26 @@ +#This was created by intelburn for a Code With Me challenge +#Open the file with all of the recovered hashes +with open("recovered_password_hashes.txt", "r") as hashes: + #Open the csv formatted rainbow table + with open("rainbow_table.txt", "r") as rainbow: + #create a dict for all of the hashes and paintext passwords + solutions={} + #loop through the lines in the rainbow table + for line in rainbow.readlines(): + #make an array of the line with the hash in position 0 and the plaintext in position 1 + #remove any trailing newlines + entry=line.rstrip().split(",") + #add the array to the dict + solutions[entry[0]]=entry[1] + #loop through the lines in the recovered passwords + for line in hashes.readlines(): + #Remove the trailing newline from the recovered password hash + password=line.rstrip() + #check if the recovered hash is in the rainbow table + if password in solutions: + #print the hash and plaintext + print(password+" "+solutions[password]) + #No match found + else: + #print that there is no match + print("Hash {0} not in table".format(password)) diff --git a/Protecting_Passwords/intelburn_rainbow_table.py b/Protecting_Passwords/intelburn_rainbow_table.py new file mode 100644 index 0000000..7a48480 --- /dev/null +++ b/Protecting_Passwords/intelburn_rainbow_table.py @@ -0,0 +1,17 @@ +#This was created by intelburn for a Code With Me challenge +#Import HashLib for the MD5 hashing capability +import hashlib +#open the dictionary file +with open("plaintext_passwords.txt", "r") as candidates: + #Open the file for the future rainbow table + with open("rainbow_table.txt", "w") as rainbow: + #Loop through the lines in dictionary + for line in candidates.readlines(): + #This line does multiple things in one line the next comments will go into the what the line is doing + #First rainbow.write will write the contents of the argument into the file + #hashlib.md5 will calculate the contents on the argument + #line.rstrip() will remove the trailing newline + #.encode() will encode the line for hashlib.md5 + #.hexdigest returns the human readable version of the hash + #Then append a , and the content of the line from the plaintext + rainbow.write(hashlib.md5(line.rstrip().encode()).hexdigest()+","+line)