Method 1 : VBA
Only work for xls files
------------------
Sub PasswordBreaker()
'Breaks worksheet password protection.
Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
On Error Resume Next
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
ActiveSheet.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 ActiveSheet.ProtectContents = False Then
MsgBox "One usable password is " & Chr(i) & Chr(j) & _
Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _
Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
Exit Sub
End If
Next: Next: Next: Next: Next: Next
Next: Next: Next: Next: Next: Next
End Sub
---------------------------------------------------------
Method 2: edit file type to zip
Work for xlsx
1. Change the xlsx file to zip
2. open the zip file and unzipped the file
3. Within the unzipped file, there is an xl folder. Inside the xl folder, there is a worksheet folder. Within the folder, there are sheets .xml file which is the sheets you want to edit.
4. Open the xml file you need to edit. Find sth like below starting by < sheetprotectionxxxxxxxSHA-512xxxxxxxxx >
e.g.
<sheetProtection algorithmName="SHA-512" hashValue="GJbcCOgov82VcZvcRRA3y24wFFBLmSL/lKfSmQyGs5X4BAf8lTCE8cAw4wj/Aw4BXcl2uGC1O2bchLu46vAscw==" saltValue="Db59P9HLpN3z71NkQZ6yUw==" spinCount="100000" sheet="1" objects="1" scenarios="1"
remove the whole < > which content the "sheetprotection" words.
Save the file.
5.) zip back all the folders and files that unzipped before as zip
6.) change back the zip file name as .xlsx file
7.) Done
No comments:
Post a Comment