Skip to content

Commit

Permalink
Implemented parser for zipfile and dictionary file
Browse files Browse the repository at this point in the history
  • Loading branch information
ninijay committed Oct 28, 2017
1 parent c7d563c commit cfce42f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions crackers/unzip.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import zipfile
import optparse
from threading import Thread
def extractFile(zFile, password):
try:
Expand All @@ -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 <zipfile> -d <dictionary>")
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))
Expand Down

0 comments on commit cfce42f

Please sign in to comment.