-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
111 lines (77 loc) · 2.95 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
cmake_minimum_required(VERSION 3.26)
project(elf_toolchain LANGUAGES C CXX ASM)
set(CMAKE_CXX_STANDARD 20)
# find python interpreter
find_package(Python3 REQUIRED)
set(PYTHON_PATH /usr/bin/python3)
# link with libboost
find_package(Boost REQUIRED COMPONENTS program_options)
include_directories(${Boost_INCLUDE_DIRS})
link_libraries(${Boost_LIBRARIES})
# link with libdl
link_libraries(${CMAKE_DL_LIBS})
set(ABSTRACT_SRC
src/abstract/utils/macros.h
src/abstract/utils/process_vars.h
src/abstract/utils/stack.h
src/abstract/utils/udata.h
src/abstract/utils/raw_file.h
src/abstract/utils/raw_file.cpp
src/abstract/data_obfuscation/obfuscation.h
src/abstract/data_obfuscation/obfuscation.cpp
src/abstract/data_obfuscation/encryption.h
src/abstract/data_obfuscation/encryption.cpp
src/abstract/data_obfuscation/compression.h
src/abstract/data_obfuscation/compression.cpp
src/abstract/data_obfuscation/encoding.h
src/abstract/data_obfuscation/encoding.cpp
src/abstract/loading/basic_loader.h
src/abstract/packing/basic_packed_file.h
)
set (EXEC_FORMATS
src/exec_file_formats/exec_file_format.h
src/exec_file_formats/check_file_format.h
src/exec_file_formats/check_file_format.cpp
src/exec_file_formats/elf/basic_elf_file.h
src/exec_file_formats/elf/basic_elf_file.cpp
src/exec_file_formats/elf/stripping/elf_stripper.h
src/exec_file_formats/elf/obfuscating/elf_obfuscator.h
)
add_executable(elf_loader_linux_x64 # for regular x64 executables
${ABSTRACT_SRC}
${EXEC_FORMATS}
src/linux_x64/elf/linux_x64_elf_loader.cpp
src/linux_x64/elf/jump_signatures.cpp
src/main/elf/loading/elf_loader_linux_x64.cpp
)
add_executable(data_obfuscator
${ABSTRACT_SRC}
${EXEC_FORMATS}
src/main/data_obfuscator/data_obfuscator.cpp
)
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/packed_data.cpp
COMMAND ${CMAKE_COMMAND} -E echo "generating packed_data.cpp"
COMMAND ${PYTHON_PATH} ${CMAKE_SOURCE_DIR}/scripts/bin_file_to_header.py ${CMAKE_SOURCE_DIR}/${OBFUSCATED_FILE} ${CMAKE_SOURCE_DIR}/${OBFUSCATION_KEY} ${ORIG_PATH}
DEPENDS ${PACKED_FILE_PATH}
)
add_custom_target(generate_packed_file_header DEPENDS ${CMAKE_BINARY_DIR}/packed_data.cpp)
add_executable(packed_file
${ABSTRACT_SRC}
${EXEC_FORMATS}
src/linux_x64/elf/linux_x64_elf_loader.cpp
src/linux_x64/elf/jump_signatures.cpp
src/main/elf/packing/packed_elf_linux_x64.cpp
${CMAKE_BINARY_DIR}/packed_data.cpp
)
add_dependencies(packed_file generate_packed_file_header)
add_executable(elf_stripper
${ABSTRACT_SRC}
${EXEC_FORMATS}
src/main/elf/stripping/elf_stripper.cpp
)
add_executable(elf_obfuscator
${ABSTRACT_SRC}
${EXEC_FORMATS}
src/main/elf/obfuscating/elf_obfuscator.cpp
)