From a574e2f2411b42dc3e7d1528045a8d759943f9dd Mon Sep 17 00:00:00 2001 From: diegoara96 Date: Fri, 10 Jul 2020 22:22:37 +0200 Subject: [PATCH 1/2] Changed Mac detection --- SafeExamBrowser.SystemComponents/VirtualMachineDetector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SafeExamBrowser.SystemComponents/VirtualMachineDetector.cs b/SafeExamBrowser.SystemComponents/VirtualMachineDetector.cs index 31cb5d34..4e6a8522 100644 --- a/SafeExamBrowser.SystemComponents/VirtualMachineDetector.cs +++ b/SafeExamBrowser.SystemComponents/VirtualMachineDetector.cs @@ -42,7 +42,7 @@ namespace SafeExamBrowser.SystemComponents if (macAddress != null && macAddress.Count() > 2) { - isVirtualMachine |= ((byte.Parse(macAddress[1].ToString(), NumberStyles.HexNumber) & 2) == 2 || macAddress.StartsWith("080027")); + isVirtualMachine |= (macAddress.StartsWith("525400") || macAddress.StartsWith("080027")); } foreach (var device in plugAndPlayDeviceIds) From 11bf69e0e20f1c880619eb2f235cf5020889b431 Mon Sep 17 00:00:00 2001 From: diegoara96 Date: Mon, 13 Jul 2020 18:55:42 +0200 Subject: [PATCH 2/2] Refactored mac detection --- SafeExamBrowser.SystemComponents/VirtualMachineDetector.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SafeExamBrowser.SystemComponents/VirtualMachineDetector.cs b/SafeExamBrowser.SystemComponents/VirtualMachineDetector.cs index 4e6a8522..b60fcdbf 100644 --- a/SafeExamBrowser.SystemComponents/VirtualMachineDetector.cs +++ b/SafeExamBrowser.SystemComponents/VirtualMachineDetector.cs @@ -16,6 +16,8 @@ namespace SafeExamBrowser.SystemComponents public class VirtualMachineDetector : IVirtualMachineDetector { private static readonly string[] PCI_VENDOR_BLACKLIST = { "vbox", "vid_80ee", "qemu", "ven_1af4", "ven_1b36", "subsys_11001af4" }; //Virtualbox: VBOX, 80EE RedHat: QUEMU, 1AF4, 1B36 + private static readonly string VIRTUALBOX_MAC_PREFIX = "080027"; + private static readonly string QEMU_MAC_PREFIX = "525400"; private ILogger logger; private ISystemInfo systemInfo; @@ -42,7 +44,7 @@ namespace SafeExamBrowser.SystemComponents if (macAddress != null && macAddress.Count() > 2) { - isVirtualMachine |= (macAddress.StartsWith("525400") || macAddress.StartsWith("080027")); + isVirtualMachine |= (macAddress.StartsWith(QEMU_MAC_PREFIX) || macAddress.StartsWith(VIRTUALBOX_MAC_PREFIX)); } foreach (var device in plugAndPlayDeviceIds)