监理检测网论坛

注册

 

发新话题 回复该主题

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

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