Skip to content

Commit 52b4a2a

Browse files
committed
fixed ANY.RUN discrepancy, added correct issue template, fixed bold character encoding
1 parent 20653c3 commit 52b4a2a

4 files changed

Lines changed: 30 additions & 25 deletions

File tree

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
For a report on a false positive, please make sure that you include:
1+
For a report on a false positive/bug, please make sure that you include:
22
- which OS and VM you are using
33
- which technique(s) have given a false positive
44
- a screenshot or copy pasted message of the CLI's output
5+
- if necessary, running the [debug binary](https://github.com/kernelwernel/VMAware/releases/download/v2.2.0/vmaware_debug.exe) and copy pasting the output would be immensely useful for us to diagnose your issue.
56

67
> [!NOTE]
78
> Specific versions or in-depth system info is not required, just the bare basics is what we're looking for.
89
9-
If your issue is not a false positive, please make sure to write as much information as needed.
10+
If your issue is not a false positive, please make sure to write the necessary information needed.

docs/documentation.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- [`VM::conclusion()`](#vmconclusion)
1111
- [`VM::detected_count()`](#vmdetected_count)
1212
- [`VM::vmaware struct`](#vmaware-struct)
13+
- [Overall things to avoid](#overall-things-to-avoid)
1314
- [Flag table](#flag-table)
1415
- [Brand table](#brand-table)
1516
- [Setting flags](#setting-flags)
@@ -411,6 +412,12 @@ int main() {
411412

412413
<br>
413414

415+
# Overall things to avoid
416+
❌ 1. Do NOT rely on the percentage to determine whether you're in a VM. The lib is not designed for this way, and you're potentially increasing false positives. Use VM::detect() instead for that job.
417+
❌ 2. Do NOT depend your whole program on whether a specific brand was found. VM::brand() will not guarantee it'll give you the result you're looking for even if the environment is in fact that specific VM brand.
418+
❌ 3. Do NOT use VM::NO_MEMO flag if you're not sure what you're doing, this can potentially hamper the performance significantly.
419+
420+
<br>
414421

415422
# Flag table
416423
VMAware provides a convenient way to not only check for VMs, but also have the flexibility and freedom for the end-user to choose what techniques are used with complete control over what gets executed or not. This is handled with a flag system.
@@ -524,7 +531,6 @@ VMAware provides a convenient way to not only check for VMs, but also have the f
524531
| `VM::BAD_POOLS` | Check for system pools allocated by hypervisors | Windows | 80% | | | | |
525532
| `VM::AMD_SEV` | Check for AMD-SEV MSR running on the system | Linux and MacOS | 50% | Admin | | | |
526533
| `VM::AMD_THREAD_MISMATCH` | Check for AMD CPU thread count database if it matches the system's thread count | | 95% | | | | |
527-
| `VM::NATIVE_VHD` | Checks if the OS was booted from a VHD container | | 100% | | | | |
528534
| `VM::NATIVE_VHD` | Check for OS being booted from a VHD container | Windows | 100% | | | | |
529535
| `VM::VIRTUAL_REGISTRY` | Check for particular object directory which is present in Sandboxie virtual environment but not in usual host systems | Windows | 65% | | | | Admin only needed for Linux |
530536
| `VM::FIRMWARE` | Check for VM signatures and patched strings by hardeners in firmware, while ensuring the BIOS serial is valid | Windows and Linux | 75% | | | | |

src/cli.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -821,36 +821,27 @@ void checker(const VM::enum_flags flag, const char* message) {
821821
// overload for std::function, this is specific for any.run techniques
822822
// that are embedded in the CLI because it was removed in the lib as of 2.0
823823
void checker(const std::function<bool()>& func, const char* message) {
824-
#if __cplusplus >= 201703L
825-
if constexpr (!CLI_WINDOWS) {
826-
if (arg_bitset.test(VERBOSE)) {
827-
unsupported_count++;
828-
}
829-
else {
830-
supported_count++;
831-
}
832-
}
833-
else {
834-
supported_count++;
835-
}
836-
#else
837-
#if !CLI_WINDOWS
824+
#if (!CLI_WINDOWS)
838825
if (arg_bitset.test(VERBOSE)) {
839826
unsupported_count++;
840-
}
841-
else {
827+
} else {
842828
supported_count++;
843829
}
844830
#else
845831
supported_count++;
846832
#endif
847-
#endif
833+
834+
const bool result = func();
848835

849836
std::cout <<
850-
(func() ? detected : not_detected) <<
837+
(result ? detected : not_detected) <<
838+
(result ? bold : "") <<
851839
" Checking " <<
852840
message <<
853-
"...\n";
841+
"..." <<
842+
(result ? ansi_exit : "") <<
843+
"\n";
844+
854845
}
855846

856847

@@ -1174,11 +1165,20 @@ void general() {
11741165
{
11751166
const char* conclusion_color = color(vm.percentage);
11761167

1168+
std::string conclusion = vm.conclusion;
1169+
1170+
if (is_anyrun && VM::brand() == brands::NULL_BRAND) {
1171+
const std::string original = "unknown";
1172+
const std::string new_brand = "ANY.RUN";
1173+
1174+
replace(conclusion, original, new_brand);
1175+
}
1176+
11771177
std::cout
11781178
<< bold
11791179
<< "====== CONCLUSION: "
11801180
<< ansi_exit
1181-
<< conclusion_color << vm.conclusion << " " << ansi_exit
1181+
<< conclusion_color << conclusion << " " << ansi_exit
11821182
<< bold
11831183
<< "======"
11841184
<< ansi_exit

src/vmaware.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11117,8 +11117,6 @@ struct VM {
1111711117
// brand is "Azure Hyper-V" instead of just "Hyper-V". So what
1111811118
// this section does is "merge" the brands together to form
1111911119
// a more accurate idea of the brand(s) involved.
11120-
11121-
1112211120
merge(TMP_AZURE, TMP_HYPERV, TMP_AZURE);
1112311121
merge(TMP_AZURE, TMP_VPC, TMP_AZURE);
1112411122
merge(TMP_AZURE, TMP_HYPERV_VPC, TMP_AZURE);

0 commit comments

Comments
 (0)