Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #126

Merged
merged 7 commits into from
Aug 12, 2024
Merged

Dev #126

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,29 @@ The library is:

<br>

> [!CAUTION]
**DO NOT USE THIS LIBRARY FOR CRITICAL SOFTWARE** (i.e. anti-cheats, proprietary software, paid software, etc...)
>
> However, a solution is in development that will allow this in the next release which should be soon.
>
> The full reason can be found [here](deprecation.md)



## Example 🧪
```cpp
#include "vmaware.hpp"
#include <iostream>

int main() {
if (VM::detect()) {
std::cout << "Virtual machine detected!" << std::endl;
std::cout << "VM name: " << VM::brand() << std::endl;
std::cout << "Virtual machine detected!" << "\n";
std::cout << "VM name: " << VM::brand() << "\n";
} else {
std::cout << "Running in baremetal" << std::endl;
std::cout << "Running in baremetal" << "\n";
}

std::cout << "VM certainty: " << (int)VM::percentage() << "%" << std::endl;
std::cout << "VM certainty: " << (int)VM::percentage() << "%" << "\n";
}
```

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

<br>

If you just want the binaries, head over to the latest [release section](https://github.com/kernelwernel/VMAware/releases/latest)

<br>
Expand All @@ -112,7 +123,7 @@ You can view the full docs [here](docs/documentation.md). All the details such a
> 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.

- Why GPL 3.0 and MIT?
> 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.
> 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.

- I have linker errors when compiling
> 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.
Expand Down
18 changes: 10 additions & 8 deletions auxiliary/vmtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@
#include <iostream>

int main(void) {
const bool test1 = VM::detect();
const bool test2 = VM::detect(VM::ALL);
const bool test3 = VM::detect(VM::DEFAULT);
const bool test4 = VM::detect(VM::DEFAULT, VM::ALL);
const bool test5 = VM::detect(VM::DEFAULT, VM::DISABLE(VM::RDTSC));
const bool test6 = VM::detect(VM::DEFAULT, VM::DISABLE(VM::RDTSC), VM::EXTREME);
const bool test7 = VM::detect(VM::NO_MEMO, VM::EXTREME, VM::MULTIPLE, VM::ENABLE_HYPERV_HOST);
const std::string test8 = VM::brand();
//const bool test1 = VM::detect();
//const bool test2 = VM::detect(VM::ALL);
//const bool test3 = VM::detect(VM::DEFAULT);
//const bool test4 = VM::detect(VM::DEFAULT, VM::ALL);
//const bool test5 = VM::detect(VM::DEFAULT, VM::DISABLE(VM::RDTSC));
//const bool test6 = VM::detect(VM::DEFAULT, VM::DISABLE(VM::RDTSC), VM::EXTREME);
//const bool test7 = VM::detect(VM::NO_MEMO, VM::EXTREME, VM::MULTIPLE, VM::ENABLE_HYPERV_HOST);
//const std::string test8 = VM::brand();
const uint8_t test9 = VM::percentage(VM::SPOOFABLE);
std::cout << (int)test9 << "\n";
return 0;
}
8 changes: 3 additions & 5 deletions src/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,7 @@ void general() {

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

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

Expand All @@ -578,7 +577,7 @@ void general() {
}

const char* percent_color = "";
const std::uint8_t percent = VM::percentage(spoofable_setting);
const std::uint8_t percent = VM::percentage(VM::NULL_ARG/*spoofable_setting*/);

if (percent == 0) { percent_color = red; }
else if (percent < 25) { percent_color = red_orange; }
Expand Down Expand Up @@ -635,9 +634,8 @@ void general() {
<< ansi_exit
<< "\n\n";


if ((brand == "Hyper-V artifact (not an actual VM)") && notes_enabled) {
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";
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";
} else if (notes_enabled) {
if (!arg_bitset.test(SPOOFABLE)) {
std::cout << tip << "To enable spoofable techniques, run with the \"--spoofable\" argument\n\n";
Expand Down
Loading
Loading