Create an ACCESS password cracking tool using MFC

Source: Internet
Author: User
Encryption principle: the valid password of the Access database is 13 BITs. When not encrypted, the 67th-9 bits of the database are fixed strings, and each ASCII code value is 86, FBEC37, 5D, 44, 9C, FA, C6, 5E, 28, E6, 13. During encryption, each bit and 6 of the passwords are used respectively.

Encryption principle: the valid password of the Access database is 13 BITs. When not encrypted, the 67th-9 bits of the database are fixed strings, and each ASCII code value is 86, FBEC 37, 5D, 44, 9C, FA, C6, 5E, 28, E6, 13. During encryption, each bit and 6 of the passwords are used respectively.

Encryption principle: the valid password of the Access database is 13 BITs. When not encrypted, the 67th-9 bits of the database are fixed strings, and each ASCII code value is 86, FBEC37, 5D, 44, 9C, FA, C6, 5E, 28, E6, 13. During encryption, each character of the password and the ASCII code value between 67 and 79 characters are used to perform an exclusive or operation, and a new string is obtained, which is written back to 67 to 79 characters.
Decryption Method: Convert the ASCII code values between 67 and 79 characters to 86, FB, EC, 37, 5D, 44, 9C, FA, C6, 5E, 28, e6, 13 "to obtain the password.

Encryption principle: the valid password of the Access database is 13 BITs. When not encrypted, the 67th-9 bits of the database are fixed strings, and each ASCII code value is 86, FBEC37, 5D, 44, 9C, FA, C6, 5E, 28, E6, 13. During encryption, each character of the password and the ASCII code value between 67 and 79 characters are used to perform an exclusive or operation, and a new string is obtained, which is written back to 67 to 79 characters.
Decryption Method: Convert the ASCII code values between 67 and 79 characters to 86, FB, EC, 37, 5D, 44, 9C, FA, C6, 5E, 28, e6, 13 "to obtain the password.


Recently I used VC and wrote the code by the way. Except for access97, I couldn't find the testing tool. All the other tools were tested normally. paste the Code directly. I don't like too many descriptions.

// CrackAccessPassDlg. cpp: implementation file
//

# Include "stdafx. h"
# Include "CrackAccessPass. h"
# Include "CrackAccessPassDlg. h"

# Ifdef _ DEBUG
# Define new DEBUG_NEW
# Endif


// Used for the CAboutDlg dialog box of the "about" menu item of the application

Class CAboutDlg: public CDialog
...{
Public:
CAboutDlg ();

// Dialog box data
Enum... {IDD = IDD_ABOUTBOX };

Protected:
Virtual void DoDataExchange (CDataExchange * pDX); // supported by DDX/DDV

// Implementation
Protected:
DECLARE_MESSAGE_MAP ()
};

CAboutDlg: CAboutDlg (): CDialog (CAboutDlg: IDD)
...{
}

Void CAboutDlg: DoDataExchange (CDataExchange * pDX)
...{
CDialog: DoDataExchange (pDX );
}

BEGIN_MESSAGE_MAP (CAboutDlg, CDialog)
END_MESSAGE_MAP ()


// CCrackAccessPassDlg dialog box




CCrackAccessPassDlg: CCrackAccessPassDlg (CWnd * pParent/** // * = NULL */)
: CDialog (CCrackAccessPassDlg: IDD, pParent)
, M_filePath (_ T (""))
...{
M_hIcon = AfxGetApp ()-> LoadIcon (IDR_MAINFRAME );
}

Void CCrackAccessPassDlg: DoDataExchange (CDataExchange * pDX)
...{
CDialog: DoDataExchange (pDX );
DDX_Text (pDX, IDC_EDIT1, m_filePath );
}

BEGIN_MESSAGE_MAP (CCrackAccessPassDlg, CDialog)
ON_WM_SYSCOMMAND ()
ON_WM_PAINT ()
ON_WM_QUERYDRAGICON ()
//} AFX_MSG_MAP
ON_BN_CLICKED (IDC_BUTTON1, & CCrackAccessPassDlg: OnBnClickedButton1)
END_MESSAGE_MAP ()


// CCrackAccessPassDlg Message Processing Program

BOOL CCrackAccessPassDlg: OnInitDialog ()
...{
CDialog: OnInitDialog ();

// Add the "about..." menu to the system menu.

// IDM_ABOUTBOX must be in the range of system commands.
ASSERT (IDM_ABOUTBOX & 0xFFF0) = IDM_ABOUTBOX );
ASSERT (IDM_ABOUTBOX <0xF000 );

CMenu * pSysMenu = GetSystemMenu (FALSE );
If (pSysMenu! = NULL)
...{
CString strAboutMenu;
StrAboutMenu. LoadString (IDS_ABOUTBOX );
If (! StrAboutMenu. IsEmpty ())
...{
PSysMenu-> AppendMenu (MF_SEPARATOR );
PSysMenu-> AppendMenu (MF_STRING, IDM_ABOUTBOX, strAboutMenu );
}
}

// Set the icon in this dialog box. When the application main window is not a dialog box, the framework will automatically
// Perform this operation
SetIcon (m_hIcon, TRUE); // you can specify a large icon.
SetIcon (m_hIcon, FALSE); // you can specify a small icon.

// TODO: add additional initialization code here

Return TRUE; // return TRUE unless focus is set to the control.
}

Void CCrackAccessPassDlg: OnSysCommand (UINT nID, LPARAM lParam)
...{
If (nID & 0xFFF0) = IDM_ABOUTBOX)
...{
CAboutDlg dlgAbout;
DlgAbout. DoModal ();
}
Else
...{
CDialog: OnSysCommand (nID, lParam );
}
}

// If you add the minimization button to the dialog box, the following code is required:
// To draw the icon. For MFC applications that use document/view models,
// This will be automatically completed by the framework.

Void CCrackAccessPassDlg: OnPaint ()
...{
If (IsIconic ())
...{
CPaintDC dc (this); // device context used for plotting

SendMessage (WM_ICONERASEBKGND, reinterpret_cast (Dc. GetSafeHdc (), 0 );

// Center the icon in the work rectangle
Int cxIcon = GetSystemMetrics (SM_CXICON );
Int cyIcon = GetSystemMetrics (SM_CYICON );
CRect rect;
GetClientRect (& rect );
Int x = (rect. Width ()-cxIcon + 1)/2;
Int y = (rect. Height ()-cyIcon + 1)/2;

// Draw the icon
Dc. DrawIcon (x, y, m_hIcon );
}
Else
...{
CDialog: OnPaint ();
}
}

// When you drag the minimize window, the system calls this function to display the cursor.
//
HCURSOR CCrackAccessPassDlg: OnQueryDragIcon ()
...{
Return static_cast (M_hIcon );
}


Void CCrackAccessPassDlg: OnBnClickedButton1 ()
...{
// TODO: add the control notification handler code here
CFileDialog fd (TRUE ,"*. mdb "," ", OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT," ACCESS database file (*. mdb) | *. mdb | all files (*. *) | *. * | ", NULL, 0 );
INT_PTR nResponse = fd. DoModal ();
If (nResponse = IDOK)
...{
M_filePath = fd. GetPathName ();
UpdateData (false );
DoCrack ();
}
}

/**//*
* @ Decryption
*/
Void CCrackAccessPassDlg: DoCrack ()
...{
CString PassWord;
BYTE accVer [3] =... {0 };
BYTE accID = 0x00;
BYTE accFile [40] =... {0 };
BYTE accDataKey [128] =... {0 };

Char accFlagString [16] =... {0 };

// Open in read-only mode
CFile myFile (m_filePath, CFile: modeRead | CFile: shareDenyNone );
DWORD len = myFile. GetLength ();
If (len> 320)
...{
MyFile. Seek (66, CFile: begin );
MyFile. Read (& accFile, sizeof (accFile ));

MyFile. Seek (156, CFile: begin );
MyFile. Read (& accVer, sizeof (accVer ));

MyFile. Seek (20, CFile: begin );
MyFile. Read (& accID, sizeof (accID ));

MyFile. Seek (24, CFile: begin );
MyFile. Read (& accDataKey, sizeof (accDataKey ));

MyFile. Seek (4, CFile: begin );
MyFile. Read (& accFlagString, sizeof (accFlagString ));
}
MyFile. Close ();

If (strcmp (accFlagString, "Standard Jet DB "))
...{
SetDlgItemText (IDC_VER, "not an Access database! ");

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.