Question

In: Computer Science

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?

Solutions

Expert Solution

pip3 install tqdm

import zipfile
from tqdm import tqdm

# the password list path you want to use, must be there in the current directory
wordlist = " wordlist .txt"


# the zip file
zip_file = "secret.zip"

# initializing the Zip File object
zip_file = zipfile.ZipFile(zip_file)


# count the no of words in this wordlist
n_words = len(list(open(wordlist, "rb")))


# print the total number of passwords
print("Total passwords: ", n_words)


with open(wordlist, "rb") as wordlist:
    for word in tqdm(wordlist, total=n_words, unit="word"):
        try:
            zip_file.extractall(pwd=word.strip())
        except:
            continue
        else:
            print("[+] Password found!:", word.decode().strip())
            exit(0)
print("[!] Sorry Password not found, try other wordlist.")


root@rockikz:~# gunzip /usr/share/wordlists/rockyou.txt.gz
root@rockikz:~# python3 zip_cracker.py secret.zip /usr/share/wordlists/ wordlist .txt
Total passwords: 14344395


Password found: abcdef12345


Related Solutions

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...
Create a bash script file named assessment-script-a that: 1. Accepts any number of file names on...
Create a bash script file named assessment-script-a that: 1. Accepts any number of file names on the command line 2. For each file name provided, delete any line that contains the string: qwe.rty When the changes are completed, the script should display the total number of files scanned, and the total number of files changed. Example Command: assessment-script-a file.a file.b file.c file.d file.e    Example Output: 5 files scanned, 3 files changed 3. Your script should include a series of...
Solve using PYTHON PROGRAMMING 9. Write a script that reads a file “ai_trends.txt”, into a list...
Solve using PYTHON PROGRAMMING 9. Write a script that reads a file “ai_trends.txt”, into a list of words, eliminates from the list of words the words in the file “stopwords_en.txt” and then a. Calculates the average occurrence of the words. Occurrence is the number of times a word is appearing in the text b. Calculates the longest word c. Calculates the average word length. This is based on the unique words: each word counts as one d. Create a bar...
Solve using PYTHON PROGRAMMING Write a script that reads a file “cars.csv”, into a pandas structure...
Solve using PYTHON PROGRAMMING Write a script that reads a file “cars.csv”, into a pandas structure and then print a. the first 3 rows and the last 3 of the dataset b. the 3 cars with the lowest average-mileage c. the 3 cars with the highest average-mileage. Solve using PYTHON PROGRAMMING
Python, filing and modules Modify the driver to write the statistics to a file named employee-stats.txt...
Python, filing and modules Modify the driver to write the statistics to a file named employee-stats.txt rather than to the console. driver.py code: from employee import Employee employees = [] # Load an employee object for each employee specified in 'employees.txt' into the employees list. employee.txt Jescie Craig VP 95947 Marny Mckenzie Staff 52429 Justin Fuller Manager 72895 Herman Love VP 108204 Hasad Wilkins Staff 96153 Aubrey Eaton Staff 76785 Yvonne Wilkinson Staff 35823 Dane Carlson Manager 91524 Emma Tate...
Python program: Write a program that reads a text file named test_scores.txt to read the name...
Python program: Write a program that reads a text file named test_scores.txt to read the name of the student and his/her scores for 3 tests. The program should display class average for first test (average of scores of test 1) and average (average of 3 tests) for each student. Expected Output: ['John', '25', '26', '27'] ['Michael', '24', '28', '29'] ['Adelle', '23', '24', '20'] [['John', '25', '26', '27'], ['Michael', '24', '28', '29'], ['Adelle', '23', '24', '20']] Class average for test 1...
Using Python The script is to open a given file. The user is to be asked...
Using Python The script is to open a given file. The user is to be asked what the name of the file is. The script will then open the file for processing and when done, close that file. The script will produce an output file based on the name of the input file. The output file will have the same name as the input file except that it will begin with "Analysis-". This file will be opened and closed by...
​​​​Python Create a new file named compute_cost.py. Write your name and date in a comment. Create...
​​​​Python Create a new file named compute_cost.py. Write your name and date in a comment. Create a variable named base_fee and set the value to 5.5. Prompt the user for the zone. The zones can be an integer value from 1 to any value for the zone. Convert the zone to an integer. Display the zone on the SenseHat with a scroll speed of 0.3, make the text blue, and the background yellow. Scroll "The zone is " and the...
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.  
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT