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

作者:用余生去守护 时间:2021-06-14 03:06:25 

一、excel进入密码

加密算法cipher Algorithm=“AES”

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

二、密码解除思路

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

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

文件夹如图所示:

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

将待破解的文件放到excel文件夹中。

三、python

1.conf.ini

将准备好的密码字典添加到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

#创建文件夹
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')

来源:https://blog.csdn.net/qq_45365214/article/details/123236357

标签:Python,破解,excel,密码
0
投稿

猜你喜欢

  • 比较文档位置

    2008-04-03 13:24:00
  • java正则表达式解析html示例分享

    2023-06-13 15:53:42
  • 认识MySQL数据库对服务器端光标的限制

    2009-03-25 17:35:00
  • 常见Dreamweaver使用过程中的问题及解决办法

    2011-03-17 16:16:00
  • asp如何做一个只能从本站点才能访问的页面?

    2010-07-12 19:00:00
  • 太有才了!让人称绝的404错误页面

    2007-08-19 15:51:00
  • 豆瓣可以做而且值得做的几件事情

    2009-04-24 12:07:00
  • Python企业编码生成系统之主程序模块设计详解

    2023-11-18 18:44:37
  • Python通过两个dataframe用for循环求笛卡尔积

    2023-11-02 04:32:24
  • 一文带你熟悉Go语言中函数的使用

    2023-07-13 08:22:23
  • go-cache的基本使用场景示例解析

    2023-08-06 00:52:02
  • 纯CSS图片预加载

    2009-10-28 18:40:00
  • PHP垃圾回收机制超详细介绍

    2023-11-21 23:11:44
  • 详解Scrapy Redis入门实战

    2023-04-14 11:39:08
  • python列表和字符串的三种逆序遍历操作

    2022-09-09 03:00:56
  • Python学习之流程控制与条件判断总结

    2023-08-20 13:37:02
  • python中单下划线(_)和双下划线(__)的特殊用法

    2022-08-09 22:23:22
  • FCKeditor技巧之在按钮旁边加文字

    2007-10-10 13:17:00
  • ASP 连接mysql信息(strConnString)

    2009-10-29 12:02:00
  • Python3 使用pip安装git并获取Yahoo金融数据的操作

    2023-11-17 21:56:48
  • asp之家 网络编程 m.aspxhome.com