From 9084afa738b4afa18233c60c8b25b3d17795e043 Mon Sep 17 00:00:00 2001 From: CPunch Date: Wed, 6 Apr 2022 01:07:16 -0500 Subject: [PATCH] Added commit hash to version display --- CMakeLists.txt | 2 ++ README.md | 2 +- cnc/src/main.c | 9 ++++++++- lib/include/lconfig.h | 14 -------------- lib/include/lconfig.h.in | 1 + shell/src/main.c | 4 ++-- 6 files changed, 14 insertions(+), 18 deletions(-) delete mode 100644 lib/include/lconfig.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 3909524..daec3c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,8 @@ project(Laika) set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED ON) +execute_process(COMMAND git rev-parse --short HEAD OUTPUT_VARIABLE GIT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) + # Set the project as the default startup project for VS set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT LaikaLib) diff --git a/README.md b/README.md index adfed73..64735dd 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Laika is a simple Remote Access Toolkit stack for educational purposes. It allow Some notable features thus far: - [X] Lightweight, the bot alone is 270kb (22kb if not statically linked with LibSodium) and uses very little resources minimizing Laika's footprint. - [X] Authentication & packet encryption using LibSodium and a predetermined public CNC key. -- [X] Server and Shell configuration through `.ini` files. +- [X] Server and Shell configuration through `.ini` files. - [X] Ability to open shells remotely on the victim's machine. - [ ] Ability to relay socket connections to/from the victim's machine. - [ ] Uses obfuscation techniques also seen in the wild (string obfuscation, tiny VMs executing sensitive operations, etc.) diff --git a/cnc/src/main.c b/cnc/src/main.c index a26051d..81970f5 100644 --- a/cnc/src/main.c +++ b/cnc/src/main.c @@ -1,9 +1,13 @@ #include #include "ltask.h" +#include "lconfig.h" #include "cnc.h" #include "ini.h" +#define STRING(x) #x +#define MACROLITSTR(x) STRING(x) + struct sLaika_taskService tService; static int iniHandler(void* user, const char* section, const char* name, const char* value) { @@ -38,8 +42,11 @@ bool loadConfig(struct sLaika_cnc *cnc, char *config) { } int main(int argv, char *argc[]) { - struct sLaika_cnc *cnc = laikaC_newCNC(atoi(LAIKA_CNC_PORT)); + struct sLaika_cnc *cnc; + printf("Laika v" MACROLITSTR(LAIKA_VERSION_MAJOR) "." MACROLITSTR(LAIKA_VERSION_MINOR) "-" LAIKA_VERSION_COMMIT "\n"); + + cnc = laikaC_newCNC(atoi(LAIKA_CNC_PORT)); /* load config file */ if (argv >= 2 && !loadConfig(cnc, argc[1])) return 1; diff --git a/lib/include/lconfig.h b/lib/include/lconfig.h deleted file mode 100644 index b7572b5..0000000 --- a/lib/include/lconfig.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef LAIKA_CONFIG_H -#define LAIKA_CONFIG_H - -/* version info */ -#define LAIKA_VERSION_MAJOR 0 -#define LAIKA_VERSION_MINOR 1 - -/* keys */ -#define LAIKA_PUBKEY "40d5534aca77d1f5ec2bbe79dd9d0f52a78148918f95814404cefe97c34c5c27" -#define LAIKA_PRIVKEY "90305aa77023d1c1e03265c3b6af046eb58d6ec8ba650b0dffed01379feab8cc" -#define LAIKA_CNC_IP "127.0.0.1" -#define LAIKA_CNC_PORT "13337" - -#endif diff --git a/lib/include/lconfig.h.in b/lib/include/lconfig.h.in index 4ad4550..09d0caf 100644 --- a/lib/include/lconfig.h.in +++ b/lib/include/lconfig.h.in @@ -4,6 +4,7 @@ /* version info */ #define LAIKA_VERSION_MAJOR @LAIKA_VERSION_MAJOR@ #define LAIKA_VERSION_MINOR @LAIKA_VERSION_MINOR@ +#define LAIKA_VERSION_COMMIT "@GIT_VERSION@" /* keys */ #define LAIKA_PUBKEY "@LAIKA_PUBKEY@" diff --git a/shell/src/main.c b/shell/src/main.c index 86d91ff..43ef76c 100644 --- a/shell/src/main.c +++ b/shell/src/main.c @@ -7,7 +7,7 @@ #define STRING(x) #x #define MACROLITSTR(x) STRING(x) -const char *LOGO = "\n\t██╗ █████╗ ██╗██╗ ██╗ █████╗\n\t██║ ██╔══██╗██║██║ ██╔╝██╔══██╗\n\t██║ ███████║██║█████╔╝ ███████║\n\t██║ ██╔══██║██║██╔═██╗ ██╔══██║\n\t███████╗██║ ██║██║██║ ██╗██║ ██║\n\t╚══════╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚═╝ ╚═╝"; +const char *LOGO = "\n ██╗ █████╗ ██╗██╗ ██╗ █████╗\n ██║ ██╔══██╗██║██║ ██╔╝██╔══██╗\n ██║ ███████║██║█████╔╝ ███████║\n ██║ ██╔══██║██║██╔═██╗ ██╔══██║\n ███████╗██║ ██║██║██║ ██╗██║ ██║\n ╚══════╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚═╝ ╚═╝"; static int iniHandler(void* user, const char* section, const char* name, const char* value) { tShell_client *client = (tShell_client*)user; @@ -47,7 +47,7 @@ int main(int argv, char *argc[]) { bool printPrompt = false; shellT_printf("%s%s\n%s", shellT_getForeColor(TERM_BRIGHT_RED), LOGO, shellT_getForeColor(TERM_BRIGHT_WHITE)); - shellT_printf("\t made with %s<3%s by CPunch - %s\n\nType 'help' for a list of commands\n\n", shellT_getForeColor(TERM_BRIGHT_RED), shellT_getForeColor(TERM_BRIGHT_WHITE), "v" MACROLITSTR(LAIKA_VERSION_MAJOR) "." MACROLITSTR(LAIKA_VERSION_MINOR)); + shellT_printf(" made with %s<3%s by CPunch - %s\n\nType 'help' for a list of commands\n\n", shellT_getForeColor(TERM_BRIGHT_RED), shellT_getForeColor(TERM_BRIGHT_WHITE), "v" MACROLITSTR(LAIKA_VERSION_MAJOR) "." MACROLITSTR(LAIKA_VERSION_MINOR) "-" LAIKA_VERSION_COMMIT); shellC_init(&client);