From 259e6b84b2fa521b37f2a4f3c36969418b0a8ba8 Mon Sep 17 00:00:00 2001 From: kernel <77142078+kernelwernel@users.noreply.github.com> Date: Fri, 4 Oct 2024 18:36:30 +0100 Subject: [PATCH] cmake test and updater python script --- CMakeLists.txt | 2 +- auxiliary/updater.py | 51 ++++++++++++++++++++++++++++++++++++++------ src/vmaware.hpp | 2 +- src/vmaware_MIT.hpp | 2 +- 4 files changed, 47 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 828df62..7973b84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,7 +91,7 @@ include(CTest) enable_testing() set(ARGUMENTS "--all") if(MSVC) -add_test(NAME TARGET COMMAND "${BUILD_DIR}/Release/${TARGET}") +add_test(executable, "${BUILD_DIR}/Release/${TARGET}") else() add_test(NAME TARGET COMMAND "${BUILD_DIR}/${TARGET}" ${ARGUMENTS}) endif() diff --git a/auxiliary/updater.py b/auxiliary/updater.py index 861c486..d0fadb1 100644 --- a/auxiliary/updater.py +++ b/auxiliary/updater.py @@ -35,6 +35,8 @@ import sys import re +from datetime import datetime + def arg_check(): def fetch(): @@ -354,32 +356,67 @@ def update_sections(filename): def update_date(filename): + # fetch the first arg, which is supposed to be the new version number for a new release + args = sys.argv + first_arg = args[1] if len(args) > 1 else None + + with open(filename, 'r') as file: header_content = file.readlines() - index = 1 + index = 0 banner_line = " * ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ " + # fetch the index of where the line should be updated for line in header_content: if (banner_line not in line): index += 1 else: break - + # find "X.X", where X is an integral + def find_pattern(base_str): + pattern = r'\d+\.\d+' + + # Search for the pattern in the text + match = re.search(pattern, base_str) + + # find match + if match: + return match.group() + print("match found") + else: + print(f"Version number not found for {base_str}, aborting") + sys.exit(1) + + + # fetch the new version + header_version = find_pattern(header_content[index]) + if first_arg == None: + arg_version = header_version + else: + arg_version = find_pattern(first_arg) + + new_version = "" + new_date = "" + + # set the version and date + new_version = arg_version + new_date = datetime.now().strftime("%B") + " " + str(datetime.now().year) + + # this will be the new content + new_content = banner_line + new_version + " (" + new_date + ")" + if 0 < index <= len(header_content): - header_content[index - 1] = new_content + '\n' + header_content[index] = new_content + '\n' else: print(f"Line number {line_number} is out of range.") - return + sys.exit(1) with open(filename, 'w') as file: file.writelines(header_content) -args = sys.argv -first_arg = args[1] if len(args) > 1 else None - arg_check() update_MIT() diff --git a/src/vmaware.hpp b/src/vmaware.hpp index 93fa1fe..2fba761 100644 --- a/src/vmaware.hpp +++ b/src/vmaware.hpp @@ -8027,7 +8027,7 @@ struct VM { cmp("Malware") || cmp("malsand") || cmp("ClonePC") - ) { + ) { return true; } diff --git a/src/vmaware_MIT.hpp b/src/vmaware_MIT.hpp index b539294..b9aa722 100644 --- a/src/vmaware_MIT.hpp +++ b/src/vmaware_MIT.hpp @@ -7582,7 +7582,7 @@ struct VM { cmp("Malware") || cmp("malsand") || cmp("ClonePC") - ) { + ) { return true; }