脚本之家,脚本语言编程技术及教程分享平台!
分类导航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|

服务器之家 - 脚本之家 - Python - Python破解excel进入密码的过程详解

Python破解excel进入密码的过程详解

2022-10-20 11:29用余生去守护 Python

这篇文章主要为大家介绍了如何利用Python破解excel进入密码,文中的示例代码讲解详细,对我们学习Python有一定帮助,感兴趣的可以动手试一试

一、excel进入密码

加密算法cipher Algorithm=“AES”

AES加密算法的详细介绍与实现

二、密码解除思路

通过排列组合的方式进行查找

注意:此方法比较考验对密码字典的选取,且耗费时间较长,仅供参考学习!!

文件夹如图所示:

Python破解excel进入密码的过程详解

将待破解的文件放到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

延伸 · 阅读

精彩推荐
  • Python深入浅析Python中join 和 split详解(推荐)

    深入浅析Python中join 和 split详解(推荐)

    这篇文章主要介绍了Python中join 和 split详解的相关资料,本文还通过一个示例给大家介绍python join 和 split方法 的使用,需要的朋友可以参考下...

    Pyerlife4172020-08-30
  • Python九步学会Python装饰器

    九步学会Python装饰器

    这篇文章主要介绍了Python装饰器的用法,以实例形式较为详细的介绍了Python装饰器的使用方法,需要的朋友可以参考下...

    守株待兔3652020-06-26
  • Pythonpython flappy bird小游戏分步实现流程

    python flappy bird小游戏分步实现流程

    哈喽,哈喽~今天小编又来分享小游戏了——flappy bird(飞扬的小鸟),这个游戏非常的经典,游戏中玩家必须控制一只小鸟,跨越由各种不同长度水管所组...

    迢迢x8152022-09-28
  • Pythonpython 爬取古诗文存入mysql数据库的方法

    python 爬取古诗文存入mysql数据库的方法

    这篇文章主要介绍了python 爬取古诗文存入mysql数据库的方法,本文通过实例代码给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下...

    go_flush5212020-05-05
  • PythonPython+matplotlib+numpy绘制精美的条形统计图

    Python+matplotlib+numpy绘制精美的条形统计图

    这篇文章主要介绍了Python+matplotlib+numpy绘制精美的条形统计图,具有一定借鉴价值,需要的朋友可以参考下...

    mengwei10892020-12-30
  • Python浅谈Python3中datetime不同时区转换介绍与踩坑

    浅谈Python3中datetime不同时区转换介绍与踩坑

    最近的项目需要根据用户所属时区制定一些特定策略,学习、应用了若干python3的时区转换相关知识,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...

    及时8332021-12-16
  • Pythonanaconda如何查看并管理python环境

    anaconda如何查看并管理python环境

    这篇文章主要介绍了anaconda如何查看并管理python环境,Anaconda是Python的一个开源发行版本,主要面向科学计算,预装了丰富强大的库。使用Anaconda可以轻松管...

    Jeremy.li4262021-08-01
  • Pythonpython 读txt文件,按‘,’分割每行数据操作

    python 读txt文件,按‘,’分割每行数据操作

    这篇文章主要介绍了python 读txt文件,按‘,’分割每行数据操作,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧 ...

    科班学渣16552020-07-06