Skip to content

Commit c1e9f23

Browse files
committed
delete: removed theoretical points and added new QEMU brand shortcut for VM::CPU_BRAND
1 parent 65f5b41 commit c1e9f23

File tree

2 files changed

+6
-23
lines changed

2 files changed

+6
-23
lines changed

src/cli.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,10 +1008,6 @@ static void general(
10081008

10091009
std::printf("\n");
10101010

1011-
#ifdef __VMAWARE_DEBUG__
1012-
std::cout << "[DEBUG] theoretical maximum points: " << VM::total_points << "\n";
1013-
#endif
1014-
10151011
// struct containing the whole overview of the VM data
10161012
VM::vmaware vm(VM::MULTIPLE, high_threshold, all, dynamic);
10171013

src/vmaware.hpp

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,6 @@ struct VM {
662662
static constexpr u8 settings_count = MULTIPLE - HIGH_THRESHOLD + 1; // get number of settings technique flags
663663
static constexpr u8 INVALID = 255; // explicit invalid technique macro
664664
static constexpr u16 base_technique_count = HIGH_THRESHOLD; // original technique count, constant on purpose (can also be used as a base count value if custom techniques are added)
665-
static constexpr u16 maximum_points = 5510; // theoretical total points if all VM detections returned true (which is practically impossible)
666665
static constexpr u16 threshold_score = 150; // standard threshold score
667666
static constexpr u16 high_threshold_score = 300; // new threshold score from 150 to 300 if VM::HIGH_THRESHOLD flag is enabled
668667
static constexpr bool SHORTCUT = true; // macro for whether VM::core::run_all() should take a shortcut by skipping the rest of the techniques if the threshold score is already met
@@ -687,6 +686,7 @@ struct VM {
687686
// this is specifically meant for VM::detected_count() to
688687
// get the total number of techniques that detected a VM
689688
static u8 detected_count_num;
689+
static u16 technique_count; // get total number of techniques
690690

691691
static std::vector<enum_flags> disabled_techniques;
692692

@@ -4314,6 +4314,11 @@ struct VM {
43144314
#else
43154315
const std::string& brand = cpu::get_brand();
43164316

4317+
// easy shortcut for QEMU
4318+
if (brand.rfind("QEMU Virtual CPU version", 0) == 0) {
4319+
return core::add(brands::QEMU);
4320+
}
4321+
43174322
struct cstrview {
43184323
const char* data;
43194324
std::size_t size;
@@ -12176,10 +12181,6 @@ struct VM {
1217612181
// flags above, and get a total score
1217712182
const u16 points = core::run_all(flags, SHORTCUT);
1217812183

12179-
#if (VMA_CPP >= 23)
12180-
[[assume(points < maximum_points)]];
12181-
#endif
12182-
1218312184
u16 threshold = threshold_score;
1218412185

1218512186
// if high threshold is set, the bar
@@ -12218,10 +12219,6 @@ struct VM {
1221812219
// flags above, and get a total score
1221912220
const u16 points = core::run_all(flags, SHORTCUT);
1222012221

12221-
#if (VMA_CPP >= 23)
12222-
[[assume(points < maximum_points)]];
12223-
#endif
12224-
1222512222
u8 percent = 0;
1222612223
u16 threshold = threshold_score;
1222712224

@@ -12842,12 +12839,6 @@ struct VM {
1284212839

1284312840
};
1284412841
#pragma pack(pop)
12845-
12846-
12847-
static u16 technique_count; // get total number of techniques
12848-
#ifdef __VMAWARE_DEBUG__
12849-
static u16 total_points;
12850-
#endif
1285112842
};
1285212843

1285312844
// ============= EXTERNAL DEFINITIONS =============
@@ -12974,10 +12965,6 @@ std::size_t VM::memo::leaf_cache::next_index = 0;
1297412965
const char* VM::core::last_detected_brand = nullptr;
1297512966
VM::u8 VM::core::last_detected_score = 0;
1297612967

12977-
#ifdef __VMAWARE_DEBUG__
12978-
VM::u16 VM::total_points = 0;
12979-
#endif
12980-
1298112968
// these are basically the base values for the core::arg_handler function.
1298212969
// It's like a bucket that will collect all the bits enabled. If for example
1298312970
// VM::detect(VM::HIGH_THRESHOLD) is passed, the HIGH_THRESHOLD bit will be

0 commit comments

Comments
 (0)