Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose I wanted to have this script run through more than one shadow file, what would the code look like? So it would go through/open

Suppose I wanted to have this script run through more than one shadow file, what would the code look like? So it would go through/open shadow one then shadow 2 etc....

I have 3 files total. Shadow1-3

image text in transcribed

import hashLib #Open the files in read mode shadowopen('shadow1', 'r') dictionary = openCdictionary.txt', 'r') #Loop through all lines in the shadow file for line in shadow: #Split username:MDShash 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].stripO) #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 0x00 to 0xFF 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.md50 #Compute the digest x.update(saltedpassword) #if the generated hash matches the shadow hash --> Success! if (x.hexdigest() == hash): print '::.format(user, i, password

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

More Books

Students also viewed these Databases questions

Question

Recognize the four core purposes service environments fulfill.

Answered: 1 week ago

Question

Know the three main dimensions of the service environment.

Answered: 1 week ago