Created
May 18, 2015 09:10
-
-
Save JohnTroony/53de826f8fc77bcf3bc0 to your computer and use it in GitHub Desktop.
Zip Cracker
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
#!/usr/bin/env python | |
# Troon Jay | |
import zipfile | |
from threading import Thread | |
from optparse import OptionParser | |
def crackfile(zipfile,password): | |
try: | |
zipfile.extractall(pwd=password) | |
print "password found !! " | |
return password | |
except (KeyboardInterrupt , SystemExit): | |
raise | |
except: | |
return | |
def main(): | |
parser= OptionParser("Specify -f <zipname> -w <wordlist> or --help for help") | |
parser.add_option("-f","--file",dest="zipname",help="specify the zipfile name with proper path") | |
parser.add_option("-w","--wordlist",dest="wordlist",help="specify the wordlist with proper path") | |
(options, args)= parser.parse_args () | |
if (options.zipname== None) | (options.wordlist== None): | |
print parser.usage | |
else: | |
zipname= options.zipname | |
wordlist= options.wordlist | |
zname = zipfile.ZipFile(zipname) | |
pfile= open(wordlist) | |
for lines in pfile.readlines(): | |
password=lines.strip("\n") | |
res= crackfile(zname,password) | |
if res: | |
print password | |
return | |
else: | |
pass | |
else: | |
print "not found" | |
pfile.close() | |
if __name__=='__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment