Python破解excel進(jìn)入密碼的過程詳解
一、excel進(jìn)入密碼
加密算法cipher Algorithm=“AES”
AES加密算法的詳細(xì)介紹與實(shí)現(xiàn)
二、密碼解除思路
通過排列組合的方式進(jìn)行查找
注意:此方法比較考驗(yàn)對密碼字典的選取,且耗費(fèi)時間較長,僅供參考學(xué)習(xí)!!
文件夾如圖所示:

將待破解的文件放到excel文件夾中。
三、python
1.conf.ini
將準(zhǔn)備好的密碼字典添加到conf.ini中password后面,用","分隔開?。?!
部分字典如下(示例):
[Conf] path=./excel/ password=12345678,1234,qwerty,12345,dragon,pussy,baseball,football,letmein,monkey,696969,abc123,mustang,michael,shadow,master,jennifer,111111,2000,jordan,superman,harley,1234567,fuckme,hunter,fuckyou,trustno1,ranger,buster,thomas,tigger,robert,soccer,fuck,batman,test,pass,killer,hockey,george,charlie,andrew,michelle,love,sunshine,jessica,asshole,6969,pepper,daniel,access,123456789,654321,joshua,maggie,starwars,silver,william,dallas,yankees,123123,ashley,666666,hello,amanda,orange,biteme,freedom,computer,sexy,thunder,nicole,ginger,heather,hammer,summer,corvette,taylor,fucker,austin,1111,merlin,matthew,121212,golfer,cheese,princess,martin,chelsea,patrick,richard,diamond,yellow,bigdog,secret,asdfgh,sparky,cowboy,camaro,anthony,matrix,falcon,iloveyou,bailey,guitar,jackson,purple,scooter,phoenix,aaaaaa,morgan,tigers,porsche,mickey,maverick,cookie,nascar,peanut,justin,131313,money,horny,samantha,panties,steelers,joseph,snoopy,boomer,whatever,iceman,smokey,gateway,dakota,cowboys,eagles,chicken,dick,black,zxcvbn,please,andrea,ferrari,knight,hardcore,melissa,compa
2.crack.py
代碼如下(示例):
#!/usr/bin/env python3
import configparser
import os
import win32com.client
import turtle
import time
import math
import shutil
import threading
import sched
#創(chuàng)建文件夾
def mkdir(path):
path = path.strip()
path = path.rstrip("\\")
isExists = os.path.exists(path)
if not isExists:
os.makedirs(path)
print (path + ' 創(chuàng)建成功')
return True
else:
print (path + ' 目錄已存在')
return False
def delpwdtry(xcl,filename,pw_str):
try:
wb = xcl.Workbooks.Open(filename, False, False, None, pw_str)
xcl.DisplayAlerts = False
# # 保存時可設(shè)置訪問密碼.
wb.SaveAs(filename, None, '', '')
# 保存文件
wb.Save()
# 文件保存并關(guān)閉
wb.Close(SaveChanges=True)
xcl.Quit()
return True
except:
xcl.Quit()
return False
def makefile(path, content):
if os.path.exists(path):
return
else:
f = open(path, 'w+')
f.write(content)
f.seek(0)
read = f.readline()
f.close()
print('excel文件放加密excel config配置密碼 okdir是成功文件夾')
os.system('pause')
exit(0)
def aaaa(starttime,filename,num,pwds,i,file,xcl):
haoshi = round(time.time() - starttime, 2)
print((str(i) + "/" + str(num)), haoshi, '秒', file)
pwdok = 0
i2 = 0
for pwd in pwds:
i2 = i2 + 1
print ((str(i) + "/" + str(num)), '第', i2, "次嘗試", pwd)
pwd_end = ''
boo = delpwdtry(xcl, filename, pwd)
if boo:
pwdok = 1
pwd_end = pwd
break
if pwdok:
print ((str(i) + "/" + str(num)), 'ok')
# print ('10秒后移動文件')
s = threading.Timer(10, movee, (filename,))
s.start()
else:
print ('失敗')
xcl.Quit()
def movee(filename):
shutil.move(filename, './okdir')
def delpwd(okdir,starttime):
conf = configparser.ConfigParser()
# 指定配置文件路徑和編碼
conf.read('conf1.ini', 'utf-8') # 文件路徑
# 讀取配置信息
path = conf.get("Conf", "path")
password = conf.get("Conf", "password")
pwds = password.split(',')
xcl = win32com.client.Dispatch("Excel.Application")
# pw_str為打開密碼, 若無 訪問密碼, 則設(shè)為 ''
xcl.Visible = False
filelist = os.listdir(path)
num = len(filelist)
i = 0
for file in filelist:
i = i + 1
filename = os.path.abspath(os.path.join(path, file))
aaaa(starttime,filename,num,pwds,i,file,xcl)
starttime = time.time()
endtime = time.time()
okdir = './okdir'
mkdir('./excel')
mkdir(okdir)
makefile('./conf.ini', "[Conf]\npath=./excel/\npassword=mima1,mima2,3...")
delpwd(okdir,starttime)
haoshi = round(time.time()-starttime,2)
print("執(zhí)行完成 耗時",haoshi , "秒")
os.system('pause')到此這篇關(guān)于Python破解excel進(jìn)入密碼的過程詳解的文章就介紹到這了,更多相關(guān)Python破解excel內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
python環(huán)境路徑配置以及命令行運(yùn)行腳本
這篇文章主要為大家詳細(xì)介紹了python環(huán)境路徑配置以及命令行運(yùn)行腳本,具有一定的參考價值,感興趣的小伙伴們可以參考一下2019-04-04
Pandas探索之高性能函數(shù)eval和query解析
這篇文章主要介紹了Pandas探索之高性能函數(shù)eval和query解析,小編覺得還是挺不錯的,這里分享給大家,供需要的朋友參考。2017-10-10
如何利用pygame實(shí)現(xiàn)打飛機(jī)小游戲
pygame是python的一個做游戲的庫,非常適合做游戲開發(fā),這篇文章主要給大家介紹了關(guān)于如何利用pygame實(shí)現(xiàn)打飛機(jī)小游戲的相關(guān)資料,需要的朋友可以參考下2021-05-05
Python批量生成特定尺寸圖片及圖畫任意文字的實(shí)例
今天小編就為大家分享一篇Python批量生成特定尺寸圖片及圖畫任意文字的實(shí)例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-01-01

