xlsx破除密码保护
点击“宏”→“查看宏”,选择“宏名”下的“PasswordBreaker”并点击“编辑”,打开“Microsoft Visual Basic”编辑器,用如下内容替换右侧窗口中的所有代码:```js
Sub PasswordBreaker()
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)
ActiveWorkbook.Sheets(1).Select
Range("a1").FormulaR1C1 = 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
```
点击运行即可获取密码
原帖https://gist.github.com/parano/1868242 {:4_94:}{:4_94:}{:4_94:} ggnb! 完全不懂宏 看起来有点像遍历 xiaooooooo 发表于 2023-8-20 12:14
ggnb! 完全不懂宏 看起来有点像遍历
我看着也感觉有一点像宏遍历,但是速度真的挺快的
10位密码两三秒就出来了 xiaooooooo 发表于 2023-8-20 12:14
ggnb! 完全不懂宏 看起来有点像遍历
确实是遍历
excel保护薄的密码会通过一个hash函数生成16位的hash值
脚本从AAAAAAAAAAA一路往下遍历一直找到一个可以用的密码
相当于撞击结果hash了
https://chicago.sourceforge.net/devel/docs/excel/encrypt.html
理论最早存在于2001年...
这个代码好像也是2003年左右的
恐怖
这是干吗用的?
页:
[1]