一、excel进入密码
加密算法cipher Algorithm=“AES”
AES加密算法的详细介绍与实现
二、密码解除思路
通过排列组合的方式进行查找
注意:此方法比较考验对密码字典的选取,且耗费时间较长,仅供参考学习!!
文件夹如图所示:
将待破解的文件放到excel文件夹中。
三、python
1.conf.ini
将准备好的密码字典添加到conf.ini中password后面,用","分隔开!!!
部分字典如下(示例):
1
2
3
|
[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
代码如下(示例):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
#!/usr/bin/env python3 import configparser import os import win32com.client import turtle import time import math import shutil import threading import sched #创建文件夹 def mkdir(path): path = path.strip() path = path.rstrip( "\\" ) isExists = os.path.exists(path) if not isExists: os.makedirs(path) print (path + ' 创建成功' ) 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 # # 保存时可设置访问密码. wb.SaveAs(filename, None , ' ', ' ') # 保存文件 wb.Save() # 文件保存并关闭 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为打开密码, 若无 访问密码, 则设为 '' 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 ( "执行完成 耗时" ,haoshi , "秒" ) os.system( 'pause' ) |
到此这篇关于Python破解excel进入密码的过程详解的文章就介绍到这了,更多相关Python破解excel内容请搜索服务器之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持服务器之家!
原文链接:https://blog.csdn.net/qq_45365214/article/details/123236357