update build to match dir structure

This commit is contained in:
17ms 2024-01-05 21:48:20 +02:00
parent ae85701371
commit 3824443f0e
4 changed files with 12 additions and 1 deletions

View File

@ -6,6 +6,8 @@ project(
LANGUAGES CXX
)
set(CMAKE_CXX_STANDARD 17)
if(NOT CMAKE_SYSTEM_NAME MATCHES Windows)
message(FATAL_ERROR "Use a cross compilation suitable toolchain with CMAKE_SYSTEM_NAME set to Windows")
endif()
@ -34,17 +36,23 @@ else()
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /INCREMENTAL:NO /OPT:REF /OPT:ICF /PDBSTRIPPED")
endif()
# *) Shared modules
add_library(shared STATIC shared/crypto.cpp shared/crypto.hpp shared/futils.cpp shared/futils.hpp)
# *) Reflective loader (DLL)
add_library(loader SHARED reflective_loader/loader.cpp reflective_loader/loader.hpp)
target_link_libraries(loader PRIVATE shared)
# *) Payload (DLL)
add_library(payload SHARED payload/payload.cpp)
# *) Shellcode generator (EXE)
add_executable(generator generator/generator.cpp generator/generator.hpp)
target_link_libraries(generator PRIVATE shared)
# *) Injector (EXE)
add_executable(injector injector/injector.cpp)
target_link_libraries(injector PRIVATE shared)
if(NOT MSVC)
foreach(target loader payload generator injector)

View File

@ -1,3 +1,5 @@
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <windows.h>
#ifdef BUILD_DLL

View File

@ -3,6 +3,7 @@
#include <windows.h>
#include <winternl.h>
#include <algorithm>
#include <random>
constexpr auto MAX_IMPORT_DELAY_MS = 6 * 1000;
constexpr auto OBFUSCATE_IMPORTS = 1;

View File

@ -17,7 +17,7 @@ std::vector<BYTE> GenerateKey(size_t keysize)
void XorCipher(std::vector<BYTE> &data, const std::vector<BYTE> &key)
{
for (auto i = 0; i < data.size(); i++)
for (size_t i = 0; i < data.size(); i++)
{
data[i] = data[i] ^ key[i % key.size()];
}