Skip to content

Commit 8d95057

Browse files
authored
Merge pull request #104 from kernelwernel/dev
Dev
2 parents d9a2ebf + 7eba4d7 commit 8d95057

4 files changed

Lines changed: 1623 additions & 576 deletions

File tree

docs/documentation.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,6 @@ VMAware provides a convenient way to not only check for VMs, but also have the f
407407
| `VM::HYPERV_CPUID` | Check for Hyper-V specific CPUID results in ecx | | 35% | | | |
408408
| `VM::CUCKOO_DIR` | Check for Cuckoo specific directory | Windows | 15% | | | |
409409
| `VM::CUCKOO_PIPE` | Check for Cuckoo specific piping mechanism | Windows | 20% | | | |
410-
| `VM::USB_DRIVE` | Check for absence of USB drives | Windows | 5% | | | |
411410
| `VM::HYPERV_HOSTNAME` | Check for default Azure hostname format (Azure uses Hyper-V as their base VM brand) | Windows, Linux | 50% | | | |
412411
| `VM::GENERAL_HOSTNAME` | Check for general hostnames that match with certain VM brands | Windows, Linux | 20% | | | |
413412
| `VM::SCREEN_RESOLUTION` | Check for pre-set screen resolutions commonly found in VMs | Windows | 10% | | | |
@@ -423,7 +422,7 @@ VMAware provides a convenient way to not only check for VMs, but also have the f
423422
| `VM::NO_MEMO` | This will disable memoization, meaning the result will not be fetched through a previous computation of the `VM::detect()` function. Use this if you're only using a single function from the `VM` struct for a performance boost. |
424423
| `VM::EXTREME` | This will disregard the weights/biases in the scoring system. It will essentially treat any technique that found a hit as a VM detection no matter how low that technique's certainty is, so if a single technique is positive then it will return true. |
425424
| `VM::DEFAULT` | This represents a range of flags which are enabled if no default argument is provided. |
426-
| `VM::ENABLE_HYPERV_HOST` | Windows 11 (and 10 if enabled manually) may have Hyper-V as a default virtualisation solution for any host program even if the OS is running as host. There isn't a way to detect whether the host program is ran in default virtualisation mode, or manually intended virtualisation, which is one of the main hurdles of the library to overcome. This is a Hyper-V specific problem, and the library will discard any Hyper-V brand suspicions as not running in a VM by default. But if this flag is enabled then it will still count it regardless of the risk that it might be Hyper-V's default host virtualisation for every host program. So basically this flag means that "I'm aware this program might be running in a default virtualised environment on host, but I'll still count this as running in a VM anyway whether it's default virtualisation or manually intended virtualisation". |
425+
| `VM::ENABLE_HYPERV_HOST` | Windows 11 (and 10 if enabled manually) may have Hyper-V as a default virtualisation solution for any host program even if the OS is running as host. There isn't a way to detect whether the host program is ran in default virtualisation mode, or manually intended virtualisation. This is a Hyper-V specific problem, and the library will use heuristical methods to discard Hyper-V's host virtualiser as not running in a VM by default. But if this flag is enabled then it will still count it regardless of the risk that it might be Hyper-V's default host virtualisation for every host program. So basically this flag means that "I'm aware this program might be running in a default virtualised environment on host, but I'll still count this as running in a VM anyway whether it's default virtualisation or manually intended virtualisation". |
427426
| `VM::WIN_HYPERV_DEFAULT` | ⚠️ **DEPRECATED** ⚠️ Same as above, but deprecated as of 1.5 release. |
428427
| `VM::MULTIPLE` | This is specific to `VM::brand()`. This will basically return a `std::string` message of what brands could be involved. For example, it could return "`VMware or VirtualBox`" instead of having a single brand string output. This has no effect if applied to any other functions than `VM::brand()`. |
429428
| `VM::HIGH_THRESHOLD` | This is specific to `VM::detect()` and `VM::percentage()`, which will set the threshold bar to confidently detect a VM by 3.5x higher. |

src/cli.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
#include <windows.h>
3737
#endif
3838

39-
constexpr const char* ver = "1.5";
40-
constexpr const char* date = "June 2024";
39+
constexpr const char* ver = "1.6";
40+
constexpr const char* date = "July 2024";
4141

4242
constexpr const char* bold = "\033[1m";
4343
constexpr const char* ansi_exit = "\x1B[0m";
@@ -145,7 +145,7 @@ std::string message(const std::uint8_t score, const std::string &brand) {
145145
very_likely = "Very likely a " + brand + " VM";
146146
inside_vm = "Running inside a " + brand + " VM";
147147
}
148-
148+
149149
if (score == 0) { return baremetal; }
150150
else if (score <= 12) { return very_unlikely; }
151151
else if (score <= 25) { return unlikely; }
@@ -311,7 +311,6 @@ void general(const bool enable_hyperv = true) {
311311

312312
std::cout << "VM confirmation: " << (is_detected ? green : red) << std::boolalpha << is_detected << std::noboolalpha << ansi_exit << "\n";
313313

314-
315314
const char* count_color = "";
316315

317316
switch (detected_count) {

src/vmaware.hpp

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* ██║ ██║██╔████╔██║███████║██║ █╗ ██║███████║██████╔╝█████╗
55
* ╚██╗ ██╔╝██║╚██╔╝██║██╔══██║██║███╗██║██╔══██║██╔══██╗██╔══╝
66
* ╚████╔╝ ██║ ╚═╝ ██║██║ ██║╚███╔███╔╝██║ ██║██║ ██║███████╗
7-
* ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ 1.5 (June 2024)
7+
* ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ 1.6 (July 2024)
88
*
99
* C++ VM detection library
1010
*
@@ -22,14 +22,14 @@
2222
*
2323
*
2424
* ================================ SECTIONS ==================================
25-
* - enums for publicly accessible techniques => line 293
26-
* - struct for internal cpu operations => line 488
27-
* - struct for internal memoization => line 859
28-
* - struct for internal utility functions => line 949
29-
* - struct for internal core components => line 7337
30-
* - start of internal VM detection techniques => line 1727
31-
* - start of public VM detection functions => line 7693
32-
* - start of externally defined variables => line 8038
25+
* - enums for publicly accessible techniques => line 302
26+
* - struct for internal cpu operations => line 519
27+
* - struct for internal memoization => line 891
28+
* - struct for internal utility functions => line 996
29+
* - struct for internal core components => line 7781
30+
* - start of internal VM detection techniques => line 1815
31+
* - start of public VM detection functions => line 8277
32+
* - start of externally defined variables => line 8672
3333
*
3434
*
3535
* ================================ EXAMPLE ==================================
@@ -8096,6 +8096,7 @@ struct VM {
80968096

80978097
core_debug("HYPERV_HOST_CHECK: technique_check = ", no_possible_brand);
80988098

8099+
// by the end of this, if it doesn't find it possible to have Hyper-V then that assumes the result has been tampered somehow
80998100
return (no_possible_brand);
81008101
};
81018102

@@ -8365,12 +8366,6 @@ struct VM {
83658366

83668367
#define brands core::brand_scoreboard
83678368

8368-
// this gets annoying really fast
8369-
//#ifdef __VMAWARE_DEBUG__
8370-
// for (const auto p : brands) {
8371-
// core_debug("scoreboard: ", (int)p.second, " : ", p.first);
8372-
// }
8373-
//#endif
83748369

83758370
// check if it's already cached and return that instead
83768371
if (core::is_disabled(flags, NO_MEMO)) {
@@ -8506,6 +8501,13 @@ struct VM {
85068501
}
85078502
}
85088503

8504+
// this gets annoying really fast
8505+
#ifdef __VMAWARE_DEBUG__
8506+
for (const auto p : brands) {
8507+
core_debug("scoreboard: ", (int)p.second, " : ", p.first);
8508+
}
8509+
#endif
8510+
85098511
return current_brand;
85108512
}
85118513

@@ -8895,4 +8897,4 @@ const std::map<VM::u8, VM::core::technique> VM::core::technique_table = {
88958897
// __TABLE_LABEL, add your technique above
88968898
// { VM::FUNCTION, { POINTS, FUNCTION_POINTER }}
88978899
// ^ template
8898-
};
8900+
};

0 commit comments

Comments
 (0)