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)文章
5個Python使用F-String進(jìn)行格式化的實(shí)用技巧分享
F-String(格式化字符串字面值)是在Python?3.6中引入的,它是一種非常強(qiáng)大且靈活的字符串格式化方法,本文總結(jié)了5個實(shí)用的F-String技巧,相信一定能讓你的代碼輸出更加的美觀,快跟隨小編一起學(xué)習(xí)起來吧2024-03-03
Python小程序 控制鼠標(biāo)循環(huán)點(diǎn)擊代碼實(shí)例
這篇文章主要介紹了Python小程序 控制鼠標(biāo)循環(huán)點(diǎn)擊代碼實(shí)例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下2019-10-10
超詳細(xì)注釋之OpenCV旋轉(zhuǎn)圖像任意角度
這篇文章主要介紹了OpenCV旋轉(zhuǎn)圖像任意角度,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2021-09-09
python 連接各類主流數(shù)據(jù)庫的實(shí)例代碼
下面小編就為大家分享一篇python 連接各類主流數(shù)據(jù)庫的實(shí)例代碼,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-01-01
Python機(jī)器學(xué)習(xí)NLP自然語言處理基本操作家暴歸類
本文是Python機(jī)器學(xué)習(xí)NLP自然語言處理系列文章,帶大家開啟一段學(xué)習(xí)自然語言處理 (NLP) 的旅程。本篇文章主要學(xué)習(xí)NLP自然語言處理家暴歸類2021-09-09

