From cfce42f9ba18f59f8331078ee70ec2e5333bbeff Mon Sep 17 00:00:00 2001 From: root Date: Sat, 28 Oct 2017 02:12:00 +0200 Subject: [PATCH] Implemented parser for zipfile and dictionary file --- crackers/unzip.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/crackers/unzip.py b/crackers/unzip.py index a3594cf..de1d89d 100644 --- a/crackers/unzip.py +++ b/crackers/unzip.py @@ -1,4 +1,5 @@ import zipfile +import optparse from threading import Thread def extractFile(zFile, password): try: @@ -7,8 +8,18 @@ def extractFile(zFile, password): except: pass def main(): - zFile = zipfile.ZipFile("secret.zip") - passFile = open("dictionary.txt") + parser = optparse.OptionParser("usage%prog " + "-f -d ") + parser.add_option("-f", dest="zname", type="string", help="specify zip file") + parser.add_option("-d", dest="dname", tpye="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))