Python小子-

暴力破解zip加密压缩文件

2018-8-29 11:48 作者:小林子 | Python脚本 |

# -*- coding:utf-8 -*-

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 = 'zn',type = 'string',help = 'zip file')

    parser.add_option('-d',dest = 'dn',type = 'string',help = 'dictionary file')

    (options,args) = parser.parse_args()

    if(options.zn == None) | (options.dn == None):

        print parser.usage

        exit(0)

    else:

        zn = options.zn

        dn = options.dn

    zFile = zipfile.ZipFile(zn)

    passFile = open(dn)

    for line in passFile.readlines():

        password = line.strip('\n')

        t = Thread(target = extractFile,args = (zFile,password))

        t.start()


if __name__ == '__main__':

    main()



        注:python2环境下执行


文章作者:小林子
文章地址:http://www.xlzweb.top/post-25.html
版权所有 © 转载时必须以链接形式注明作者和原始出处!


Powered by 小林子 & Python小子

CopyRight © 2017-2018 Python小子.  All rights reserved.