顯示具有 密碼 標籤的文章。 顯示所有文章
顯示具有 密碼 標籤的文章。 顯示所有文章

2008年5月15日 星期四

移除VBA.xls.xla 密碼 保護

移除VBA.xls.xla 密碼 保護

'移除VBA编码保护
Sub MoveProtect()
Dim FileName As String
FileName = Application.GetOpenFilename("Excel文件(*.xls & *.xla),*.xls;*.xla", , "VBA破解")
If FileName = CStr(False) Then
Exit Sub
Else
VBAPassword FileName, False
End If
End Sub

'设置VBA编码保护
Sub SetProtect()
Dim FileName As String
FileName = Application.GetOpenFilename("Excel文件(*.xls & *.xla),*.xls;*.xla", , "VBA破解")
If FileName = CStr(False) Then
Exit Sub
Else
VBAPassword FileName, True
End If
End Sub

Private Function VBAPassword(FileName As String, Optional Protect As Boolean = False)
If Dir(FileName) = "" Then
Exit Function
Else
FileCopy FileName, FileName & ".bak"
End If

Dim GetData As String * 5
Open FileName For Binary As #1
Dim CMGs As Long
Dim DPBo As Long
For i = 1 To LOF(1)
Get #1, i, GetData
If GetData = "CMG=""" Then CMGs = i
If GetData = "[Host" Then DPBo = i - 2: Exit For
Next

If CMGs = 0 Then
MsgBox "请先对VBA编码设置一个保护密码...", 32, "提示"
Exit Function
End If

If Protect = False Then
Dim St As String * 2
Dim s20 As String * 1

'取得一个0D0A十六进制字串
Get #1, CMGs - 2, St

'取得一个20十六制字串
Get #1, DPBo + 16, s20

'替换加密部份机码
For i = CMGs To DPBo Step 2
Put #1, i, St
Next

'加入不配对符号
If (DPBo - CMGs) Mod 2 <> 0 Then
Put #1, DPBo + 1, s20
End If
MsgBox "文件解密成功......", 32, "提示"
Else
Dim MMs As String * 5
MMs = "DPB="""
Put #1, CMGs, MMs
MsgBox "对文件特殊加密成功......", 32, "提示"
End If
Close #1
End Function

2007年12月11日 星期二

破解Excel 保護工作表 的密碼

破解Excel 保護工作表 的密碼

以下VBA可以查出[保護工作表]的密碼.
此為4位數的[英數密碼], 可自行修改以符合自己的需求.

Sub JackyCP()
Dim DimArr(63)
Dim PW As String
For x = 48 To 57
xx = xx + 1
DimArr(xx) = Chr(x)
Next
For x = 97 To 122
xx = xx + 1
DimArr(xx) = Chr(x)
NextFor x = 65 To 90
xx = xx + 1
DimArr(xx) = Chr(x)Next
On Error Resume Next

For x1 = 1 To UBound(DimArr) - 1
For x2 = 1 To UBound(DimArr) - 1
For x3 = 1 To UBound(DimArr) - 1
For x4 = 1 To UBound(DimArr) - 1
PW = DimArr(x1) & DimArr(x2) & DimArr(x3) & DimArr(x4)
Application.StatusBar = PW
ActiveSheet.Unprotect PW
If ActiveSheet.ProtectContents = False Then
MsgBox "Password is " & PW
Exit Sub
End If
Next
Next
Next
Next
End Sub

2007年12月9日 星期日

破解excel保護密碼

破解excel保護密碼


1.到「http://www.straxx.com/excel/password.html 」下載「password.xla」 這個檔案。

2.打開有保護的Excel文件,在功能表上的【工具】按一下滑鼠左鍵,接著從選單中點選【增益集】。

3.按下「增益集」對話盒中的〔瀏覽〕,接著找到剛才下載的位置,點選「password.xla」後按下〔確〕。

4.接著你會發現選項中多了「Password recover」,勾選之後再按下對話盒中的〔確定〕。

5.接下來會出現一個提示訊息對話盒,沒關係,直接在〔確定〕上按一下滑鼠左鍵繼續下一個步驟。

6.再來破解保護!點選左下角要破解的〔Sheet〕後,按下功能表中的【工具】,接著從選單中點選【Unprotect sheet】,以去除工作表的保護!

7.最後解除保護了,總共花了1分03秒!依照表格及密碼的複雜程度,會秏時不同的破解時間,但還是遠比「暴力破解法」來得快,按下〔確定〕就可以繼續編輯文件囉!