今天寫了個小腳本,用于暴力破解zip密碼
import zipfile from threading import Thread import optparse def testZipPasswd(zfile,passWord): try: zfile.extractall(pwd=passWord) print("[ ] Found Password: " str(passWord,encoding="utf-8")) except Exception as e: #print(e) pass def decodeZipPasswd(zfile,passfile): with open(passfile) as f: zfile = zipfile.ZipFile(zfile) for i in f.readlines(): i = i.replace("\n","") t = Thread(target=testZipPasswd,args=(zfile, i.encode(encoding="utf-8"))) t.start() if __name__ == "__main__": parser = optparse.OptionParser("python zip.py -f <zipfile> -p <passfile>") parser.add_option("-f",dest='zname',type='string',help='specify zip file') parser.add_option("-p",dest='passwd',type='string',help='specify password file') (options,args) = parser.parse_args() if options.zname ==None or options.passwd==None: print(parser.usage) exit(0) else: decodeZipPasswd(options.zname,options.passwd)
,