Need help? We are here

Write a Python script to perform a dictionary attack on


  1. Write a Python script to perform a dictionary attack on a Linux password file.
    1. Copy /etc/shadow file to your local directory. Study the format of this file.
    2. Add the following 3 lines to the /etc/shadow file. For speed purposes remove all other lines.




  1. Use the “crypt” library crypt function to create your hash.
  2. Use the “hmac” library compare_hash function to compare hashes from the /etc/shadow file to the hashes produced from your guesses.
  3. Use the string split() function to separate the separate the password lines from the shadow file by the ‘:’ delimiter to isolate the userid and the hash from an entry in the shadow file.
  4. Calculate the appropriate hash (using the method specified for the entry from the shadow file) for each word in this wordlist ( (Links to an external site.)), compare the hash, and stop comparing when you find a match.
  5. Attempt the dictionary attack for each entry in the shadow file.
  6. Remember you need to provide the word from the dictionary, the method, and the salt to the crypt() function.
  7. Print the userid and password when a match is found:
    “Match found for userid [userid]. Password = [password]”
  8. Print the “No match was found for [userid]” when there no match in the dictionary.

UPDATE: Your program should run with the following command line:

>> python3 [shadow filename] [dictionary filename]

Source link

Table of Contents

Calculate your order
Pages (275 words)
Standard price: $0.00

Latest Reviews

Impressed with the sample above? Wait there is more

Related Questions

The role of the family

Read chapter 11 of the class textbook and review the attached PowerPoint presentation.  Once done work on the following exercises; Write a  summary on the

Modification of plan of care

Pharmacokinetics and Pharmacodynamics effects on patients Pharmacokinetics is the study of drug movement throughout the body, which includes absorption, distribution, metabolism, and excretion of the

New questions

Don't Let Questions or Concerns Hold You Back - Make a Free Inquiry Now!