Excel密码忘记:破解Excel密码

Excel保护密码是用来防止别人修改Excel文档用的,但有时连自己都忘了,那该怎么办呢?

破解方法:

打开需要破解的excel文档,然后按Alt+F11打开VBA编辑器,点击插入-模块,在模块中将以下代码COPY进去,无需保存,直接按F5运行,等待运行完毕。大约等待2分钟左右,密码被计算出来,并且显示出原密码,文档也变成未设密码状态。

(注:复制代码时按下面代码区域右上角的第二个按钮。)

Public Sub AllInternalPasswords()' Breaks worksheet and workbook structure passwords. Bob McCormick' probably originator of base code algorithm modified for coverage' of workbook structure / windows passwords and for multiple passwords'' Norman Harker and JE McGimpsey 27-Dec-2002 (Version 1.1)' Modified 2003-Apr-04 by JEM: All msgs to constants, and' eliminate one Exit Sub (Version 1.1.1)' Reveals hashed passwords NOT original passwordsConst DBLSPACE As String = vbNewLine & vbNewLineConst AUTHORS As String = DBLSPACE & vbNewLine & _"Adapted from Bob McCormick base code by" & _"Norman Harker and JE McGimpsey"Const HEADER As String = "AllInternalPasswords User Message"Const VERSION As String = DBLSPACE & "Version 1.1.1 2003-Apr-04"Const REPBACK As String = DBLSPACE & "Please report failure " & _"to the microsoft.public.excel.programming newsgroup."Const ALLCLEAR As String = DBLSPACE & "The workbook should " & _"now be free of all password protection, so make sure you:" & _DBLSPACE & "SAVE IT NOW!" & DBLSPACE & "and also" & _DBLSPACE & "BACKUP!, BACKUP!!, BACKUP!!!" & _DBLSPACE & "Also, remember that the password was " & _"put there for a reason. Don't stuff up crucial formulas " & _"or data." & DBLSPACE & "Access and use of some data " & _"may be an offense. If in doubt, don't."Const MSGNOPWORDS1 As String = "There were no passwords on " & _"sheets, or workbook structure or windows." & AUTHORS & VERSIONConst MSGNOPWORDS2 As String = "There was no protection to " & _"workbook structure or windows." & DBLSPACE & _"Proceeding to unprotect sheets." & AUTHORS & VERSIONConst MSGTAKETIME As String = "After pressing OK button this " & _"will take some time." & DBLSPACE & "Amount of time " & _"depends on how many different passwords, the " & _"passwords, and your computer's specification." & DBLSPACE & _"Just be patient! Make me a coffee!" & AUTHORS & VERSIONConst MSGPWORDFOUND1 As String = "You had a Worksheet " & _"Structure or Windows Password set." & DBLSPACE & _"The password found was: " & DBLSPACE & "$$" & DBLSPACE & _"Note it down for potential future use in other workbooks by " & _"the same person who set this password." & DBLSPACE & _"Now to check and clear other passwords." & AUTHORS & VERSIONConst MSGPWORDFOUND2 As String = "You had a Worksheet " & _"password set." & DBLSPACE & "The password found was: " & _DBLSPACE & "$$" & DBLSPACE & "Note it down for potential " & _"future use in other workbooks by same person who " & _"set this password." & DBLSPACE & "Now to check and clear " & _"other passwords." & AUTHORS & VERSIONConst MSGONLYONE As String = "Only structure / windows " & _"protected with the password that was just found." & _ALLCLEAR & AUTHORS & VERSION & REPBACKDim w1 As Worksheet, w2 As WorksheetDim i As Integer, j As Integer, k As Integer, l As IntegerDim m As Integer, n As Integer, i1 As Integer, i2 As IntegerDim i3 As Integer, i4 As Integer, i5 As Integer, i6 As IntegerDim PWord1 As StringDim ShTag As Boolean, WinTag As BooleanApplication.ScreenUpdating = FalseWith ActiveWorkbookWinTag = .ProtectStructure Or .ProtectWindowsEnd WithShTag = FalseFor Each w1 In WorksheetsShTag = ShTag Or w1.ProtectContentsNext w1If Not ShTag And Not WinTag ThenMsgBox MSGNOPWORDS1, vbInformation, HEADERExit SubEnd IfMsgBox MSGTAKETIME, vbInformation, HEADERIf Not WinTag ThenMsgBox MSGNOPWORDS2, vbInformation, HEADERElseOn Error Resume NextDo 'dummy do loopFor i = 65 To 66: For j = 65 To 66: For k = 65 To 66For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126With ActiveWorkbook.Unprotect Chr(i) & Chr(j) & Chr(k) & _Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)If .ProtectStructure = False And _.ProtectWindows = False ThenPWord1 = Chr(i) & Chr(j) & Chr(k) & Chr(l) & _Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)MsgBox Application.Substitute(MSGPWORDFOUND1, _"$$", PWord1), vbInformation, HEADERExit Do 'Bypass all for...nextsEnd IfEnd WithNext: Next: Next: Next: Next: NextNext: Next: Next: Next: Next: NextLoop Until TrueOn Error GoTo 0End IfIf WinTag And Not ShTag ThenMsgBox MSGONLYONE, vbInformation, HEADERExit SubEnd IfOn Error Resume NextFor Each w1 In Worksheets'Attempt clearance with PWord1w1.Unprotect PWord1Next w1On Error GoTo 0ShTag = FalseFor Each w1 In Worksheets'Checks for all clear ShTag triggered to 1 if not.ShTag = ShTag Or w1.ProtectContentsNext w1If ShTag ThenFor Each w1 In WorksheetsWith w1If .ProtectContents ThenOn Error Resume NextDo 'Dummy do loopFor i = 65 To 66: For j = 65 To 66: For k = 65 To 66For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126.Unprotect Chr(i) & Chr(j) & Chr(k) & _Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)If Not .ProtectContents ThenPWord1 = Chr(i) & Chr(j) & Chr(k) & Chr(l) & _Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)MsgBox Application.Substitute(MSGPWORDFOUND2, _"$$", PWord1), vbInformation, HEADER'leverage finding Pword by trying on other sheetsFor Each w2 In Worksheetsw2.Unprotect PWord1Next w2Exit Do 'Bypass all for...nextsEnd IfNext: Next: Next: Next: Next: NextNext: Next: Next: Next: Next: NextLoop Until TrueOn Error GoTo 0End IfEnd WithNext w1End IfMsgBox ALLCLEAR & AUTHORS & VERSION & REPBACK, vbInformation, HEADEREnd Sub

破解如此简单。有了这个方法,那Excel文档保护功能就是形同虚设。

【测试使用Excel2003版本,通过。】

(0)

相关推荐

  • 电脑密码忘记了电脑密码忘记了怎么办

    电脑密码忘记了电脑密码忘记了怎么办? 当我们遇到这个问题时,很多不懂得怎么安装和修复系统的朋友就不知所措了,在些,我给大推荐几种方法: 如果是XP,忘了WINDOS开机密码,有两种最常用的方法:第一种 ...

  • 如何破解Windows7的开机密码/忘记Win7开机密码

    大家都知道密码忘记以后很麻烦,有一些人认为windows密码忘记后只能重做系统,其实不然,XP系统密码忘记后可以通过一些ghost盘自带的密码破解功能,但是win7的安全性不是一般破解工具能破解的,不 ...

  • 微信密码怎么破解 微信密码本地破解的奥秘

    微信,我想在座的再熟悉不过了,微信是新一代的很火聊天工具,我们不仅可以用它来和亲朋好友联系,可以跟更多的人交流.也有很多关于怎么破解微信密码,想知道自己爱人在究竟有没有跟他人有暧昧关系,聊了什么.在这 ...

  • 豌豆荚账号密码忘记怎么找回密码

    之前咗嚛提到豌豆荚自定义定制主页可以让豌豆荚设置漫游,可是如果豌豆荚账号密码忘记了怎么办呢?本提供豌豆荚密码找回解决办法 找回豌豆荚账号密码 01 如图打开豌豆荚软件之后会,加右上角 [登陆]功能 0 ...

  • 开机密码忘记了怎么解开(密码忘记怎么办?开机密码忘记)

    如何创建密码重置盘在Win10系统中,一般您可以使用微软账户或本地账户进行登录.对于本地账户而言,如果您忘记了密码,则可以通过密码重置盘进行密码修改.所以,在设置完账户密码后,紧接着您需要为电脑创建一 ...

  • 管理员密码忘记了或密码错十次怎么办

    如果管理员忘记了密码怎么办.当管理员忘记密码时,我们也可以通过相应的方法找回密码,而不需要担心会发生忘记密码后登不进去的情况.那么,怎么办呢,用户需要到系统安装目录里面进行设置. 操作方法 01 在登 ...

  • 电脑用户密码忘记了怎么办??密码忘记了怎么办

    操作方法 01 一般我们会为自己的电脑设定密码,防止未经允许的人私自动你的电脑.但是同时也带来一个问题,即你有可能忘记了你的密码,不但别人打不开,连你自己也打不开了.万一出现这种情况还有办法吗?答案是 ...

  • QQ密码忘记,如何找回密码?

    今天小编要和大家分享的是QQ密码忘记如何找回密码,希望能够帮助到大家. 操作方法 01 首先在我们的电脑桌面上找到QQ并点击它,如下图所示. 02 然后点击屏幕右侧的找回密码,如下图所示. 03 接着 ...

  • excel表格忘记密码如何破解

    在日常上班工作中难免有一些数据需要保密,也有一些需要做一些防止修改的手段,但时间久了密码很容易就不记得了,想修改又不忘记密码,是否很蛋疼,还有在网上下载一下高级的表格,想了解里面的公式技术思路,但又发 ...