壓縮包密碼破解示例分享(類似典破解)
昨天翻硬盤,找到一個(gè)好東西,可惜自己加了密碼自己不記得了。試了幾個(gè)常用的沒(méi)試出來(lái),于是寫了這么個(gè)小腳本來(lái)替我嘗試。。呵呵,還真給解出來(lái)了。
python腳本內(nèi)容如下,跑跑自己加密的壓縮包還不錯(cuò)
# -*- 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è)單詞來(lái)組合,并限制密碼長(zhǎng)度為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):
"""
嘗試用密碼來(lái)解壓壓縮包
"""
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])
相關(guān)文章
tensorflow實(shí)現(xiàn)加載mnist數(shù)據(jù)集
這篇文章主要為大家詳細(xì)介紹了tensorflow實(shí)現(xiàn)加載mnist數(shù)據(jù)集,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-09-09Python實(shí)現(xiàn)處理圖片水印的方法詳解
這篇文章主要為大家詳細(xì)介紹了如何利用Python實(shí)現(xiàn)處理圖片水印的相關(guān)資料,主要是實(shí)現(xiàn)圖片水印的去除效果,感興趣的小伙伴可以嘗試一下2022-11-11解決Tkinter中button按鈕未按卻主動(dòng)執(zhí)行command函數(shù)的問(wèn)題
這篇文章主要介紹了解決Tkinter中button按鈕未按卻主動(dòng)執(zhí)行command函數(shù)的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2021-05-05python學(xué)習(xí)之第三方包安裝方法(兩種方法)
這篇文章主要介紹了python學(xué)習(xí)之第三方包安裝方法,最近在學(xué)習(xí)QQ空間、微博(爬蟲)模擬登錄,都涉及到了RSA算法。這樣需要下一個(gè)RSA包(第三方包),在網(wǎng)上搜了好多資料,在此做了總結(jié),需要的朋友可以參考下2015-07-07python 實(shí)現(xiàn)PIL模塊在圖片畫線寫字
這篇文章主要介紹了python 實(shí)現(xiàn)PIL模塊在圖片畫線寫字,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-05-05python 對(duì)給定可迭代集合統(tǒng)計(jì)出現(xiàn)頻率,并排序的方法
今天小編就為大家分享一篇python 對(duì)給定可迭代集合統(tǒng)計(jì)出現(xiàn)頻率,并排序的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2018-10-10