编码的MDB表和内容

时间:2013-04-22 22:23:45

标签: c# ms-access vb6 encryption

我有一个非常旧的VB 16位应用程序,它与.MDB文件一起使用,因为还有.MDA文件 - 因为我猜它是使用access 2.0制作的。需要得到我们的表格,关系和内容。表数据采用“丹麦语”。

我的老板确实有版权,但没有管理员用户名和密码。应用程序运行良好,这意味着应用程序能够连接到MDB文件并使用它。我在Windows 7 32位计算机上运行它。

似乎数据库已经过编码。来了解他们使用RC4编码和.MDB头包含它的密钥。

有没有办法从编码的.MDB中获取表和数据。我已经尝试过我的mdb解锁工具,他们中的大多数都不认识它是.mdb,但是应用程序有效。

我迫切希望找到解决方案。非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

  

知道他们使用RC4编码和.MDB头包含密钥   它。有没有办法从编码的.MDB中获取平板电脑和数据。

您必须使用对象模型代码从Access数据库文件中删除所有内容。这是一个从损坏的 Access数据库中提取数据的脚本:

   Function FilterDB(strFilePath As String)
   Dim objAccess As Object
   Dim strFolder As String
   Dim strCurrentFile As String
   Dim strCurrentObject As String
   Dim strFilteredDB As String

   Dim fs
   Dim Ref
   Dim f As Object
   Dim objtype As AcObjectType

   Dim objAllObjects As New Collection
   Dim objObjectGroup As Object
   Dim intObjType As Integer
   Dim i As Integer
   Dim j As Integer
   Dim intRefNum As Integer

   Dim RefItem As Reference
   Dim arrayRefs() As String

   Dim strErrMsg As String

   'Open the source database
   Set objAccess = CreateObject("Access.Application.10")

   On Error GoTo ErrorHandler

   objAccess.OpenCurrentDatabase strFilePath, False

   strFolder = Left(strFilePath, InStrRev(strFilePath, "\", Len(strFilePath)))
   strFilteredDB = Left(strFilePath, Len(strFilePath) - 4) & "filtered.mdb"

   With objAllObjects
       .Add objAccess.CurrentData.AllQueries
       .Add objAccess.CurrentProject.AllForms
       .Add objAccess.CurrentProject.AllReports
       .Add objAccess.CurrentProject.AllMacros
       .Add objAccess.CurrentProject.AllModules
       .Add objAccess.CurrentProject.AllDataAccessPages
   End With

   Set fs = CreateObject("Scripting.FileSystemObject")

   If Not fs.folderexists(strFolder & "\texttmp") Then
       fs.CreateFolder (strFolder & "\texttmp")
   End If

   For i = 1 To objAllObjects.Count

       If objAllObjects(i).Count > 0 Then
           For j = 0 To objAllObjects(i).Count - 1

              Set objObjectGroup = objAllObjects(i)

              strCurrentObject = objObjectGroup(j).Name
              intObjType = objObjectGroup(j).Type
              objAccess.SaveAsText intObjType, strCurrentObject, _
              strFolder & "texttmp\" & strCurrentObject & intObjType & ".txt"

           Next j
       End If

   Next i

   'Bring in All the references
   On Error Resume Next

   ReDim arrayRefs(objAccess.References.Count - 1, 2) As String

   For Each RefItem In objAccess.References()
       If Not IsError(RefItem.Name) Then

           arrayRefs(intRefNum, 0) = RefItem.Name
           arrayRefs(intRefNum, 1) = RefItem.FullPath
           intRefNum = intRefNum + 1

       End If
   Next RefItem

   On Error GoTo ErrorHandler

   Debug.Print ""
   objAccess.Quit
   Set objAccess = Nothing

   Set objAccess = CreateObject("Access.Application")

   objAccess.NewCurrentDatabase strFilteredDB

   'Finds the first occurrence of a text file in the
   'texttmp folder.
   strCurrentFile = Dir(strFolder & "\texttmp" & "\*.txt")

   'Count the files in the folder.
   Set f = fs.GetFolder(strFolder)

   'Check to see if the folder is empty.
   'If not, load in all the files from there
   If f.Files.Count <> 0 Then

   Do Until strCurrentFile = ""
      intObjType = Mid(strCurrentFile, Len(strCurrentFile) - 4, 1)
      objAccess.LoadFromText intObjType, _
      Left(strCurrentFile, Len(strCurrentFile) - 5), _
      strFolder & "\texttmp\" & strCurrentFile
      strCurrentFile = Dir
   Loop
   End If


   On Error Resume Next

   For i = 0 To UBound(arrayRefs())

       Set Ref = objAccess.References.AddFromFile(arrayRefs(i, 1))

   Next i

   MsgBox "Finished creating filtered file:" & Chr(10) _
   & objAccess.CurrentProject.FullName & "."

FunctionEnd:

   On Error Resume Next
   Set fs = CreateObject("Scripting.FileSystemObject")

   If fs.folderexists(strFolder & "\texttmp") Then
       fs.deletefolder (strFolder & "\texttmp")
   End If

   objAccess.Quit
   Set objAccess = Nothing
   Set f = Nothing

   Exit Function

ErrorHandler:

   Select Case Err.Number

       Case 58, 7866
       strErrMsg = "The path\file name " & strFilePath _
           & " may be incorrect or the " _
           & Chr(10) & " database is opened exclusively by someone else." _
           & Chr(10) & Chr(10) & _
           "Please insure your path and file name are correct " _
           & Chr(10) & "and the database is not open."

       Case 7865
       strErrMsg = "The follwing database:" & Chr(10) & Chr(10) _
           & strFilteredDB & Chr(10) & Chr(10) _
           & "already exists." _
           & Chr(10) & Chr(10) & _
           " Please rename, move, or delete it before running" _
           & "the FilterDB function."

       Case Else
       strErrMsg = "Access Error #" & Err.Number & Chr(10) & Chr(10) & _
       Err.Description

   End Select

   MsgBox strErrMsg

   GoTo FunctionEnd

   End Function