-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* linux support for encoder and generator * bump lz4 to 1.10.0 * fix compilation under MSVC * fix typos * add linux build to github actions
- Loading branch information
Showing
11 changed files
with
375 additions
and
279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,24 @@ | ||
set(CPM_DOWNLOAD_VERSION 0.38.2) | ||
# SPDX-License-Identifier: MIT | ||
# | ||
# SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors | ||
|
||
set(CPM_DOWNLOAD_VERSION 0.40.4) | ||
set(CPM_HASH_SUM "67dcc1deb6e12a2f0705647ccc5f7023e3d15746b944e14352b82373e09b8a0a") | ||
|
||
if(CPM_SOURCE_CACHE) | ||
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
elseif(DEFINED ENV{CPM_SOURCE_CACHE}) | ||
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
else() | ||
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
endif() | ||
|
||
# Expand relative path. This is important if the provided path contains a tilde (~) | ||
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE) | ||
|
||
function(download_cpm) | ||
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}") | ||
file(DOWNLOAD | ||
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake | ||
${CPM_DOWNLOAD_LOCATION} | ||
) | ||
endfunction() | ||
|
||
if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION})) | ||
download_cpm() | ||
else() | ||
# resume download if it previously failed | ||
file(READ ${CPM_DOWNLOAD_LOCATION} check) | ||
if("${check}" STREQUAL "") | ||
download_cpm() | ||
endif() | ||
unset(check) | ||
endif() | ||
file(DOWNLOAD | ||
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake | ||
${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM} | ||
) | ||
|
||
include(${CPM_DOWNLOAD_LOCATION}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,79 @@ | ||
# disable C4711, C5045, C4820 (caused by lz4) | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4711 /wd5045 /wd4820") | ||
|
||
CPMAddPackage( | ||
NAME xorstr | ||
GITHUB_REPOSITORY JustasMasiulis/xorstr | ||
GIT_TAG master | ||
DOWNLOAD_ONLY True | ||
) | ||
|
||
if (xorstr_ADDED) | ||
add_library(xorstr INTERFACE) | ||
target_include_directories(xorstr INTERFACE ${xorstr_SOURCE_DIR}/include) | ||
endif() | ||
|
||
CPMAddPackage( | ||
NAME lazy_importer | ||
GITHUB_REPOSITORY JustasMasiulis/lazy_importer | ||
GIT_TAG master | ||
DOWNLOAD_ONLY True | ||
) | ||
|
||
if (lazy_importer_ADDED) | ||
add_library(lazy_importer INTERFACE) | ||
target_include_directories(lazy_importer INTERFACE ${lazy_importer_SOURCE_DIR}/include) | ||
if(MSVC) | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4711 /wd5045 /wd4820") | ||
endif() | ||
|
||
CPMAddPackage( | ||
NAME lz4 | ||
GITHUB_REPOSITORY lz4/lz4 | ||
VERSION 1.9.4 | ||
VERSION 1.10.0 | ||
SOURCE_SUBDIR build/cmake | ||
OPTIONS | ||
"LZ4_BUILD_CLI OFF" | ||
"LZ4_BUILD_LEGACY_LZ4C OFF" | ||
) | ||
find_package(lz4 REQUIRED) | ||
|
||
CPMAddPackage("gh:SergiusTheBest/FindWDK#master") | ||
list(APPEND CMAKE_MODULE_PATH "${FindWDK_SOURCE_DIR}/cmake") | ||
find_package(WDK REQUIRED) | ||
CPMAddPackage("gh:dumbasPL/linux-pe#master") | ||
find_package(linux-pe REQUIRED) | ||
|
||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows") | ||
CPMAddPackage( | ||
NAME xorstr | ||
GITHUB_REPOSITORY JustasMasiulis/xorstr | ||
GIT_TAG master | ||
DOWNLOAD_ONLY True | ||
) | ||
|
||
if (xorstr_ADDED) | ||
add_library(xorstr INTERFACE) | ||
target_include_directories(xorstr INTERFACE ${xorstr_SOURCE_DIR}/include) | ||
endif() | ||
|
||
CPMAddPackage( | ||
NAME lazy_importer | ||
GITHUB_REPOSITORY JustasMasiulis/lazy_importer | ||
GIT_TAG master | ||
DOWNLOAD_ONLY True | ||
) | ||
|
||
CPMAddPackage("gh:dumbasPL/[email protected]") | ||
if (lazy_importer_ADDED) | ||
add_library(lazy_importer INTERFACE) | ||
target_include_directories(lazy_importer INTERFACE ${lazy_importer_SOURCE_DIR}/include) | ||
endif() | ||
|
||
if (FUMO_DEBUG) | ||
add_compile_definitions(FUMO_DEBUG) | ||
CPMAddPackage("gh:SergiusTheBest/FindWDK#master") | ||
list(APPEND CMAKE_MODULE_PATH "${FindWDK_SOURCE_DIR}/cmake") | ||
find_package(WDK REQUIRED) | ||
|
||
CPMAddPackage("gh:dumbasPL/[email protected]") | ||
|
||
add_subdirectory(driver) | ||
add_subdirectory(driver_interface) | ||
add_subdirectory(resource_generator) | ||
add_subdirectory(stage1) | ||
add_subdirectory(stage2) | ||
add_subdirectory(initial_loader) | ||
add_subdirectory(shellcode_extractor) | ||
endif() | ||
|
||
add_subdirectory(driver) | ||
add_subdirectory(driver_interface) | ||
add_subdirectory(resource_generator) | ||
add_subdirectory(stage1) | ||
add_subdirectory(stage2) | ||
add_subdirectory(initial_loader) | ||
add_subdirectory(shellcode_extractor) | ||
add_subdirectory(fumo_generator) | ||
add_subdirectory(encoder) | ||
|
||
add_custom_command( | ||
COMMENT "building final executable" | ||
DEPENDS fumo_generator initial_loader stage1 | ||
$<TARGET_PROPERTY:initial_loader,RUNTIME_OUTPUT_DIRECTORY>/initial_loader.bin | ||
$<TARGET_FILE:stage1> | ||
COMMAND fumo_generator ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/fumo.exe | ||
$<TARGET_PROPERTY:initial_loader,RUNTIME_OUTPUT_DIRECTORY>/initial_loader.bin | ||
$<TARGET_FILE:stage1> | ||
OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/fumo.exe | ||
) | ||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows") | ||
add_custom_command( | ||
COMMENT "building final executable" | ||
DEPENDS fumo_generator initial_loader stage1 | ||
$<TARGET_PROPERTY:initial_loader,RUNTIME_OUTPUT_DIRECTORY>/initial_loader.bin | ||
$<TARGET_FILE:stage1> | ||
COMMAND fumo_generator ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/fumo.exe | ||
$<TARGET_PROPERTY:initial_loader,RUNTIME_OUTPUT_DIRECTORY>/initial_loader.bin | ||
$<TARGET_FILE:stage1> | ||
OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/fumo.exe | ||
) | ||
|
||
add_custom_target( | ||
fumo ALL | ||
DEPENDS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/fumo.exe | ||
) | ||
add_custom_target( | ||
fumo ALL | ||
DEPENDS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/fumo.exe | ||
) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.