This commit is contained in:
user 2023-04-08 12:53:06 +02:00
parent 1fec696909
commit 22ef7ef364

View file

@ -38,9 +38,9 @@ namespace SafeExamBrowser.SystemComponents
this.logger = logger; this.logger = logger;
this.systemInfo = systemInfo; this.systemInfo = systemInfo;
} }
private bool IsVirtualSystemInfo(string biosInfo, string manufacturer, string model) private bool IsVirtualSystemInfo(string biosInfo, string manufacturer, string model)
{ {
bool isVirtualMachine = false; bool isVirtualMachine = false;
biosInfo = biosInfo.ToLower(); biosInfo = biosInfo.ToLower();
@ -133,8 +133,6 @@ namespace SafeExamBrowser.SystemComponents
} }
} }
// TODO: find a way to check BCD registries (to hunt for QEMU HARDDISK) without admin privs
return isVirtualMachine; return isVirtualMachine;
} }
@ -144,7 +142,6 @@ namespace SafeExamBrowser.SystemComponents
ManagementObjectSearcher searcherCpu = new ManagementObjectSearcher("SELECT * FROM Win32_Processor"); ManagementObjectSearcher searcherCpu = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
// TODO: how to handle no CPU?
foreach (ManagementObject obj in searcherCpu.Get()) foreach (ManagementObject obj in searcherCpu.Get())
{ {
isVirtualMachine |= ((string) obj["Name"]).ToLower().Contains(" kvm "); // qemu isVirtualMachine |= ((string) obj["Name"]).ToLower().Contains(" kvm "); // qemu
@ -162,7 +159,7 @@ namespace SafeExamBrowser.SystemComponents
var model = systemInfo.Model; var model = systemInfo.Model;
var devices = systemInfo.PlugAndPlayDeviceIds; var devices = systemInfo.PlugAndPlayDeviceIds;
// redundant: registry check (hardware config) does this aswell // redundancy: registry check does this aswell (systemInfo may be using different methods)
isVirtualMachine |= IsVirtualSystemInfo(biosInfo, manufacturer, model); isVirtualMachine |= IsVirtualSystemInfo(biosInfo, manufacturer, model);
isVirtualMachine |= IsVirtualWmi(); isVirtualMachine |= IsVirtualWmi();
isVirtualMachine |= IsVirtualRegistry(); isVirtualMachine |= IsVirtualRegistry();