Documentos de Académico
Documentos de Profesional
Documentos de Cultura
VBA un protection
http://lbeliarl.blogspot.in/
Features:
in workbook.xml file (inside zip archive), but 2007 version uses AES-128 encryption for
files which have WorkBook protection option (meaning that even if you do not use your
own password (leave it blank) when switch on WorkBook protection option Excel uses
'VelvetSweatshop' password for encrypting your file). So, you can't access inside excel file
structure that easy, but checking 32768 values takes from few second to several minutes
(on old PCs).
Yet in Excel 2013 Microsoft used another trick - changed tactic of calculation password
HASH from 50 000 rounds of AES-128 to 100 000 rounds of AES-512, that significantly
increased calculation time (from a 5-15 sec to 6 hours on AMD 4-cores 3,2 Ghz). Originally
this tool was developed for 2007 Excel, and not took into account changes in 2013
version.
Please consider, that for some files method to unlock VBA Project may not work (because
method build on 'known trick' rather than understanding technology behind).
Posted by Anton at 12:32 56 comments:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
W ednesday, 8 January 2014
1.
2.
3.
4.
5.
6.
7.
8.
DPB="282A84CBA1CBA1345FCCB154E20721DE77F7D2378D0EAC90427A22021A46E9CE6F1718
8A". (This value generated for 'macro' password. You can use this DPB value to skip steps
1-8)
9. Do steps 4-7 for file with unknown password (file you want to unlock).
10. Change DBP value in this file on value that you have copied in step 8.
>>If copied value is shorter than in encrypted file you should populate missing characters
with 0 (zero). If value is longer - that is not a problem (paste as it is).
11. Save the 'vbaProject.bin' file and exit from hex editor.
12. Replace existing 'vbaProject.bin' file with modified one.
13. Change extention from '.zip' back to '.xlsm'
14. Now, open the excel file you need to see the VBA code in. The password for the VBA
code
will simply be macro (as in the example I'm showing here).
For those who still using old file format (2003 - .xls) method has less steps:
1. Open .xls file with hex editor (for example HxD).
2. Find parameter DPB, change value for this parameter by our own. If your value is
shorter than value in encrypted file, you should populate missing characters with 0
(zero). If value is longer - that is not a problem (paste as it is).
DPB="282A84CBA1CBA1345FCCB154E20721DE77F7D2378D0EAC90427A22021A46E9CE6F1718
8A". (This value generated for 'macro' password).
3. Save changes.
Sheet Unprotection
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