我被要求更新一些Excel 2003宏,但是VBA项目有密码保护,而且似乎缺乏文档…没人知道密码。
是否有一种方法可以删除或破解VBA项目的密码?
我被要求更新一些Excel 2003宏,但是VBA项目有密码保护,而且似乎缺乏文档…没人知道密码。
是否有一种方法可以删除或破解VBA项目的密码?
保护是Excel中的一个简单的文本比较。 在你最喜欢的调试器中加载Excel (Ollydbg是我选择的工具),找到进行比较的代码并将其修复为总是返回true,这应该可以让你访问宏。
是的,只要你使用的是。xls格式的电子表格(2003年以前Excel的默认格式)。对于Excel 2007以后,默认是.xlsx,这是一个相当安全的格式,这个方法将不起作用。
正如Treb所说,这是一个简单的比较。一种方法是使用十六进制编辑器(参见Windows的十六进制编辑器)简单地交换文件中的密码条目。循序渐进的例子:
Create a new simple excel file. In the VBA part, set a simple password (say - 1234). Save the file and exit. Then check the file size - see Stewbob's gotcha Open the file you just created with a hex editor. Copy the lines starting with the following keys: CMG=.... DPB=... GC=... FIRST BACKUP the excel file you don't know the VBA password for, then open it with your hex editor, and paste the above copied lines from the dummy file. Save the excel file and exit. Now, open the excel file you need to see the VBA code in. The password for the VBA code will simply be 1234 (as in the example I'm showing here).
如果你需要使用Excel 2007或2010,下面有一些其他的答案可能会有帮助,特别是这些:1、2、3。
编辑2015年2月:另一种看起来很有前途的方法,看看Đức Thanh nguy的新答案。
Colin Pickard has an excellent answer, but there is one 'watch out' with this. There are instances (I haven't figured out the cause yet) where the total length of the "CMG=........GC=...." entry in the file is different from one excel file to the next. In some cases, this entry will be 137 bytes, and in others it will be 143 bytes. The 137 byte length is the odd one, and if this happens when you create your file with the '1234' password, just create another file, and it should jump to the 143 byte length.
如果您尝试将错误的字节数粘贴到文件中,当您尝试用Excel打开该文件时,您将丢失VBA项目。
EDIT
这对Excel 2007/2010文件无效。标准的。xlsx文件格式实际上是一个。zip文件,包含许多子文件夹,其中格式、布局、内容等存储为xml数据。对于未受保护的Excel 2007文件,只需将.xlsx扩展名更改为.zip,然后打开zip文件并查看所有xml数据。这很简单。
但是,当您对Excel 2007文件进行密码保护时,整个.zip (.xlsx)文件实际上是使用RSA加密进行加密的。不再可以将扩展名更改为.zip并浏览文件内容。
Tom -我最初犯了一个学生错误,因为我没有注意字节大小,而是从“CMG”设置复制粘贴到后续条目。这两个文件之间有两种不同的文本大小,但是,正如Stewbob警告的那样,我丢失了VBA项目。
使用HxD,有一个计数器跟踪您选择了多少文件。从CMG开始复制,直到计数器读取8F(十六进制为143),同样地,当粘贴到锁定文件时-我最终在粘贴的末尾使用了两倍的“…”,这看起来有点奇怪,感觉几乎不自然,但它起作用了。
我不知道这是否重要,但在excel中重新打开文件之前,我确保关闭了十六进制编辑器和excel。然后我必须通过菜单打开VB编辑器,进入VBProject属性,并输入'new'密码来解锁代码。
我希望这能有所帮助。
你试过在OpenOffice.org中打开它们吗?
前段时间我遇到了类似的问题,发现Excel和Calc不能理解彼此的加密,因此允许直接访问几乎所有内容。
这是一段时间以前,所以如果这不仅仅是我的侥幸,它也可能已经被修补。
还有另一种更简单的解决方案,不存在尺寸问题。今天我使用了这种方法(在一个2003年的XLS文件上,使用Excel 2007),并且取得了成功。
备份xls文件 在HEX编辑器中打开文件,并找到DPB=…部分 更改DPB=…string to DPx=… 在Excel中打开xls文件 打开VBA编辑器(ALT + F11) 魔术: Excel发现一个无效的键(DPx),并询问您是否要继续加载项目(基本上忽略保护) 您将能够覆盖密码,因此将其更改为您可以记住的密码 保存xls文件* 关闭并重新打开文档并使用您的VBA魔法!
*注意:请确保您已将密码更改为新值,否则下次打开电子表格Excel将报告错误(意外错误),然后当您访问VBA模块列表时,您现在将看到源模块的名称,但在尝试打开表单/代码/等时收到另一个错误。要解决这个问题,请返回VBA项目属性并将密码设置为新值。保存并重新打开Excel文档,您应该可以开始了!
Colin Pickard is mostly correct, but don't confuse the "password to open" protection for the entire file with the VBA password protection, which is completely different from the former and is the same for Office 2003 and 2007 (for Office 2007, rename the file to .zip and look for the vbaProject.bin inside the zip). And that technically the correct way to edit the file is to use a OLE compound document viewer like CFX to open up the correct stream. Of course, if you are just replacing bytes, the plain old binary editor may work.
顺便说一句,如果你想知道这些字段的确切格式,他们现在有文档:
http://msdn.microsoft.com/en-us/library/dd926151%28v=office.12%29.aspx
万一你的街区 没有发生= \ r \ nDPB“XXXX”=“XXXXX”\ r \ nGC =“XXXXXX” 如果您的“已知密码”文件比“未知密码”文件中的现有块短,请用后面的零填充十六进制字符串以达到正确的长度。
e.g.
CMG=“xxxxxx”\r\nDPB=“xxxxx”\r\nGC=“xxxxx”
在未知密码文件中,应设置为
CMG="XXXX00"\r\nDPB="XXXXX000"\r\nGC="XXXXXX0000"保留文件长度。
我在office 2007中也使用过。xla(97/2003格式)文件。
如果该文件是一个有效的zip文件(前几个字节是504b——用于.xlsm等格式),那么解压缩该文件并查找子文件xl/vbaProject.bin。这是一个CFB文件,就像.xls文件一样。按照XLS格式的说明(应用于子文件),然后压缩内容。
对于XLS格式,您可以使用本文中的其他一些方法。我个人更喜欢搜索DPB=块并替换文本
CMG="..."
DPB="..."
GC="..."
有空格。这样就避免了CFB容器大小的问题。
对于Excel 2007,您需要将文件扩展名更改为。zip 在存档中有一个子文件夹xl,在那里你会发现vbaProject.bin。 使用vbaProject.bin执行上面的步骤,然后将其保存回存档中。 修改回您的扩展名和voilà!(意思是遵循上面的步骤)
您可以尝试这种不需要HEX编辑的直接VBA方法。它将适用于任何文件(*.xls, *.xls, *.xls)。xlsm, *。xlam……)。
测试和工作:
Excel 2007 Excel 2010 Excel 2013 - 32位版本 Excel 2016 - 32位版本
寻找64位版本?请看这个答案
它是如何工作的
我会尽我最大的努力解释它是如何工作的-请原谅我的英语。
The VBE will call a system function to create the password dialog box. If user enters the right password and click OK, this function returns 1. If user enters the wrong password or click Cancel, this function returns 0. After the dialog box is closed, the VBE checks the returned value of the system function if this value is 1, the VBE will "think" that the password is right, hence the locked VBA project will be opened. The code below swaps the memory of the original function used to display the password dialog with a user defined function that will always return 1 when being called.
使用代码
请先备份您的文件!
Open the file(s) that contain your locked VBA Projects Create a new xlsm file and store this code in Module1 code credited to Siwtom (nick name), a Vietnamese developer Option Explicit Private Const PAGE_EXECUTE_READWRITE = &H40 Private Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" _ (Destination As Long, Source As Long, ByVal Length As Long) Private Declare Function VirtualProtect Lib "kernel32" (lpAddress As Long, _ ByVal dwSize As Long, ByVal flNewProtect As Long, lpflOldProtect As Long) As Long Private Declare Function GetModuleHandleA Lib "kernel32" (ByVal lpModuleName As String) As Long Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, _ ByVal lpProcName As String) As Long Private Declare Function DialogBoxParam Lib "user32" Alias "DialogBoxParamA" (ByVal hInstance As Long, _ ByVal pTemplateName As Long, ByVal hWndParent As Long, _ ByVal lpDialogFunc As Long, ByVal dwInitParam As Long) As Integer Dim HookBytes(0 To 5) As Byte Dim OriginBytes(0 To 5) As Byte Dim pFunc As Long Dim Flag As Boolean Private Function GetPtr(ByVal Value As Long) As Long GetPtr = Value End Function Public Sub RecoverBytes() If Flag Then MoveMemory ByVal pFunc, ByVal VarPtr(OriginBytes(0)), 6 End Sub Public Function Hook() As Boolean Dim TmpBytes(0 To 5) As Byte Dim p As Long Dim OriginProtect As Long Hook = False pFunc = GetProcAddress(GetModuleHandleA("user32.dll"), "DialogBoxParamA") If VirtualProtect(ByVal pFunc, 6, PAGE_EXECUTE_READWRITE, OriginProtect) <> 0 Then MoveMemory ByVal VarPtr(TmpBytes(0)), ByVal pFunc, 6 If TmpBytes(0) <> &H68 Then MoveMemory ByVal VarPtr(OriginBytes(0)), ByVal pFunc, 6 p = GetPtr(AddressOf MyDialogBoxParam) HookBytes(0) = &H68 MoveMemory ByVal VarPtr(HookBytes(1)), ByVal VarPtr(p), 4 HookBytes(5) = &HC3 MoveMemory ByVal pFunc, ByVal VarPtr(HookBytes(0)), 6 Flag = True Hook = True End If End If End Function Private Function MyDialogBoxParam(ByVal hInstance As Long, _ ByVal pTemplateName As Long, ByVal hWndParent As Long, _ ByVal lpDialogFunc As Long, ByVal dwInitParam As Long) As Integer If pTemplateName = 4070 Then MyDialogBoxParam = 1 Else RecoverBytes MyDialogBoxParam = DialogBoxParam(hInstance, pTemplateName, _ hWndParent, lpDialogFunc, dwInitParam) Hook End If End Function Paste this code under the above code in Module1 and run it Sub unprotected() If Hook Then MsgBox "VBA Project is unprotected!", vbInformation, "*****" End If End Sub Come back to your VBA Projects and enjoy.
我基于Đức Thanh nguynun的精彩回答,让这种方法适用于64位版本的Excel。我在64位的Windows 7上运行Excel 2010 64位。
Open the file(s) that contain your locked VBA Projects. Create a new xlsm file and store this code in Module1 Option Explicit Private Const PAGE_EXECUTE_READWRITE = &H40 Private Declare PtrSafe Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" _ (Destination As LongPtr, Source As LongPtr, ByVal Length As LongPtr) Private Declare PtrSafe Function VirtualProtect Lib "kernel32" (lpAddress As LongPtr, _ ByVal dwSize As LongPtr, ByVal flNewProtect As LongPtr, lpflOldProtect As LongPtr) As LongPtr Private Declare PtrSafe Function GetModuleHandleA Lib "kernel32" (ByVal lpModuleName As String) As LongPtr Private Declare PtrSafe Function GetProcAddress Lib "kernel32" (ByVal hModule As LongPtr, _ ByVal lpProcName As String) As LongPtr Private Declare PtrSafe Function DialogBoxParam Lib "user32" Alias "DialogBoxParamA" (ByVal hInstance As LongPtr, _ ByVal pTemplateName As LongPtr, ByVal hWndParent As LongPtr, _ ByVal lpDialogFunc As LongPtr, ByVal dwInitParam As LongPtr) As Integer Dim HookBytes(0 To 5) As Byte Dim OriginBytes(0 To 5) As Byte Dim pFunc As LongPtr Dim Flag As Boolean Private Function GetPtr(ByVal Value As LongPtr) As LongPtr GetPtr = Value End Function Public Sub RecoverBytes() If Flag Then MoveMemory ByVal pFunc, ByVal VarPtr(OriginBytes(0)), 6 End Sub Public Function Hook() As Boolean Dim TmpBytes(0 To 5) As Byte Dim p As LongPtr Dim OriginProtect As LongPtr Hook = False pFunc = GetProcAddress(GetModuleHandleA("user32.dll"), "DialogBoxParamA") If VirtualProtect(ByVal pFunc, 6, PAGE_EXECUTE_READWRITE, OriginProtect) <> 0 Then MoveMemory ByVal VarPtr(TmpBytes(0)), ByVal pFunc, 6 If TmpBytes(0) <> &H68 Then MoveMemory ByVal VarPtr(OriginBytes(0)), ByVal pFunc, 6 p = GetPtr(AddressOf MyDialogBoxParam) HookBytes(0) = &H68 MoveMemory ByVal VarPtr(HookBytes(1)), ByVal VarPtr(p), 4 HookBytes(5) = &HC3 MoveMemory ByVal pFunc, ByVal VarPtr(HookBytes(0)), 6 Flag = True Hook = True End If End If End Function Private Function MyDialogBoxParam(ByVal hInstance As LongPtr, _ ByVal pTemplateName As LongPtr, ByVal hWndParent As LongPtr, _ ByVal lpDialogFunc As LongPtr, ByVal dwInitParam As LongPtr) As Integer If pTemplateName = 4070 Then MyDialogBoxParam = 1 Else RecoverBytes MyDialogBoxParam = DialogBoxParam(hInstance, pTemplateName, _ hWndParent, lpDialogFunc, dwInitParam) Hook End If End Function Paste this code in Module2 and run it Sub unprotected() If Hook Then MsgBox "VBA Project is unprotected!", vbInformation, "*****" End If End Sub
这对我来说很有效,我在这里记录了它,希望它能帮助别人。我还没有完全测试过。请确保在继续此选项之前保存所有打开的文件。
对于.xlsm或.dotm文件类型,您需要以稍微不同的方式进行操作。
Change the extension of the .xlsm file to .zip. Open the .zip file (with WinZip or WinRar etc) and go to the xl folder. Extract the vbaProject.bin file and open it in a Hex Editor (I use HxD, its completely free and lightweight.) Search for DPB and replace with DPx and save the file. Replace the old vbaProject.bin file with this new on in the zipped file. Change the file extension back to .xlsm. Open workbook skip through the warning messages. Open up Visual Basic inside Excel. Go to Tools > VBAProject Properties > Protection Tab. Put in a new password and save the .xlsm file. Close and re open and your new password will work.
我尝试了上面的一些解决方案,但没有一个适合我(excel 2007 xlsm文件)。然后我找到了另一个解决方案,甚至检索密码,而不仅仅是破解它。
将此代码插入模块,运行它并给它一些时间。它将恢复您的密码的蛮力。
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
您的excel文件扩展名更改为xml。 然后用记事本打开。 密码文本在XML文件中找到。
你看下面这条线;
Sheets("Sheet1").Unprotect Password:="blabla"
(抱歉我的英语不好)
对于Windows 10机器上的Excel 2016 64位,我使用了十六进制编辑器来更改受保护的xla的密码(尚未对任何其他扩展进行测试)。 提示:在执行此操作之前创建备份。
我采取的步骤:
在十六进制编辑器中打开vba(例如XVI) 搜索这个DPB 将DPB更改为其他内容,如DPX 保存它! 重新打开.xla,将出现一条错误消息,继续。 您现在可以通过打开属性并转到password选项卡来更改.xla的密码。
我希望这对你们中的一些人有所帮助!
Access、Excel、Powerpoint或Word文档上的VBA项目密码(带有扩展名. accdb . xlsm . xltm . docm . dotm . potm . ppsm的2007、2010、2013或2016版本)可以轻松删除。
这只是将文件名扩展名更改为. zip,解压缩文件,并使用任何基本的十六进制编辑器(如XVI32)来“打破”现有密码的问题,这会“混淆”Office,因此它会在下次打开文件时提示输入新密码。
步骤总结:
rename the file so it has a .ZIP extension. open the ZIP and go to the XL folder. extract vbaProject.bin and open it with a Hex Editor "Search & Replace" to "replace all" changing DPB to DPX. Save changes, place the .bin file back into the zip, return it to it's normal extension and open the file like normal. ALT+F11 to enter the VB Editor and right-click in the Project Explorer to choose VBA Project Properties. On the Protection tab, Set a new password. Click OK, Close the file, Re-open it, hit ALT+F11. Enter the new password that you set.
此时,如果您愿意,您可以完全删除密码。
完整的说明和我制作的“way back when”视频在YouTube上。
令人震惊的是,这种解决方法已经存在多年了,而微软还没有解决这个问题。
这个故事的寓意是什么?
Microsoft Office VBA项目密码不依赖于任何敏感信息的安全。如果安全性很重要,请使用第三方加密软件。
编辑:这是已接受答案的更新版本,应该适用于更多的办公室版本。这很难,但让我们把这个答案说出来吧!
轮到我了,这是建立在kaybee99的优秀答案之上的,它建立在Đức Thanh nguykun的出色答案之上,允许这种方法与32/64位版本的Office一起工作。
概览一下更改的内容,我们避免了push/ret,它仅限于32位地址,并将其替换为mov/jmp reg。
它是如何工作的
Open the file(s) that contain your locked VBA Projects. Create a new file with the same type as the above and store this code in Module1 Option Explicit Private Const PAGE_EXECUTE_READWRITE = &H40 Private Declare PtrSafe Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" _ (Destination As LongPtr, Source As LongPtr, ByVal Length As LongPtr) Private Declare PtrSafe Function VirtualProtect Lib "kernel32" (lpAddress As LongPtr, _ ByVal dwSize As LongPtr, ByVal flNewProtect As LongPtr, lpflOldProtect As LongPtr) As LongPtr Private Declare PtrSafe Function GetModuleHandleA Lib "kernel32" (ByVal lpModuleName As String) As LongPtr Private Declare PtrSafe Function GetProcAddress Lib "kernel32" (ByVal hModule As LongPtr, _ ByVal lpProcName As String) As LongPtr Private Declare PtrSafe Function DialogBoxParam Lib "user32" Alias "DialogBoxParamA" (ByVal hInstance As LongPtr, _ ByVal pTemplateName As LongPtr, ByVal hWndParent As LongPtr, _ ByVal lpDialogFunc As LongPtr, ByVal dwInitParam As LongPtr) As Integer Dim HookBytes(0 To 11) As Byte Dim OriginBytes(0 To 11) As Byte Dim pFunc As LongPtr Dim Flag As Boolean Private Function GetPtr(ByVal Value As LongPtr) As LongPtr GetPtr = Value End Function Public Sub RecoverBytes() If Flag Then MoveMemory ByVal pFunc, ByVal VarPtr(OriginBytes(0)), 12 End Sub Public Function Hook() As Boolean Dim TmpBytes(0 To 11) As Byte Dim p As LongPtr, osi As Byte Dim OriginProtect As LongPtr Hook = False #If Win64 Then osi = 1 #Else osi = 0 #End If pFunc = GetProcAddress(GetModuleHandleA("user32.dll"), "DialogBoxParamA") If VirtualProtect(ByVal pFunc, 12, PAGE_EXECUTE_READWRITE, OriginProtect) <> 0 Then MoveMemory ByVal VarPtr(TmpBytes(0)), ByVal pFunc, osi+1 If TmpBytes(osi) <> &HB8 Then MoveMemory ByVal VarPtr(OriginBytes(0)), ByVal pFunc, 12 p = GetPtr(AddressOf MyDialogBoxParam) If osi Then HookBytes(0) = &H48 HookBytes(osi) = &HB8 osi = osi + 1 MoveMemory ByVal VarPtr(HookBytes(osi)), ByVal VarPtr(p), 4 * osi HookBytes(osi + 4 * osi) = &HFF HookBytes(osi + 4 * osi + 1) = &HE0 MoveMemory ByVal pFunc, ByVal VarPtr(HookBytes(0)), 12 Flag = True Hook = True End If End If End Function Private Function MyDialogBoxParam(ByVal hInstance As LongPtr, _ ByVal pTemplateName As LongPtr, ByVal hWndParent As LongPtr, _ ByVal lpDialogFunc As LongPtr, ByVal dwInitParam As LongPtr) As Integer If pTemplateName = 4070 Then MyDialogBoxParam = 1 Else RecoverBytes MyDialogBoxParam = DialogBoxParam(hInstance, pTemplateName, _ hWndParent, lpDialogFunc, dwInitParam) Hook End If End Function Paste this code in Module2 and run it Sub unprotected() If Hook Then MsgBox "VBA Project is unprotected!", vbInformation, "*****" End If End Sub
接受的答案在Windows 10上的Excel 2019中无法正常工作。找到了查看锁定宏所需的额外步骤。我正在总结步骤。
Add a .zip to the end of the excel filename and hit enter Once the file has been changed to a ZIP file, open it by double clicking on it Inside you would see a folder called xl like below Inside xl, you'll find a file called vbaProject.bin, copy/paste it on the desktop Go to the online Hexadecimal Editor HexEd.it Search for the following texts DPB=... and change them to DPx=... Save the file and close HexEd.it Copy/Paste the updated file from your desktop inside the ZIP file (you would need to overwrite it) Remove the .zip extension from the end of the filename and add the excel extention again. Open the file in excel - you may receive a couple of error notifications, just click through them.
====在接受的答案=====之外的额外步骤
Open the Visual Basic window (usually ALT+F11 if I remember correctly) and open the VBAProject properties (Tools menu). Click on the Protection tab and change (do not remove at this stage) the password to something short and easy to remember (we'll be removing in next step). Save the workbook and then close and reopen. Open again the Visual Basic window and enter the password you just put in. Redo the previous step but this time you can remove (delete) the password. Save the workbook and you have now removed the password.
从以下站点采取额外步骤 https://confluence.jaytaala.com/display/TKB/Remove+Excel+VBA+password
事实上,大多数启用宏的Office文档的代码文件都没有加密,密码只会阻止使用Office程序打开项目。 这意味着,正如其他答案所建议的那样,您通常可以使用Office替代品来访问和编辑该文件。
但是,如果你只是需要访问代码,你可以使用oldump .py这样的工具来提取宏代码。这对于恶意软件分析非常有用,还可以从文件中获取大部分代码,这样如果忘记密码,就不必从头开始了。
此外,许多excel文件在打开时动态设置密码。这意味着如果您可以阅读代码,您通常可以找到明文密码或消除混淆。
oledump.py例子:
列出一个办公文档中的所有“流”(嵌入式二进制文件或代码文件):
python oledump.py -v yourExcelFile.xlsm
输出:
A: xl/vbaProject.bin
A1: 2000 'PROJECT'
A2: 1500 'PROJECTwm'
A3: M 1224 'VBA/Module1'
A4: M 18694 'VBA/Module2'
A5: M 11877 'VBA/Module3'
...
旁边带M的流是宏,这是未加密的VBA代码
提取流
python oledump.py -s A3 -v yourExcelFile.xlsm > Module1.vba
这将把A3流中包含的代码输出到Module1.vba。
我通常将此与循环结合起来,将所有文件解压缩到一个文件夹中。这个快速的PowerShell脚本将提取大多数文件中的所有流:
New-Item -ItemType Directory "Output"
# just hardcode the highest stream outputted by oledump.py -v
$max = 5
for ($i = 1; $i -le $max; $i++) {
python oledump.py -s "A$i" -v yourExcelFile.xlsm > ".\Output\A$i"
}
注意,这将只提取人类可读的文件。
删除VBA项目密码的一个简单方法是执行以下操作:
将xlsm文件转换为zip 打开VBAProject.bin文件(我更喜欢使用notepad++ (https://notepad-plus-plus.org/downloads/)) 搜索DPB字段 用DPx替换它 保存文件 将zip文件转换为XLSM 打开excel文件 如果出现消息框,请单击“是” 为VBA项目属性设置新密码 关闭并再次打开该文件 输入新密码取消保护