Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Crack a zip file using Python I am trying to crack a password on a zip file. I wrote the code in a .py file.

Crack a zip file using Python

I am trying to crack a password on a zip file. I wrote the code in a .py file.

import zipfile import optparse from threading import Thread def extractFile(zFile, password): try: zFile.extractall(pwd=password) print '[+] Found password ' + password + ' ' except: pass def main(): parser = optparse.OptionParser("usage%prog "+\ "-f -d ") parser.add_option('-f', dest= 'zname', type= 'string',\ help= 'specify dictionary file') parser.add_option('-d', dest= 'dname', type= 'string',\ help= 'specify dictionary file') (options, args) = parser.parse_args() if (options.zname == None) | (options.dname == None): print parser.usage exit(0) else: zname = options.zname dname = options.dname zFile = zipfile.ZipFile(zname) passFile = open(dname) for line in passFile.readlines(): password = line.strip(' ') t = Thread(target=extractFile, args=(zFile, password)) t.start() if __name__ == '__main__': main()

I tried using the following command in the command prompt to execute the code to crack the password, and it keeps giving me a syntax error :

unzip.py -f (my zip file name) -d (my dictionary list file name)

Am I improperly executing the code?

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_2

Step: 3

blur-text-image_3

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

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions

Question

What is the orientation toward time?

Answered: 1 week ago

Question

4. How is culture a contested site?

Answered: 1 week ago