了解密码破解程序的工作原理

时间:2014-09-21 23:03:16

标签: excel vba password-protection

为什么以下代码会破坏Excel密码保护?我用它打破的每张纸都有一个类似于“AAAAABABABAWA'”的密码,但我怀疑这些是实际的密码。

看来我们有一堆奇怪的整数。知道它是如何工作的吗?

  

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

1 个答案:

答案 0 :(得分:7)

这种特殊的密码机制非常糟糕。许多不同的密码可以解锁它。该脚本从AAAAAAAAAAAA开始尝试一堆,并在第一个有效的脚本上停止。这就是为什么它说“一个可用的密码是” - 有许多可用的密码。

详细说明,无论输入密码长度如何,输入密码都会通过产生16位输出的加扰器传递。由于只有65,536个可能的“加扰”值被检查,并且数十亿可能的输入密码,对于您设置的任何密码,还有数十亿个其他不同的密码可用于解锁它。

大多数密码机制都不那么不安全。

请参阅:How does Excel's worksheet password protection work