文章詳情頁
Excel有密碼怎么破解?Excel密碼破解方法介紹
瀏覽:83日期:2022-08-30 11:32:47
Excel密碼破解方法有很多,最常見的便是使用密碼字典去解讀,解讀成功即為破解,而本次使用的是宏命令,若是你還在一籌莫展,可以看看下文中的方法,因為涉及Excel重要文件,若是別人的東西,請獲取授權!
Excel密碼破解方法介紹:
1、進入加密的 Excel 用快捷命令Alt+F8 打開宏命令 窗口。
2、在宏名一欄中 輸入宏的名字 隨意健入即可。
3、輸入完宏名后 創建的按鈕就亮了 點擊創建 我們就可以來到 新的界面了。
4、將編輯框內的Sub knife( )End Sub刪除 將下列代碼 復制 上去。
01Option Explicit02Public Sub AllInternalPasswords()03' Breaks worksheet and workbook structure passwords. Bob McCormick04' probably originator of base code algorithm modified for coverage05' of workbook structure / windows passwords and for multiple passwords06'07' Norman Harker and JE McGimpsey 27-Dec-2002 (Version 1.1)08' Modified 2003-Apr-04 by JEM: All msgs to constants, and09' eliminate one Exit Sub (Version 1.1.1)10' Reveals hashed passwords NOT original passwords11Const DBLSPACE As String = vbNewLine & vbNewLine12Const AUTHORS As String = DBLSPACE & vbNewLine & _13"Adapted from Bob McCormick base code by" & _14"Norman Harker and JE McGimpsey"15Const HEADER As String = "AllInternalPasswords User Message"16Const VERSION As String = DBLSPACE & "Version 1.1.1 2003-Apr-04"17Const REPBACK As String = DBLSPACE & "Please report failure " & _18"to the microsoft.public.excel.programming newsgroup."19Const ALLCLEAR As String = DBLSPACE & "The workbook should " & _20"now be free of all password protection, so make sure you:" & _21DBLSPACE & "SAVE IT NOW!" & DBLSPACE & "and also" & _22DBLSPACE & "BACKUP!, BACKUP!!, BACKUP!!!" & _23DBLSPACE & "Also, remember that the password was " & _24"put there for a reason. Don't stuff up crucial formulas " & _25"or data." & DBLSPACE & "Access and use of some data " & _26"may be an offense. If in doubt, don't."27Const MSGNOPWORDS1 As String = "There were no passwords on " & _28"sheets, or workbook structure or windows." & AUTHORS & VERSION29Const MSGNOPWORDS2 As String = "There was no protection to " & _30"workbook structure or windows." & DBLSPACE & _31"Proceeding to unprotect sheets." & AUTHORS & VERSION32Const MSGTAKETIME As String = "After pressing OK button this " & _33"will take some time." & DBLSPACE & "Amount of time " & _34"depends on how many different passwords, the " & _35"passwords, and your computer's specification." & DBLSPACE & _36"Just be patient! Make me a coffee!" & AUTHORS & VERSION37Const MSGPWORDFOUND1 As String = "You had a Worksheet " & _38"Structure or Windows Password set." & DBLSPACE & _39"The password found was: " & DBLSPACE & "$$" & DBLSPACE & _40"Note it down for potential future use in other workbooks by " & _41"the same person who set this password." & DBLSPACE & _42"Now to check and clear other passwords." & AUTHORS & VERSION43Const MSGPWORDFOUND2 As String = "You had a Worksheet " & _44"password set." & DBLSPACE & "The password found was: " & _45DBLSPACE & "$$" & DBLSPACE & "Note it down for potential " & _46"future use in other workbooks by same person who " & _47"set this password." & DBLSPACE & "Now to check and clear " & _48"other passwords." & AUTHORS & VERSION49Const MSGONLYONE As String = "Only structure / windows " & _50"protected with the password that was just found." & _51ALLCLEAR & AUTHORS & VERSION & REPBACK52Dim w1 As Worksheet, w2 As Worksheet53Dim i As Integer, j As Integer, k As Integer, l As Integer54Dim m As Integer, n As Integer, i1 As Integer, i2 As Integer55Dim i3 As Integer, i4 As Integer, i5 As Integer, i6 As Integer56Dim PWord1 As String57Dim ShTag As Boolean, WinTag As Boolean58Application.ScreenUpdating = False59With ActiveWorkbook60WinTag = .ProtectStructure Or .ProtectWindows61End With62ShTag = False63For Each w1 In Worksheets64ShTag = ShTag Or w1.ProtectContents65Next w166If Not ShTag And Not WinTag Then67MsgBox MSGNOPWORDS1, vbInformation, HEADER68Exit Sub69End If70MsgBox MSGTAKETIME, vbInformation, HEADER71If Not WinTag Then72MsgBox MSGNOPWORDS2, vbInformation, HEADER73Else74On Error Resume Next75Do 'dummy do loop76For i = 65 To 66: For j = 65 To 66: For k = 65 To 6677For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 6678For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 6679For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 12680With ActiveWorkbook81.Unprotect Chr(i) & Chr(j) & Chr(k) & _82Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _83Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)84If .ProtectStructure = False And _85.ProtectWindows = False Then86PWord1 = Chr(i) & Chr(j) & Chr(k) & Chr(l) & _87Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _88Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)89MsgBox Application.Substitute(MSGPWORDFOUND1, _90"$$", PWord1), vbInformation, HEADER91Exit Do 'Bypass all for...nexts92End If93End With94Next: Next: Next: Next: Next: Next95Next: Next: Next: Next: Next: Next96Loop Until True97On Error GoTo 098End If99If WinTag And Not ShTag Then100MsgBox MSGONLYONE, vbInformation, HEADER101Exit Sub102End If103On Error Resume Next104For Each w1 In Worksheets105'Attempt clearance with PWord1106w1.Unprotect PWord1107Next w1108On Error GoTo 0109ShTag = False110For Each w1 In Worksheets111'Checks for all clear ShTag triggered to 1 if not.112ShTag = ShTag Or w1.ProtectContents113Next w1114If ShTag Then115For Each w1 In Worksheets116With w1117If .ProtectContents Then118On Error Resume Next119Do 'Dummy do loop120For i = 65 To 66: For j = 65 To 66: For k = 65 To 66121For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66122For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66123For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126124.Unprotect Chr(i) & Chr(j) & Chr(k) & _125Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _126Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)127If Not .ProtectContents Then128PWord1 = Chr(i) & Chr(j) & Chr(k) & Chr(l) & _129Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _130Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)131MsgBox Application.Substitute(MSGPWORDFOUND2, _132"$$", PWord1), vbInformation, HEADER133'leverage finding Pword by trying on other sheets134For Each w2 In Worksheets135w2.Unprotect PWord1136Next w2137Exit Do 'Bypass all for...nexts138End If139Next: Next: Next: Next: Next: Next140Next: Next: Next: Next: Next: Next141Loop Until True142On Error GoTo 0143End If144End With145Next w1146End If147MsgBox ALLCLEAR & AUTHORS & VERSION & REPBACK, vbInformation, HEADER148End Sub復制代碼Option ExplicitPublic 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 Sub5、關閉 宏窗口 回到Excel下 按ALT+F8 重新打開 宏命令窗口。
6、你會發現 你前面輸入的宏名 變成了AllInternalPasswords 點擊執行 會出現如下對話框 點確定。
7、一直點 確定 直到不在 出現對話框為止。
8、等待 一段之間之后 系統會 再次跳出對話框 再點確定 保護就破解成功了。
!!!注:以上方法僅作為參考教材,請勿用于非法途徑。
以上內容便是Excel密碼破解方法的操作步驟,下次請用戶在設置Excel密碼的時候盡可能的簡單一些,并記錄下密碼備份,避免再次需要使用宏。
標簽:
excel
相關文章:
排行榜