Created
July 7, 2013 10:53
-
-
Save rkrishnasanka/5943092 to your computer and use it in GitHub Desktop.
Zip Password Cracker (requires dictionary)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zipfile | |
import optparse | |
from threading import Thread | |
def extractFile(zFile, password): | |
try: | |
zFile.extractall(pwd = password) | |
print '[+] Found password ' + password + '\n' | |
except: | |
pass | |
def main(): | |
parser = optparse.OptionParser("usage%prog "+"-f <zipfile> -d <dictionary>") | |
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('\n') | |
t = Thread(target=extractFile, args=(zFile,password)) | |
t.start() | |
if __name__ == '__main__': | |
main() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment