isVirtualized function

Future<bool> isVirtualized()

Determine this program executed under virtualized platform. (e.g. Virtual machine, container).

Once hasHypervisor return true, it compare manufactor and model informations from SystemInfo to decide this program is actually executing under virtual machine or container. However, it can be easily defeated if virtual machines allows altering system properties (e.g. QEMU).

This result is not related with BIOS information that it does not appeared in exportRawVendorInfoToJson.

Implementation

Future<bool> isVirtualized() async {
  if (!await hasHypervisor()) {
    return false;
  }

  return getSystemInfo()
      .then((sys) => (sys.manufacturer ?? "", sys.productName ?? ""))
      .then(vmSysManufactureModel.contains);
}