Skip to content

Commit a7e31e0

Browse files
authored
Merge pull request #126 from kernelwernel/dev
Dev
2 parents d9f65e3 + 99a6a8c commit a7e31e0

4 files changed

Lines changed: 401 additions & 272 deletions

File tree

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,29 @@ The library is:
2828

2929
<br>
3030

31+
> [!CAUTION]
32+
**DO NOT USE THIS LIBRARY FOR CRITICAL SOFTWARE** (i.e. anti-cheats, proprietary software, paid software, etc...)
33+
>
34+
> However, a solution is in development that will allow this in the next release which should be soon.
35+
>
36+
> The full reason can be found [here](deprecation.md)
37+
38+
39+
3140
## Example 🧪
3241
```cpp
3342
#include "vmaware.hpp"
3443
#include <iostream>
3544

3645
int main() {
3746
if (VM::detect()) {
38-
std::cout << "Virtual machine detected!" << std::endl;
39-
std::cout << "VM name: " << VM::brand() << std::endl;
47+
std::cout << "Virtual machine detected!" << "\n";
48+
std::cout << "VM name: " << VM::brand() << "\n";
4049
} else {
41-
std::cout << "Running in baremetal" << std::endl;
50+
std::cout << "Running in baremetal" << "\n";
4251
}
4352

44-
std::cout << "VM certainty: " << (int)VM::percentage() << "%" << std::endl;
53+
std::cout << "VM certainty: " << (int)VM::percentage() << "%" << "\n";
4554
}
4655
```
4756

@@ -86,6 +95,8 @@ sudo make install
8695
cmake -S . -B build/ -G "Visual Studio 16 2019"
8796
```
8897

98+
<br>
99+
89100
If you just want the binaries, head over to the latest [release section](https://github.com/kernelwernel/VMAware/releases/latest)
90101

91102
<br>
@@ -112,7 +123,7 @@ You can view the full docs [here](docs/documentation.md). All the details such a
112123
> This project is not soliciting the development of malware for obvious reasons. Even if you intend to use it for concealment purposes, it'll most likely be flagged by antiviruses anyway and nothing is obfuscated to begin with.
113124
114125
- Why GPL 3.0 and MIT?
115-
> I would've made it strictly MIT so proprietary software can make use of the library, but some of the techniques employed are from GPL 3.0 projects, and I have no choice but to use the same license for legal reasons. This gave me an idea to make an MIT version without all of the GPL code so it can also be used without forcing your code to be open-source. It should be noted that the MIT version removes **10** techniques out of 85 (as of 1.4 version), and the lesser the number of mechanisms, the less accurate the overall result might be.
126+
> I would've made it strictly MIT so proprietary software can make use of the library, but some of the techniques employed are from GPL 3.0 projects, and I have no choice but to use the same license for legal reasons. This gave me an idea to make an MIT version without all of the GPL code so it can also be used without forcing your code to be open-source. It should be noted that the MIT version removes **12** techniques out of 85 (as of 1.7 version), and the lesser the number of mechanisms, the less accurate the overall result might be.
116127
117128
- I have linker errors when compiling
118129
> If you're compiling with gcc or clang, add the `-lm` and `-lstdc++` flags, or use g++/clang++ compilers instead. If you're receiving linker errors from a brand new VM environment on Linux, update your system with `sudo apt/dnf/yum update -y` to install the necessary C++ components.

auxiliary/vmtest.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@
2424
#include <iostream>
2525

2626
int main(void) {
27-
const bool test1 = VM::detect();
28-
const bool test2 = VM::detect(VM::ALL);
29-
const bool test3 = VM::detect(VM::DEFAULT);
30-
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);
33-
const bool test7 = VM::detect(VM::NO_MEMO, VM::EXTREME, VM::MULTIPLE, VM::ENABLE_HYPERV_HOST);
34-
const std::string test8 = VM::brand();
27+
//const bool test1 = VM::detect();
28+
//const bool test2 = VM::detect(VM::ALL);
29+
//const bool test3 = VM::detect(VM::DEFAULT);
30+
//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);
33+
//const bool test7 = VM::detect(VM::NO_MEMO, VM::EXTREME, VM::MULTIPLE, VM::ENABLE_HYPERV_HOST);
34+
//const std::string test8 = VM::brand();
35+
const uint8_t test9 = VM::percentage(VM::SPOOFABLE);
36+
std::cout << (int)test9 << "\n";
3537
return 0;
3638
}

src/cli.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,7 @@ void general() {
561561

562562
// meaning "if there's no brand conflicts"
563563
if (brand.find(" or ") == std::string::npos) {
564-
const std::string tmp_brand = VM::brand(VM::MULTIPLE, spoofable_setting);
565-
const std::string type_value = type(tmp_brand);
564+
const std::string type_value = type(brand);
566565

567566
std::cout << "VM type: ";
568567

@@ -578,7 +577,7 @@ void general() {
578577
}
579578

580579
const char* percent_color = "";
581-
const std::uint8_t percent = VM::percentage(spoofable_setting);
580+
const std::uint8_t percent = VM::percentage(VM::NULL_ARG/*spoofable_setting*/);
582581

583582
if (percent == 0) { percent_color = red; }
584583
else if (percent < 25) { percent_color = red_orange; }
@@ -635,9 +634,8 @@ void general() {
635634
<< ansi_exit
636635
<< "\n\n";
637636

638-
639637
if ((brand == "Hyper-V artifact (not an actual VM)") && notes_enabled) {
640-
std::cout << note << "The result means that the CLI has found Hyper-V, but as an artifact instead of an actual VM. This means that although the hardware values in fact match with Hyper-V due to how it's designed by Microsoft, the CLI has determined you are NOT in a Hyper-V VM.\n\n";
638+
std::cout << note << " The result means that the CLI has found Hyper-V, but as an artifact instead of an actual VM. This means that although the hardware values in fact match with Hyper-V due to how it's designed by Microsoft, the CLI has determined you are NOT in a Hyper-V VM.\n\n";
641639
} else if (notes_enabled) {
642640
if (!arg_bitset.test(SPOOFABLE)) {
643641
std::cout << tip << "To enable spoofable techniques, run with the \"--spoofable\" argument\n\n";

0 commit comments

Comments
 (0)