Skip to content

Commit

Permalink
1.9 release
Browse files Browse the repository at this point in the history
  • Loading branch information
kernelwernel committed Sep 11, 2024
1 parent 5485b7a commit bf7eb42
Show file tree
Hide file tree
Showing 3 changed files with 333 additions and 248 deletions.
60 changes: 21 additions & 39 deletions src/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@

#include "vmaware.hpp"

constexpr const char* ver = "1.8";
constexpr const char* date = "August 2024";
constexpr const char* ver = "1.9";
constexpr const char* date = "September 2024";

constexpr const char* bold = "\033[1m";
constexpr const char* ansi_exit = "\x1B[0m";
Expand Down Expand Up @@ -73,6 +73,7 @@ enum arg_enum : std::uint8_t {
};

std::bitset<14> arg_bitset;
const std::uint8_t max_bits = static_cast<std::uint8_t>(VM::MULTIPLE) + 1;

#if (MSVC)
class win_ansi_enabler_t
Expand Down Expand Up @@ -131,8 +132,8 @@ R"(Usage:
-t | --type returns the VM type (if a VM was found)
Extra:
--disable-notes no notes will be provided
--spoofable allow spoofable techniques to be ran (not included by default)
--disable-notes no notes will be provided
--spoofable allow spoofable techniques to be ran (not included by default)
)";
std::exit(0);
Expand Down Expand Up @@ -440,6 +441,22 @@ bool is_disabled(const VM::enum_flags flag) {
}


std::bitset<max_bits> settings() {
std::bitset<max_bits> tmp;

if (arg_bitset.test(SPOOFABLE)) {
tmp.set(VM::SPOOFABLE);
}

if (arg_bitset.test(ALL)) {
tmp |= VM::ALL;
tmp.set(VM::SPOOFABLE);
}

return tmp;
}


void general() {
const std::string detected = ("[ " + std::string(green) + "DETECTED" + std::string(ansi_exit) + " ]");
const std::string not_detected = ("[" + std::string(red) + "NOT DETECTED" + std::string(ansi_exit) + "]");
Expand Down Expand Up @@ -478,21 +495,6 @@ void general() {
};

bool notes_enabled = false;
const std::uint8_t max_bits = static_cast<std::uint8_t>(VM::MULTIPLE) + 1;

auto settings = [&]() -> std::bitset<max_bits> {
std::bitset<max_bits> tmp;

if (arg_bitset.test(SPOOFABLE)) {
tmp.set(VM::SPOOFABLE);
}

if (arg_bitset.test(ALL)) {
tmp |= VM::ALL;
}

return tmp;
};

if (arg_bitset.test(NOTES)) {
notes_enabled = false;
Expand Down Expand Up @@ -815,26 +817,6 @@ int main(int argc, char* argv[]) {
std::cerr << "--stdout, --percent, --detect, --brand, --type, and --conclusion must NOT be a combination, choose only a single one\n";
return 1;
}

const std::uint8_t max_bits = static_cast<std::uint8_t>(VM::MULTIPLE) + 1;

auto settings = [&]() -> std::bitset<max_bits> {
std::bitset<max_bits> setting_bits;

if (arg_bitset.test(SPOOFABLE)) {
setting_bits.set(VM::SPOOFABLE);
}

if (arg_bitset.test(ALL)) {
std::cout << "\n\n\n\n\nALL SET\n\n\n\n";
setting_bits |= VM::ALL;
setting_bits.set(VM::SPOOFABLE);
}

setting_bits.set(NULL_ARG);

return setting_bits;
};

if (arg_bitset.test(STDOUT)) {
return (!VM::detect(VM::NO_MEMO, settings()));
Expand Down
20 changes: 11 additions & 9 deletions src/vmaware.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* ██║ ██║██╔████╔██║███████║██║ █╗ ██║███████║██████╔╝█████╗
* ╚██╗ ██╔╝██║╚██╔╝██║██╔══██║██║███╗██║██╔══██║██╔══██╗██╔══╝
* ╚████╔╝ ██║ ╚═╝ ██║██║ ██║╚███╔███╔╝██║ ██║██║ ██║███████╗
* ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ 1.8 (August 2024)
* ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ 1.9 (September 2024)
*
* C++ VM detection library
*
Expand All @@ -23,14 +23,14 @@
*
*
* ================================ SECTIONS ==================================
* - enums for publicly accessible techniques => line 312
* - struct for internal cpu operations => line 569
* - struct for internal memoization => line 995
* - struct for internal utility functions => line 1118
* - struct for internal core components => line 9196
* - start of internal VM detection techniques => line 2491
* - start of public VM detection functions => line 9541
* - start of externally defined variables => line 10017
* - enums for publicly accessible techniques => line 322
* - struct for internal cpu operations => line 581
* - struct for internal memoization => line 1007
* - struct for internal utility functions => line 1134
* - struct for internal core components => line 9152
* - start of internal VM detection techniques => line 2409
* - start of public VM detection functions => line 9495
* - start of externally defined variables => line 10095
*
*
* ================================ EXAMPLE ==================================
Expand Down Expand Up @@ -10020,6 +10020,8 @@ struct VM {
case SMBIOS_VM_BIT: return "SMBIOS_VM_BIT";
case PODMAN_FILE: return "PODMAN_FILE";
case WSL_PROC: return "WSL_PROC";
case ANYRUN_DRIVER: return "ANYRUN_DRIVER";
case ANYRUN_DIRECTORY: return "ANYRUN_DIRECTORY";
default: return "Unknown flag";
}
}
Expand Down
Loading

0 comments on commit bf7eb42

Please sign in to comment.