diff --git a/al-khaser/Al-khaser.cpp b/al-khaser/Al-khaser.cpp index c0a0f3c..9895fbf 100644 --- a/al-khaser/Al-khaser.cpp +++ b/al-khaser/Al-khaser.cpp @@ -4,33 +4,88 @@ #include "pch.h" -int main(void) +BOOL ENABLE_TLS_CHECKS = FALSE; +BOOL ENABLE_DEBUG_CHECKS = FALSE; +BOOL ENABLE_INJECTION_CHECKS = FALSE; +BOOL ENABLE_GEN_SANDBOX_CHECKS = FALSE; +BOOL ENABLE_VBOX_CHECKS = FALSE; +BOOL ENABLE_VMWARE_CHECKS = FALSE; +BOOL ENABLE_VPC_CHECKS = FALSE; +BOOL ENABLE_QEMU_CHECKS = FALSE; +BOOL ENABLE_KVM_CHECKS = FALSE; +BOOL ENABLE_XEN_CHECKS = FALSE; +BOOL ENABLE_WINE_CHECKS = FALSE; +BOOL ENABLE_PARALLELS_CHECKS = FALSE; +BOOL ENABLE_HYPERV_CHECKS = FALSE; +BOOL ENABLE_CODE_INJECTIONS = FALSE; +BOOL ENABLE_TIMING_ATTACKS = FALSE; +BOOL ENABLE_DUMPING_CHECK = FALSE; +BOOL ENABLE_ANALYSIS_TOOLS_CHECK = FALSE; +BOOL ENABLE_ANTI_DISASSM_CHECKS = FALSE; + + +void EnableDefaultChecks() { + ENABLE_TLS_CHECKS = TRUE; + ENABLE_DEBUG_CHECKS = TRUE; + ENABLE_INJECTION_CHECKS = TRUE; + ENABLE_GEN_SANDBOX_CHECKS = TRUE; + ENABLE_VBOX_CHECKS = TRUE; + ENABLE_VMWARE_CHECKS = TRUE; + ENABLE_VPC_CHECKS = TRUE; + ENABLE_QEMU_CHECKS = TRUE; + ENABLE_KVM_CHECKS = TRUE; + ENABLE_XEN_CHECKS = TRUE; + ENABLE_WINE_CHECKS = TRUE; + ENABLE_PARALLELS_CHECKS = TRUE; + ENABLE_HYPERV_CHECKS = TRUE; + ENABLE_TIMING_ATTACKS = TRUE; + ENABLE_DUMPING_CHECK = TRUE; + ENABLE_ANALYSIS_TOOLS_CHECK = TRUE; + ENABLE_ANTI_DISASSM_CHECKS = TRUE; +} + + +void EnableChecks(std::string checkType) { + if (checkType == "TLS") ENABLE_TLS_CHECKS = TRUE; + else if (checkType == "DEBUG") ENABLE_DEBUG_CHECKS = TRUE; + else if (checkType == "INJECTION") ENABLE_INJECTION_CHECKS = TRUE; + else if (checkType == "GEN_SANDBOX") ENABLE_GEN_SANDBOX_CHECKS = TRUE; + else if (checkType == "VBOX") ENABLE_VBOX_CHECKS = TRUE; + else if (checkType == "VMWARE") ENABLE_VMWARE_CHECKS = TRUE; + else if (checkType == "VPC") ENABLE_VPC_CHECKS = TRUE; + else if (checkType == "QEMU") ENABLE_QEMU_CHECKS = TRUE; + else if (checkType == "KVM") ENABLE_KVM_CHECKS = TRUE; + else if (checkType == "XEN") ENABLE_XEN_CHECKS = TRUE; + else if (checkType == "WINE") ENABLE_WINE_CHECKS = TRUE; + else if (checkType == "PARALLELS") ENABLE_PARALLELS_CHECKS = TRUE; + else if (checkType == "HYPERV") ENABLE_HYPERV_CHECKS = TRUE; + else if (checkType == "CODE_INJECTIONS") ENABLE_CODE_INJECTIONS = TRUE; + else if (checkType == "TIMING_ATTACKS") ENABLE_TIMING_ATTACKS = TRUE; + else if (checkType == "DUMPING_CHECK") ENABLE_DUMPING_CHECK = TRUE; + else if (checkType == "ANALYSIS_TOOLS") ENABLE_ANALYSIS_TOOLS_CHECK = TRUE; + else if (checkType == "ANTI_DISASSM") ENABLE_ANTI_DISASSM_CHECKS = TRUE; +} + + +int main(int argc, char* argv[]) { /* enable functions */ - BOOL ENABLE_TLS_CHECKS = TRUE; - BOOL ENABLE_DEBUG_CHECKS = TRUE; - BOOL ENABLE_INJECTION_CHECKS = TRUE; - BOOL ENABLE_GEN_SANDBOX_CHECKS = TRUE; - BOOL ENABLE_VBOX_CHECKS = TRUE; - BOOL ENABLE_VMWARE_CHECKS = TRUE; - BOOL ENABLE_VPC_CHECKS = TRUE; - BOOL ENABLE_QEMU_CHECKS = TRUE; - BOOL ENABLE_KVM_CHECKS = TRUE; - BOOL ENABLE_XEN_CHECKS = TRUE; - BOOL ENABLE_WINE_CHECKS = TRUE; - BOOL ENABLE_PARALLELS_CHECKS = TRUE; - BOOL ENABLE_HYPERV_CHECKS = TRUE; - BOOL ENABLE_CODE_INJECTIONS = FALSE; - BOOL ENABLE_TIMING_ATTACKS = TRUE; - BOOL ENABLE_DUMPING_CHECK = TRUE; - BOOL ENABLE_ANALYSIS_TOOLS_CHECK = TRUE; - BOOL ENABLE_ANTI_DISASSM_CHECKS = TRUE; - + if (argc > 1) { + for (int i = 1; i < argc; i += 2) { + if (strcmp(argv[i], "--check") == 0 && (i + 1 < argc)) { + EnableChecks(argv[i + 1]); + } + } + } + else { + EnableDefaultChecks(); + } + /* Resize the console window for better visibility */ resize_console_window(); /* Display general informations */ - _tprintf(_T("[al-khaser version 0.81]")); + _tprintf(_T("[al-khaser version 0.82]")); print_category(TEXT("Initialisation")); API::Init();