標籤:

excel工作表和工作簿的密碼如何破解?

為了保護excel數據,我們經常添加打開或修改需要密碼,但時間一久,自己也把密碼忘了。請問這種情況該怎麼辦?


很多年以前,自習君就被這個問題困擾過,百度下載了一堆破解軟體也無效,還搞得附帶了一堆垃圾軟體。

今天自習君就傳授大家3招破解大法,吸收如何,皆看施主的修行……

1、用AOPR軟體破解——親測有效

AOPR是ADVANCED OFFICEPASSWORD RECOVERY的縮寫。這是一款市面上主流的office密碼破解工具,可對95-2016版本的任何Office文檔進行解密。

但AOPR的致命缺點是——要收費,當然,還有免費版本的,又不過呢,免費的只能破解4個字元以內的密碼。這對很多人來說已經夠了。

下面,我們一起來試一試吧。這個軟體下載和安裝都非常方便

軟體獲取辦法:

微信公眾號後台回復:破解

AOPR官方網下載:http://www.passwordrecovery.cn/

QQ群共享文件:657967533

如果英文不好的,還可以選擇中文顯示

下面是破解的結果,一切密碼都暴露無遺呀(不騙你,真的只用了5秒)

這也說明了office excel 加密的安全級別並不高

(如果軟體運行不了,把殺毒軟體關了再試試吧)

2、用VBA代碼破解

要輸入VBA,首先必須打開工作簿才行,所以該法不適合「打開工作簿需要密碼」的情況。

很多人覺得VBA太難,不懂操作。其實,你不需要懂VBA,只需要懂複製黏貼就可以了。

具體操作如下:

打開需要破解的工作簿——調出VB編輯器(Alt+F11)——粘貼下面這段代碼——運行代碼(F5)

代碼1如下(適合office2007-2016)

Sub PJ()
Dim sht AsWorksheet
For Each sht InWorksheets
sht.Protect AllowFiltering:=True
sht.Unprotect
Next
End Sub

代碼2如下(適合office97-2003)

Public 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 passwords
Const 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 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. Dont stuff up crucial formulas " _
"or data." DBLSPACE "Access and use of some data " _
"may be an offense. If in doubt, dont."
Const MSGNOPWORDS1 As String = "There were no passwords on " _
"sheets, or workbook structure or windows." AUTHORS VERSION
Const MSGNOPWORDS2 As String = "There was no protection to " _
"workbook structure or windows." DBLSPACE _
"Proceeding to unprotect sheets." AUTHORS VERSION
Const 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 computers specification." DBLSPACE _
"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 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 VERSION
Const 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 VERSION
Const MSGONLYONE As String = "Only structure / windows " _
"protected with the password that was just found." _
ALLCLEAR AUTHORS VERSION REPBACK
Dim w1 As Worksheet, w2 As Worksheet
Dim 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
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, vbInformation, HEADER
Exit Sub
End If
MsgBox MSGTAKETIME, vbInformation, HEADER
If Not WinTag Then
MsgBox MSGNOPWORDS2, vbInformation, HEADER
Else
On Error Resume Next
Do dummy do loop
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
For 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 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 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
Next: Next: Next: Next: Next: Next
Loop Until True
On Error GoTo 0
End If
If WinTag And Not ShTag Then
MsgBox MSGONLYONE, vbInformation, 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
Do Dummy do loop
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
For 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
.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 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(MSGPWORDFOUND2, _
"$$", PWord1), vbInformation, HEADER
leverage finding Pword by trying on other sheets
For Each w2 In Worksheets
w2.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 Error GoTo 0
End If
End With
Next w1
End If
MsgBox ALLCLEAR AUTHORS VERSION REPBACK, vbInformation, HEADER
End Sub

3、通過修改源代碼破解

大家發現沒有,office2007開始,文件的後綴名發生了改變,比如xls變為xlsx。

而xlsx格式本質上就是壓縮包,我們可以通過修改後綴名直接獲取excel的源文件。

① 修改Excel後綴名為.rar(期間會提出警告,但不用理它,點「是」即可)

② 找到需要破解的工作表,具體路徑為:

壓縮包.rarxlworksheets

③ 將sheet2.xlm文件(此處根據自己需要選擇文件)複製到桌面;用記事本打開,查找到加密代碼,刪掉;再將文件複製回壓縮包替換掉老文件即可。

加密代碼通常可以從後往前找,含有「protectedRange algorithmName」的整個&<&>裡面內容都是加密代碼,都要刪掉,包括&<&>本身。

④ 最後一步,將壓縮包的後綴名改回.xlsx,大功告成。此時工作表的密碼已經被移除了。

以上步驟看起來很複雜,理順一下思路,原理非常簡單,我們只是把源代碼的加密代碼部分刪掉了而已。

最後,如果只是工作表加密了,我們要修改其中的數據,完全不必大費周章,只需把數據複製到了一個工作表即可。

這也提醒我們,要想別人不輕易盜取你的數據,在設置保護工作表的時候記得去掉「選定單元格」選項前面的√。

...更多回答請看Excel自習室的主頁

...更多文章請到Excel自習室(專欄) - 知乎專欄


對於文件的打開密碼,如果是xls文件,密碼形同虛設,Office Password Remover可瞬間破解,如果是xlsx文件,則用Advanced Office Password Recovery暴力破解,密碼強度高的話,很難破解。

如果是工作表的保護密碼,直接複製工作表就行了。


基本上破解這類密碼多數都是暴力破解,能不能破解就要看你自己搜集的字典有多少了,而且具體也要看密碼的強度了,網上有一些工具,可以嘗試,但是不要報太大希望。


開動腦筋,仔細思考,靈光一現,密碼有了。。。


關注微信公眾號「Excel超人」,進入公眾號「互動問答」,裡頭有詳細解答如何破解EXCEL密碼。


看版本的,一般是暴力破解。如果你是碼農就自己敲一段代碼吧?反正我是把網上寫的VBA那個研究了好久也沒搞明白


推薦閱讀:

管理諮詢工作必備的excel技能有哪些?
資料庫是什麼?它與 Microsoft Excel 有什麼區別?
學習VBA有哪些特殊的技巧?
自學Excel的VBA,感覺完全無法入門啊,腫么辦?

TAG:MicrosoftExcel |