Excel protects passwords to prevent others from modifying Excel documents, but sometimes you forget them.
Open the Excel document that needs to be cracked, then press ALT+F11 to open the VBA editor, click Insert-Module, copy the following code in the module, do not need to save, press F5 to run, wait for run complete. About 2 minutes to wait, the password is computed, and the original password is displayed, and the document becomes an open password state.
(Note: When copying code, press the second button in the upper-right corner of the following code area.) ）
Public Sub allinternalpasswords () ' Breaks Worksheet and workbook structure passwords. Bob McCormick ' probably originator of base code algorithm modified for coverage ' of workbook structure/windows DS 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 passwords Cons T dblspace As String = vbnewline & vbNewLine Const AUTHORS As String = Dblspace & vbNewLine & _ "adapted from Bob McCormick Base Code by "& _" Norman Harker and JE McGimpsey "Const HEADER as String =" Allinternalpasswords User M Essage "Const version As String = Dblspace &" Version 1.1.1 2003-apr-04 "Const repback As String = Dblspace &" Ple ASE-Failure "& _" to the microsoft.public.excel.programming newsgroup. " Const AllClear as String = Dblspace & "The workbook should" & _ "Now is free of all pasSword protection, so make sure for you: "& _ Dblspace &" SAVE IT now! "& Dblspace &" and also "& _ Dblspac E & "backup!, backup!!, Backup!!!" & _ Dblspace & "Also, remember that password is" & _ "put there F or a reason. Don ' t stuff up crucial formulas "& _" or data. "& Dblspace &" Access and use of some data "& _" May is a N offense. If in doubt, Don ' t. " Const MSGNOPWORDS1 as String = "There were no passwords on" & _ "sheets, or workbook structure or Windows." & AUT Hors & VERSION Const MSGNOPWORDS2 as String = "There is no protection to" & _ "Workbook structure or Windows." & Amp Dblspace & _ "proceeding to unprotect Sheets." & AUTHORS & VERSION Const msgtaketime as String = ' after Pressi Ng OK Button This "& _" would take some time. "& Dblspace &" Amount of Time "& _" depends on how many dif ferent passwords, the "& _" passwords, and your computer ' s specification. "& Dblspace &Amp _ "Just be patient! Make me a coffee! ' & AUTHORS & VERSION Const MSGPWORDFOUND1 as String = ' You had a worksheet ' & _ ' Structure or Windows Password set. "& Dblspace & _" The Password found was: "& Dblspace &" $$ "& Dblspace & _ "Note that the it down for potential future" the "&" of "the" same person who sets this password. "& D Blspace & _ "Now to check and clear other passwords." & AUTHORS & VERSION Const MSGPWORDFOUND2 as String = "Yo U had a worksheet "& _" Password set. "& Dblspace &" The password found was: "& _ Dblspace &" $$ "&A mp Dblspace & "Note it down for potential" & _ "future to other workbooks by same The Who" & _ "Set this Password. "& Dblspace &" Now to check and clear "& _" Other passwords. "& AUTHORS & VERSION Const MS Gonlyone as String = ' Only Structure/windows ' & _ ' protected with the password of that is just found. ' & _ ALlclear & AUTHORS & VERSION & Repback Dim w1 As Worksheet, W2 as worksheet Dim I As Integer, J As Integer, K A s integer, L As Integer Dim m As Integer, n as Integer, I1 as Integer, I2 As Integer Dim i3 As Integer, I4 as Integer, i5 As Integer, I6 As Integer Dim PWord1 As String Dim Shtag As Boolean, Wintag as Boolean application.screenupdating = False With ActiveWorkbook Wintag =. ProtectStructure Or. Protectwindows End With Shtag = False for each w1 in worksheets Shtag = Shtag Or W1. ProtectContents Next W1 If not shtag and not Wintag Then MsgBox, MSGNOPWORDS1, HEADER Exit Sub-End If vbinformation Msgtaketime, vbinformation, header If not Wintag Then MsgBox MSGNOPWORDS2, vbinformation, header Else on Error Resume Nex t do ' dummy does loop for i = the 66:for j = to 66:for k = the For L = the 66:for m = to 66:for I1 = t O for i2 = 66:for i3 = 66:for I4 = "to" for i5 = "to 66:for" I6 = to 66:for n =. 126 with ActiveworkbOok. Unprotect Chr (i) & Chr (j) & Chr (k) & _ Chr (L) & Chr (M) & Chr (I1) & Chr (I2) & _ Chr (i3) & C HR (i4) & Chr (i5) & Chr (I6) & Chr (n) If. ProtectStructure = False and _. Protectwindows = False Then PWord1 = 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, HEADER Exit do ' Bypass all for...nexts end If End With Next:Next:Next:Next:Next:Next N Ext:Next:Next:Next:Next:Next Loop Until True on Error GoTo 0-if Wintag and not Shtag Then MsgBox Msgonlyone, V binformation, HEADER Exit Sub end If on Error Resume Next for each W1 in worksheets ' attempt clearance with PWord1 W1. Unprotect PWord1 Next W1 on Error GoTo 0 shtag = False for each w1 in worksheets ' Checks for all clear shtag triggered to 1 if not. Shtag = Shtag Or W1. ProtectContents Next W1 If ShtaG Then for each w1 in worksheets with W1 If. ProtectContents Then on Error Resume Next does ' Dummy do loop for i = the 66:for j = to 66:for k = 6 5 to 66:for m = 66:for I1 = The i2 = to 66:for i3 = the 66:for to I4 = "to" for i5 = to 66:fo R I6 = 66:for to n = 126. Unprotect Chr (i) & Chr (j) & Chr (k) & _ Chr (L) & Chr (M) & Chr (I1) & Chr (I2) & Chr (i3) & _ C HR (i4) & Chr (i5) & Chr (I6) & Chr (n) If not. ProtectContents Then PWord1 = Chr (i) & Chr (j) & Chr (k) & Chr (L) & _ Chr (M) & Chr (I1) & Chr (I2) &am P CHR (i3) & _ Chr (I4) & Chr (i5) & Chr (I6) & Chr (n) MsgBox Application.Substitute (MSGPWORDFOUND2, _ "$$", Pwo RD1), vbinformation, HEADER ' leverage finding pword by trying on the other sheets to each W2 in worksheets. Unprotect PWord1 Next W2 Exit Do "Bypass all for...nexts end If Next:Next:Next:Next:Next:Next Next:Next:Next:Next: Next:next Loop UntiL True on the Error GoTo 0 End If the WITH Next W1 End If MsgBox allclear & AUTHORS & VERSION & Repback, Vbinforma tion, HEADER end Sub
Cracked so simple. With this approach, the Excel document protection function is in no way a fake.
The test uses the Excel2003 version and passes. 】