监理检测网论坛

注册

 

发新话题 回复该主题

删除EXCEL工作表保护密码 [复制链接]

1#
Excel工作表保护密码破解方法:Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
1\打开文件Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
2\工具---宏----录制新宏---输入名字如:aaÛ_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
3\停止录制(这样得到一个空宏)Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
4\工具---宏----宏,选aa,点编辑按钮Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
5\删除窗口中的所有字符(只有几个),替换为下面的内容:(复制吧)Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
6\关闭编辑窗口Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
7\工具---宏-----宏,选AllInternalPasswords,运行,确定两次,等2分钟,再确定.OK,没有密码了!!内容如下:Public Sub AllInternalPasswords() Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
' Breaks worksheet and workbook structure passwords. Bob McCormick Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
' probably originator of base code algorithm modified for coverage Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
' of workbook structure / windows passwords and for multiple passwords Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
' Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
' Norman Harker and JE McGimpsey 27-Dec-2002 (Version 1.1) Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
' Modified 2003-Apr-04 by JEM: All msgs to constants, and Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
' eliminate one Exit Sub (Version 1.1.1) Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
' Reveals hashed passwords NOT original passwords Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Const DBLSPACE As String = vbNewLine & vbNewLine Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Const AUTHORS As String = DBLSPACE & vbNewLine & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"Adapted from Bob McCormick base code by" & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"Norman Harker and JE McGimpsey" Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Const HEADER As String = "AllInternalPasswords User Message" Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Const VERSION As String = DBLSPACE & "Version 1.1.1 2003-Apr-04" Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Const REPBACK As String = DBLSPACE & "Please report failure " & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"to the microsoft.public.excel.programming newsgroup." Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Const ALLCLEAR As String = DBLSPACE & "The workbook should " & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"now be free of all password protection, so make sure you:" & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
DBLSPACE & "SAVE IT NOW!" & DBLSPACE & "and also" & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
DBLSPACE & "BACKUP!, BACKUP!!, BACKUP!!!" & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
DBLSPACE & "Also, remember that the password was " & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"put there for a reason. Don't stuff up crucial formulas " & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"or data." & DBLSPACE & "Access and use of some data " & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"may be an offense. If in doubt, don't." Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Const MSGNOPWORDS1 As String = "There were no passwords on " & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"sheets, or workbook structure or windows." & AUTHORS & VERSION Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Const MSGNOPWORDS2 As String = "There was no protection to " & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"workbook structure or windows." & DBLSPACE & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"Proceeding to unprotect sheets." & AUTHORS & VERSION Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Const MSGTAKETIME As String = "After pressing OK button this " & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"will take some time." & DBLSPACE & "Amount of time " & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"depends on how many different passwords, the " & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"passwords, and your computer's specification." & DBLSPACE & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"Just be patient! Make me a coffee!" & AUTHORS & VERSION Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Const MSGPWORDFOUND1 As String = "You had a Worksheet " & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"Structure or Windows Password set." & DBLSPACE & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"The password found was: " & DBLSPACE & "$$" & DBLSPACE & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"Note it down for potential future use in other workbooks by " & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"the same person who set this password." & DBLSPACE & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"Now to check and clear other passwords." & AUTHORS & VERSION Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Const MSGPWORDFOUND2 As String = "You had a Worksheet " & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"password set." & DBLSPACE & "The password found was: " & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
DBLSPACE & "$$" & DBLSPACE & "Note it down for potential " & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"future use in other workbooks by same person who " & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"set this password." & DBLSPACE & "Now to check and clear " & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"other passwords." & AUTHORS & VERSION Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Const MSGONLYONE As String = "Only structure / windows " & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"protected with the password that was just found." & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
ALLCLEAR & AUTHORS & VERSION & REPBACK Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Dim w1 As Worksheet, w2 As Worksheet Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Dim i As Integer, j As Integer, k As Integer, l As Integer Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Dim m As Integer, n As Integer, i1 As Integer, i2 As Integer Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Dim i3 As Integer, i4 As Integer, i5 As Integer, i6 As Integer Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Dim PWord1 As String Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Dim ShTag As Boolean, WinTag As Boolean Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Application.ScreenUpdating = False Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
With ActiveWorkbook Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
WinTag = .ProtectStructure Or .ProtectWindows Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
End With Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
ShTag = False Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
For Each w1 In Worksheets Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
ShTag = ShTag Or w1.ProtectContents Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Next w1 Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
If Not ShTag And Not WinTag Then Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
MsgBox MSGNOPWORDS1, vbInformation, HEADER Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Exit Sub Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
End If Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
MsgBox MSGTAKETIME, vbInformation, HEADER Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
If Not WinTag Then Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
MsgBox MSGNOPWORDS2, vbInformation, HEADER Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Else Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
On Error Resume Next Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Do 'dummy do loop Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66 Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66 Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66 Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126 Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
With ActiveWorkbook Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
.Unprotect Chr(i) & Chr(j) & Chr(k) & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n) Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
If .ProtectStructure = False And _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
.ProtectWindows = False Then Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
PWord1 = Chr(i) & Chr(j) & Chr(k) & Chr(l) & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n) Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
MsgBox Application.Substitute(MSGPWORDFOUND1, _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"$$", PWord1), vbInformation, HEADER Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Exit Do 'Bypass all for...nexts Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
End If Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
End With Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Next: Next: Next: Next: Next: Next Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Next: Next: Next: Next: Next: Next Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Loop Until True Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
On Error GoTo 0 Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
End If Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
If WinTag And Not ShTag Then Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
MsgBox MSGONLYONE, vbInformation, HEADER Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Exit Sub Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
End If Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
On Error Resume Next Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
For Each w1 In Worksheets Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
'Attempt clearance with PWord1 Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
w1.Unprotect PWord1 Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Next w1 Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
On Error GoTo 0 Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
ShTag = False Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
For Each w1 In Worksheets Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
'Checks for all clear ShTag triggered to 1 if not. Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
ShTag = ShTag Or w1.ProtectContents Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Next w1 Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
If ShTag Then Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
For Each w1 In Worksheets Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
With w1 Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
If .ProtectContents Then Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
On Error Resume Next Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Do 'Dummy do loop Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66 Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66 Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66 Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126 Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
.Unprotect Chr(i) & Chr(j) & Chr(k) & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n) Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
If Not .ProtectContents Then Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
PWord1 = Chr(i) & Chr(j) & Chr(k) & Chr(l) & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n) Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
MsgBox Application.Substitute(MSGPWORDFOUND2, _ Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
"$$", PWord1), vbInformation, HEADER Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
'leverage finding Pword by trying on other sheets Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
For Each w2 In Worksheets Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
w2.Unprotect PWord1 Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Next w2 Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Exit Do 'Bypass all for...nexts Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
End If Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Next: Next: Next: Next: Next: Next Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Next: Next: Next: Next: Next: Next Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Loop Until True Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
On Error GoTo 0 Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
End If Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
End With Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
Next w1 Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
End If Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
MsgBox ALLCLEAR & AUTHORS & VERSION & REPBACK, vbInformation, HEADER Û_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
End SubÛ_É«ƒ ¦=bbs.3c3t.comóÆð3ÖÊ—Š
分享 转发
TOP
发主话题 回复该主题