当前位置:文档之家› 破解excel加密 宏命令

破解excel加密 宏命令

破解excel 加密宏命令Option Explicit Public Sub AllInternal Password s()' Breaks worksheet and workbook structure password s. Bob McCormic k' probably originator of base code algorithm modified for coverage ' of workbook structure / windows password s and for multiple password s'' Norman Harker and JE McGimps ey 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 password s NOT original password sConst DBLSPA CE As String = vbNewLin e & vbNewLin eConst AUTHOR S As String = DBLSPA CE & vbNewLin e & _ Adapted from Bob McCormic k base code by & _ Norman Harker and JE McGimps eyAs String = "AllInterna lPassword s User Message" Const VERSION As String = DBLSPA CE & "Version 1.1.1 2003-Apr-04" Const REPBAC K As String = DBLSPA CE & "Please report failure " & _to the microsoft. public.exc el.progra mming newsgrou p.Const ALLCLEA R As String = DBLSPA CE & "The workbook should " & _password protection , so make sure you: & _ DBLSPA CE & "SAVE IT NOW!" & DBLSPA CE & "and also" & _ DBLSPA CE & "BACKUP !, BACKUP! !, BACKUP! !!" & _ DBLSPA CE & "Also, remember that the password was " & _ put there for a reason. Don't stuff up crucial formulas & _or data. & DBLSPA CE & "Access and use of some data " & _ may be an offense. If in doubt,WORDS1 As String = "There were no password s on " & _ sheets, or workbook structure or windows. & AUTHOR S & VERSION Const MSGNOP WORDS2 As String = "There was no protection to " & _ workbook structure or windows. & DBLSPA CE & _ Proceedin g to unprotect sheets. & AUTHOR S & VERSION Const MSGTAK ETIME As String = "After pressing OK button this " & _some time. & DBLSPA CE & "Amount of time " & _ depends on how many different password s, the & _ password s, and your computer' s specificati on. & DBLSPA CE & _ Just be patient! Make me a coffee! & AUTHOR S & VERSION Const MSGPW ORDFOU ND1 As String = "You had a Workshee t " & _ Structure or Windows Password set. & DBLSPA CE & _The password found was: & DBLSPA CE & "$$" & DBLSPA CE & _ Note it down for potential future use in other workbook s by & _ the same person who set this password. & DBLSPA CE & _ Now to check and clear other password s. & AUTHOR S & Const MSGPW ORDFOU ND2 As String = "You had a Workshee t " & _ password set. & DBLSPA CE & "The password found was: " & _CE & "$$" & DBLSPA CE & "Note it down for potential " & _ future use in other workbook s by same person who & _ set this password. & DBLSPA CE & "Now to check and clear " & _ other password s. & AUTHOR S & VERSION Const MSGONL YONE As String = "Only structure / windows " & _ protected with the password that was just found. & _R & AUTHOR S & VERSION & REPBAC KDim w1 As Workshee t, w2 As Workshee tDim i As Integer, j As Integer, k As 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 Applicatio n.Screen Updating = FalseWith ActiveWor kbook WinTag = .ProtectSt ructure Or .ProtectW indows End With ShTag = FalseFor Each w1 In Workshee tsShTag = ShTag Or w1.Protec tContents Next w1 If Not ShTag And Not WinTag Then MsgBox MSGNOP WORDS1 , vbInforma tion, HEADER Exit Sub End If MsgBox MSGTAK ETIME, vbInforma tion, HEADER If Not WinTag ThenWORDS2 , vbInforma tion, HEADER ElseOn Error Resume NextDo'dummy do loop For 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 66 For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126 With ActiveWor kbook.Unprotect Chr(i) & Chr(j) & Chr(k) & _Chr(i1) & Chr(i2) & _Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)If.ProtectSt ructure = False And _.ProtectW indows = 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 Applicatio n.Substitu te(MSGP WORDFO UND1, _ $$, PWord1), vbInforma tion, HEADER Exit Do'Bypass all for...nexts End IfNext: Next: Next: Next: Next: Next: Next: Next: Next: Loop Until TrueOn Error GoTo 0 End IfIf WinTag And Not ShTag Then MsgBox MSGONL YONE, vbInforma tion, HEADER Exit Sub End IfOn Error Resume NextFor Each w1 In Workshee ts'Attempt clearance with PWord1 w1.Unprot ect PWord1 Next w1 On Error GoTo 0 ShTag = FalseWorkshee ts'Checks for all clear ShTag triggered to 1 if not. ShTag = ShTag Or w1.Protec tContents Next w1 If ShTag ThenFor Each w1 In Workshee tsWith w1 If.ProtectC ontents ThenOn Error Resume NextDo'Dummy do loop For 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 i3 = 65 To 66: For i4 = 65 To 66 For 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.ProtectC ontents 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)n.Substitu te(MSGP WORDFO UND2, _ $$, PWord1), vbInforma tion, HEADER 'leverage finding Pword by trying on other sheets For Each w2 In Workshee tsw2.Unprot ect PWord1 Next w2 Exit Do'Bypass all for...nexts End If Next: Next: Next: Next: Next: Next: Next: Next: Next: Next: Loop Until TrueOn Error GoTo 0 End If End With Next w1 End IfR & AUTHOR S & VERSION & REPBAC K, vbInforma tion, HEADER End Sub。

相关主题