diff --git a/README.md b/README.md index cad345d..435880f 100644 --- a/README.md +++ b/README.md @@ -216,6 +216,7 @@ And if you found this project useful, a star would be appreciated :) - Eric Parker's discord community - [ShellCode33](https://github.com/ShellCode33) - [Georgii Gennadev (D00Movenok)](https://github.com/D00Movenok) +- [utoshu](https://github.com/utoshu)
diff --git a/src/cli.cpp b/src/cli.cpp index 1f756a5..2b7aa70 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -514,6 +514,7 @@ void general() { checker(VM::WSL_PROC, "WSL string in /proc"); checker(VM::ANYRUN_DRIVER, "ANY.RUN driver"); checker(VM::ANYRUN_DIRECTORY, "ANY.RUN directory"); + checker(VM::GPU_CHIPTYPE, "GPU Chiptype"); std::printf("\n"); diff --git a/src/vmaware.hpp b/src/vmaware.hpp index 4419120..8824374 100644 --- a/src/vmaware.hpp +++ b/src/vmaware.hpp @@ -8,7 +8,7 @@ * * C++ VM detection library * - * - Made by: @kernelwernel (https://github.com/kernelwernel) + * - Made by: kernelwernel (https://github.com/kernelwernel) * - Contributed by: * - Requiem (https://github.com/NotRequiem) * - Alex (https://github.com/greenozon) @@ -16,6 +16,7 @@ * - Vladyslav Miachkov (https://github.com/fameowner99) * - Alan Tse (https://github.com/alandtse) * - Georgii Gennadev (https://github.com/D00Movenok) + * - utoshu (https://github.com/utoshu) * - Repository: https://github.com/kernelwernel/VMAware * - Docs: https://github.com/kernelwernel/VMAware/docs/documentation.md * - Full credits: https://github.com/kernelwernel/VMAware#credits-and-contributors-%EF%B8%8F @@ -439,6 +440,7 @@ struct VM { WSL_PROC, ANYRUN_DRIVER, ANYRUN_DIRECTORY, + GPU_CHIPTYPE, // start of settings technique flags (THE ORDERING IS VERY SPECIFIC HERE AND MIGHT BREAK SOMETHING IF RE-ORDERED) NO_MEMO, @@ -9128,6 +9130,54 @@ struct VM { } + /** + * @brief Use wmic to get the GPU/videocontrollers chip type. + * @category Windows + * @author utoshu + */ + [[nodiscard]] static bool gpu_chiptype() try { +#if (!MSVC) + return false; +#else + std::string command = "wmic path win32_videocontroller get videoprocessor"; + std::string result = ""; + + FILE* pipe = _popen(command.c_str(), "r"); + if (!pipe) { + debug("GPU_CHIPTYPE: failed to run wmic command"); + return false; + } + + char buffer[128]; + while (!feof(pipe)) { + if (fgets(buffer, 128, pipe) != NULL) + result += buffer; + } + _pclose(pipe); + + std::transform(result.begin(), result.end(), result.begin(), ::tolower); + + if (util::find(result, "vmware")) { + return core::add(VMWARE); + } + + if (util::find(result, "virtualbox")) { + return core::add(VBOX); + } + + if (util::find(result, "hyper-v")) { + return core::add(HYPERV); + } + + return false; + #endif + } + catch (...) { + debug("GPU_CHIPTYPE: caught error, returned false"); + return false; + } + + /** * @brief Check for any.run driver presence * @category Windows @@ -10708,5 +10758,6 @@ const std::map VM::core::technique_table = { VM::PODMAN_FILE, { 15, VM::podman_file, true } }, { VM::WSL_PROC, { 30, VM::wsl_proc_subdir, false } }, { VM::ANYRUN_DRIVER, { 65, VM::anyrun_driver, false } }, - { VM::ANYRUN_DIRECTORY, { 35, VM::anyrun_directory, false } } + { VM::ANYRUN_DIRECTORY, { 35, VM::anyrun_directory, false } }, + { VM::GPU_CHIPTYPE, { 100, VM::gpu_chiptype, false }} };