Question: Modify the script so that it cracks all the shadow files in a single run of the program. I need some help with how to

Modify the script so that it cracks all the shadow files in a single run of the program.
I need some help with how to modify this code to read 3 additional files called shadow2, shadow3, and shadow4. Can someone help with that?
import hashlib import time Open the files in read mode shadow = open('shadowl', 'shadow2', 'shadow3', 'shadow4', 'r') dictionary = open('dictionary.txt', 'r') start = time.time() #Loop through all lines in the shadow file for line in shadow: #Split username:MD5hash the line using the "." delimiter entry = line.split(':',1) #The first item in the list of split values is the username #We also strip the values of any invisible characters #in the beginning or end using the strip() function user = entry[0].strip() #The hash value is the next hash = entry[1].strip) #Reset the dictionary file cursor to the start of the file dictionary.seek(0,0) #For each line in the shadow file loop #through all lines in the dictionary for word in dictionary: #For each line in the shadow file loop through all lines in the #dictionary and salt values from Oxoo to OxFF for i in range (256): salt = chr(i) password = word.strip() saltedpassword = salt + password #We initialize the MD5 hashlib object in the loop so that #it reinitializes every time, clearing its contents x = hashlib.md5() #Compute the digest X.update(saltedpassword) #if the generated hash matches the shadow hast --> Success! if (x.hexdigest() == hash): print '{}: {}:{}'.format(user, i, password) print 'Time taken:{}seconds'.format(time. time() -start)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
