by Nir Sofer (3 Submissions)
Category: Databases/Data Access/DAO/ADO
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Sun 3rd November 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
The following code snippet reveals the database password of Microsoft Access files (mdb files), Version 95 or 97. In order to get the password
'Copyright (c) Nir Sofer 2002
'
'Web site: http://nirsoft.cjb.net
'
Private Function XorPassword(Bytes As Variant) As String
Dim XorBytes() As Variant
Dim strPassword As String
Dim intIndex As Integer
Dim CurrChar As String * 1
XorBytes = Array(&H86, &HFB, &HEC, &H37, &H5D, &H44, &H9C, &HFA, &HC6, &H5E, &H28, &HE6, &H13, &HB6, &H8A, &H60, &H54, &H94)
strPassword = vbNullString
intIndex = 0
Do
'Get a character from the password by doing a XOR with the appropriate value in XorBytes array.
CurrChar = Chr$(Bytes(intIndex + &H42) Xor XorBytes(intIndex))
'If we get a Null character, get out of the loop.
If Asc(CurrChar) = 0 Then Exit Do
'Add the password character to the accumulated password string.
strPassword = strPassword & CurrChar
intIndex = intIndex + 1
Loop Until intIndex = 17
XorPassword = strPassword
End Function
Private Function GetAccessPassword(strFilename As String) As String
Dim intFileNum As Integer
Dim Bytes(&H100) As Byte
intFileNum = FreeFile
'Open the Access filename
Open strFilename For Binary As #intFileNum
'Read first 256 bytes
Get #intFileNum, , Bytes
'Get the password from the XorPassword function
GetAccessPassword = XorPassword(Bytes)
Close #intFileNum
End Function
No comments have been posted about The following code snippet reveals the database password of Microsoft Access files (mdb files), Ver. Why not be the first to post a comment about The following code snippet reveals the database password of Microsoft Access files (mdb files), Ver.