Question

In: Computer Science

•Write a Write a Python script that performs brute force to extract a password protected zip...

•Write a Write a Python script that performs brute force to extract a password protected zip file named sec3.zip. The password is believed to be associated with one of the dictionary words in the 'wordlist.txt file. The password policy enforces that all employees MUST use passwords that include at least one capital and one digit. The files are attached (hint must import zipfile)

Solutions

Expert Solution

Code test with Python 3.6.9 in Linux operating system.

Code

import zipfile

zip_file = zipfile.ZipFile('./sec3.zip')
found = False

with open('./wordlist.txt', "rb") as wordlist:
  words_count = len(list(wordlist))
  print("Total no. of passwords to try:", words_count)
  wordlist.seek(0)
  for current_word in wordlist:
    # Check if the word does not contain a digit
    if not any([str(x) in current_word for x in range(10)]):
      # If yes, ignore this word
      continue
    # Check if the word does not contain an uppercase letter
    if not any([x.isupper() for x in a]):
      # If yes, ignore this word
      continue
    try:
      # Try to extract file
      zip_file.extractall(pwd=current_word.strip())
    except:
      # If error is throw, try next password
      continue
    else:
      # No error occured -> password found
      found = True
      print("Password found:", current_word.decode().strip())
if not found:
  print('Password not found in the given wordlist.')

Related Solutions

Write a Python script that performs brute force to extract a password protected zip file named...
Write a Python script that performs brute force to extract a password protected zip file named sec2.zip. The password is believed to be associated with one of the dictionary word in the 'wordlist.txt file. a) Paste your code here b) What is the password?
Write a python program that implements a Brute Force attack on Shift Cipher. In this program...
Write a python program that implements a Brute Force attack on Shift Cipher. In this program there is only one input - ciphertext - is a sequence of UPPER CASE letters. To make it easy, the program will be interactive and will output all possible plaintexts and ask user which plaintext makes sense. As soon as user will decide YES, the program will stop searching and print the desired plaintext and the found SHIFT KEY.
Write psuedocode to brute-force a simple password engine. Then, offer advice on making passwords more secure...
Write psuedocode to brute-force a simple password engine. Then, offer advice on making passwords more secure to brute-force attacks.
Write out the “brute-force” (exact) expressions for force and torque on a loop 1 in the...
Write out the “brute-force” (exact) expressions for force and torque on a loop 1 in the magnetic field B of loop 2. Write these expressions using magnetic moment of loop 1. Pay attention to the r, r’, … vectors. A magnet (magnetic dipole) tends to align itself parallel to external field. If the magnetic moment is 5 [CGS units] in -z direction and magnetic field is 25 [CGS units] in z direction. What is the value of the torque? Plot...
Counting evens Write the pseudo-code for a brute force approach to counting the number of even...
Counting evens Write the pseudo-code for a brute force approach to counting the number of even integers in an array of n integers. Write the pseudo-code divide-and-conquer algorithm for counting the number of even integers in an array of n integers. Give the recurrence relation for the number of additions in your divide-and-conquer algorithm.  
How do I write a script for this in python in REPL or atom, NOT python...
How do I write a script for this in python in REPL or atom, NOT python shell Consider the following simple “community” in Python . . . triangle = [ ["top", [0, 1]], ["bottom-left", [0, 0]], ["bottom-right", [2, 0]], ] This is the calling of function. >>> nearestneighbor([0, 0.6], triangle, myeuclidean) 'top' The new point is (0, 0.6) and the distance function is Euclidean. Now let’s confirm this result . . . >>> myeuclidean([0, 0.6], [0, 1]) 0.4 >>> myeuclidean([0,...
In PYTHON: Write a program that asks for a password from a user and checks if...
In PYTHON: Write a program that asks for a password from a user and checks if it satisfies the conditions: Contains at least one lowercase letter (a-z). Contains at least one uppercase letter (A-Z). Contains at least one digit (0-9). Minimum length 6 characters. Contains no spaces. If the password is valid, then the program prints “password accepted”. Otherwise, it keeps asking for more passwords from the user until a valid password is obtained. Hint: You might like to check...
Counting integers greater than 10 Write the pseudo-code for a brute force approach to counting the...
Counting integers greater than 10 Write the pseudo-code for a brute force approach to counting the number of integers greater than 10 in an array of n integers. Write the pseudo-code divide-and-conquer algorithm for counting the number of integers greater than 10 in an array of n integers. Give the recurrence relation for the number of comparisons in your divide-and-conquer algorithm in part b.  
write a python script for rock scissors paper game
write a python script for rock scissors paper game
write a python script to calculate 401k with compounding interest
write a python script to calculate 401k with compounding interest
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT