A comprehensive toolkit for detecting virtual machine environments. Available as a cross-platform library (Python, C, C++) and command-line tool for Windows and Linux, it employs multiple techniques to reliably identify various virtualization platforms (e.g., VMware, VirtualBox, Hyper-V, QEMU).
Based on py_vmdetect sources from https://github.com/kepsic/py_vmdetect
You can download installation package for supported linux distributions in Open Build Service
vmdetect
echo $?
vmdetect -n
Bare Metal
vmdetect -i
0
import virtualmachine
print(virtualmachine.name())
import virtualmachine
print(virtualmachine.id())
#include <vmdetect/virtualmachine.h>
#include <iostream>
using namespace std;
int main(int argc, char **argv) {
VirtualMachine vm;
if(vm) {
cout << "Running on '" << vm << "' virtual machine" << endl;
return 1;
}
return 0;
}