Skip to content

Commit 8a50218

Browse files
authored
Merge pull request #282 from kernelwernel/dev
updated core database
2 parents a5146ce + 64088d2 commit 8a50218

File tree

4 files changed

+260
-224
lines changed

4 files changed

+260
-224
lines changed

auxiliary/vmtest.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,22 @@
2525

2626
int main(void) {
2727
//const bool test1 = VM::detect();
28-
const bool test2 = VM::detect(VM::ALL);
28+
//const bool test2 = VM::detect(VM::ALL);
2929
//const bool test3 = VM::detect(VM::DEFAULT);
3030
//const bool test4 = VM::detect(VM::DEFAULT, VM::ALL);
31-
//const bool test5 = VM::detect(VM::DEFAULT, VM::DISABLE(VM::RDTSC));
32-
//const bool test6 = VM::detect(VM::DEFAULT, VM::DISABLE(VM::RDTSC), VM::EXTREME);
31+
const bool test4 = VM::detect(VM::DISABLE(VM::TIMER));
32+
const bool test5 = VM::detect(VM::DEFAULT, VM::DISABLE(VM::TIMER));
33+
const bool test6 = VM::detect(VM::DEFAULT, VM::DISABLE(VM::TIMER, VM::GPU));
3334
//const bool test7 = VM::detect(VM::NO_MEMO, VM::EXTREME, VM::MULTIPLE, VM::ENABLE_HYPERV_HOST);
3435
//const std::string test8 = VM::brand();
3536
//const uint8_t test9 = VM::percentage(VM::SPOOFABLE);
3637
//std::cout << (int)test9 << "\n";
3738

38-
VM::vmaware vm;
39-
40-
std::cout << "Is this a VM? = " << vm.is_vm << "\n";
41-
std::cout << "How many techniques detected a VM? = " << static_cast<int>(vm.detected_count) << "\n";
42-
std::cout << "What's the overview in a human-readable message? = " << vm.conclusion << "\n";
39+
//VM::vmaware vm;
40+
//
41+
//std::cout << "Is this a VM? = " << vm.is_vm << "\n";
42+
//std::cout << "How many techniques detected a VM? = " << static_cast<int>(vm.detected_count) << "\n";
43+
//std::cout << "What's the overview in a human-readable message? = " << vm.conclusion << "\n";
4344

4445
return 0;
4546
}

docs/documentation.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,40 @@ This will fetch the number of techniques that have been detected as a `std::uint
289289

290290
<br>
291291

292+
## `VM::flag_to_string()`
293+
This will take a technique flag enum as an argument and return the string version of it. For example:
294+
```cpp
295+
#include "vmaware.hpp"
296+
#include <iostream>
297+
298+
int main() {
299+
const std::string name = VM::flag_to_string(VM::VMID);
300+
std::cout << "VM::" << name << "\n";
301+
// Output: VM::VMID
302+
// (nothing more, nothing less)
303+
}
304+
```
305+
306+
The reason why this exists is because it can be useful for debugging purposes. It should be noted that the "VM::" part is not included in the string output, so that's based on the programmer's choice if it should remain in the string or not. The example given above is obviously useless since the whole code can be manually handwritten, but the function is especially convenient if it's being used with [`VM::technique_vector`](#variables). For example:
307+
308+
```cpp
309+
#include "vmaware.hpp"
310+
#include <iostream>
311+
312+
int main() {
313+
// this will loop through all the enums in the technique_vector variable,
314+
// and then checks each of them and outputs the enum that was detected
315+
for (const auto technique_enum : VM::technique_vector) {
316+
if (VM::check(technique_enum)) {
317+
const std::string name = VM::flag_to_string(technique_enum);
318+
std::cout << "VM::" << name << " was detected\n";
319+
}
320+
}
321+
}
322+
```
323+
324+
<br>
325+
292326
# vmaware struct
293327
If you prefer having an object to store all the relevant information about the program's environment instead of calling static member functions, you can use the `VM::vmaware` struct:
294328

@@ -353,7 +387,7 @@ VMAware provides a convenient way to not only check for VMs, but also have the f
353387
| `VM::VM_FILES` | Find for VM-specific specific files | Windows | 25% | | | | |
354388
| `VM::HWMODEL` | Check if the sysctl for the hwmodel does not contain the "Mac" string | MacOS | 100% | | | | |
355389
| `VM::DISK_SIZE` | Check if disk size is under or equal to 50GB | Linux | 60% | | | | |
356-
| `VM::VBOX_DEFAULT` | Check for default RAM and DISK sizes set by VirtualBox | Linux and Windows | 25% | Admin | | | |
390+
| `VM::VBOX_DEFAULT` | Check for default RAM and DISK sizes set by VirtualBox | Linux and Windows | 25% | Admin | | | Admin only needed for Linux |
357391
| `VM::VBOX_NETWORK` | Check for VirtualBox network provider string | Windows | 100% | | | | |
358392
| `VM::COMPUTER_NAME` | Check if the computer name (not username to be clear) is VM-specific | Windows | 10% | | GPL | | |
359393
| `VM::WINE_CHECK` | Check wine_get_unix_file_name file for Wine | Windows | 100% | | GPL | | |
@@ -424,7 +458,7 @@ VMAware provides a convenient way to not only check for VMs, but also have the f
424458
| `VM::VM_SIDT` | Check for unknown IDT base address | Windows | 100% | | | | |
425459
| `VM::HDD_SERIAL` | Check for serial numbers of virtual disks | Windows | 100% | | | | |
426460
| `VM::PORT_CONNECTORS` | Check for physical connection ports | Windows | 25% | | | | This technique is known to false flag on devices like Surface Pro |
427-
| `VM::GPU` | Check for GPU capabilities and specific GPU PCI vendor ids | Windows | 100% | | | | |
461+
| `VM::GPU` | Check for GPU capabilities and specific GPU signatures related to VMs | Windows | 100% | Admin | | | Admin only needed for some heuristics |
428462
| `VM::VM_DEVICES` | Check for VM-specific devices | Windows | 45% | | | | |
429463
| `VM::VM_MEMORY` | Check for specific VM memory traces in certain processes | Windows | 65% | | | | |
430464
| `VM::IDT_GDT_MISMATCH` | Check if the IDT and GDT base virtual addresses mismatch between different CPU cores when called from usermode under a root partition | Windows | 50% | | | | |

0 commit comments

Comments
 (0)