国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

壓縮包密碼破解示例分享(類似典破解)

2019-11-25 18:33:45
字體:
供稿:網(wǎng)友

昨天翻硬盤,找到一個(gè)好東西,可惜自己加了密碼自己不記得了。試了幾個(gè)常用的沒試出來,于是寫了這么個(gè)小腳本來替我嘗試。。呵呵,還真給解出來了。
python腳本內(nèi)容如下,跑跑自己加密的壓縮包還不錯(cuò)

復(fù)制代碼 代碼如下:

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

import sys,os

def IsElementUniq(list):
    """
          判斷l(xiāng)ist中的元素是否為唯一的
    """
    for word in list:
        if list.count(word)>1:
            return False

    return True

def GenPswList():
    """
          要求用戶輸入詞,并根據(jù)單詞組合密碼,只嘗試四個(gè)單詞來組合,并限制密碼長度為20。寫的比較挫
    """
    psw=raw_input('input a word>')
    wordlist = []
    while psw:
        wordlist.append(psw)
        psw=raw_input('input a word>')
    print wordlist

    global g_pswlist
    g_pswlist = []
    for word in wordlist:
        g_pswlist.append(word)

    for word1 in wordlist:
        for word2 in wordlist:
            locallist = [word1, word2]
            if IsElementUniq(locallist):
                tmp = word1 + word2
                if len(tmp) < 20:
                    g_pswlist.append(tmp)

    for word1 in wordlist:
        for word2 in wordlist:
            for word3 in wordlist:
                locallist = [word1, word2, word3]
                if IsElementUniq(locallist):
                    tmp = word1 + word2 + word3
                    if len(tmp) < 20:
                        g_pswlist.append(tmp)

    for word1 in wordlist:
        for word2 in wordlist:
            for word3 in wordlist:
                for word4 in wordlist:
                    locallist = [word1, word2, word3, word4]
                    if IsElementUniq(locallist):
                        tmp = word1 + word2 + word3 + word4
                        if len(tmp) < 20:
                            g_pswlist.append(tmp)

    print 'gen psw is:', g_pswlist

def TestUnZipPack(filename):
    """
          嘗試用密碼來解壓壓縮包
    """

    command = ""
    for psw in g_pswlist:
        command = "7z e -p%s -y %s" %(psw,filename)
        print command
        ret = os.system(command)
        if ret == 0:
            print 'right psw is ', psw
            break

def main(filename):
    GenPswList()
    TestUnZipPack(filename)

if __name__ == '__main__':
    if len(sys.argv) != 2:
        print 'argv error'
        print 'example:test_7z_psw.py 1.7z'
        sys.exit(1)

    main(sys.argv[1])

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 海晏县| 承德县| 大冶市| 尼玛县| 崇明县| 临清市| 台江县| 陆良县| 梧州市| 乐安县| 耿马| 凤凰县| 宣武区| 佛坪县| 红原县| 信阳市| 深水埗区| 济南市| 伊宁市| 长顺县| 乐安县| 沙田区| 勃利县| 饶阳县| 林西县| 台山市| 西昌市| 泾川县| 怀来县| 开化县| 建瓯市| 武城县| 永清县| 中宁县| 越西县| 桦南县| 双鸭山市| 鹤岗市| 鹤峰县| 永胜县| 湛江市|