From 025febc12447196a28bab9ae0332b5595a47beda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20B=C3=BCchel?= Date: Mon, 31 May 2021 20:15:52 +0200 Subject: [PATCH] SEBWIN-492: Added default list of blacklisted applications. --- .../DataMapping/ApplicationDataMapper.cs | 24 ++++++++++-- .../ConfigurationData/DataValues.cs | 37 +++++++++++++++++++ 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/SafeExamBrowser.Configuration/ConfigurationData/DataMapping/ApplicationDataMapper.cs b/SafeExamBrowser.Configuration/ConfigurationData/DataMapping/ApplicationDataMapper.cs index 2c143d4e..1be0989b 100644 --- a/SafeExamBrowser.Configuration/ConfigurationData/DataMapping/ApplicationDataMapper.cs +++ b/SafeExamBrowser.Configuration/ConfigurationData/DataMapping/ApplicationDataMapper.cs @@ -6,7 +6,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +using System; using System.Collections.Generic; +using System.Linq; using SafeExamBrowser.Settings; using SafeExamBrowser.Settings.Applications; @@ -35,12 +37,12 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping { if (item is IDictionary applicationData) { - var isActive = applicationData.TryGetValue(Keys.Applications.Active, out var v) && v is bool active && active; - var isWindowsProcess = applicationData.TryGetValue(Keys.Applications.OperatingSystem, out v) && v is int os && os == Keys.WINDOWS; + var isWindowsProcess = applicationData.TryGetValue(Keys.Applications.OperatingSystem, out var v) && v is int os && os == Keys.WINDOWS; - if (isActive && isWindowsProcess) + if (isWindowsProcess) { var application = new BlacklistApplication(); + var isActive = applicationData.TryGetValue(Keys.Applications.Active, out v) && v is bool active && active; if (applicationData.TryGetValue(Keys.Applications.AutoTerminate, out v) && v is bool autoTerminate) { @@ -57,7 +59,21 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping application.OriginalName = originalName; } - settings.Applications.Blacklist.Add(application); + var defaultEntry = settings.Applications.Blacklist.FirstOrDefault(a => + { + return a.ExecutableName?.Equals(application.ExecutableName, StringComparison.OrdinalIgnoreCase) == true + && a.OriginalName?.Equals(application.OriginalName, StringComparison.OrdinalIgnoreCase) == true; + }); + + if (defaultEntry != default(BlacklistApplication)) + { + settings.Applications.Blacklist.Remove(defaultEntry); + } + + if (isActive) + { + settings.Applications.Blacklist.Add(application); + } } } } diff --git a/SafeExamBrowser.Configuration/ConfigurationData/DataValues.cs b/SafeExamBrowser.Configuration/ConfigurationData/DataValues.cs index 1545d5f3..a8ddf0cd 100644 --- a/SafeExamBrowser.Configuration/ConfigurationData/DataValues.cs +++ b/SafeExamBrowser.Configuration/ConfigurationData/DataValues.cs @@ -13,6 +13,7 @@ using System.Linq; using System.Reflection; using SafeExamBrowser.Configuration.Contracts; using SafeExamBrowser.Settings; +using SafeExamBrowser.Settings.Applications; using SafeExamBrowser.Settings.Browser; using SafeExamBrowser.Settings.Browser.Proxy; using SafeExamBrowser.Settings.Logging; @@ -104,6 +105,42 @@ namespace SafeExamBrowser.Configuration.ConfigurationData settings.ActionCenter.ShowWirelessNetwork = false; settings.ActionCenter.ShowClock = true; + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "Skype.exe", OriginalName = "Skype.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "SkypeApp.exe", OriginalName = "SkypeApp.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "SkypeHost.exe", OriginalName = "SkypeHost.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "g2mcomm.exe", OriginalName = "g2mcomm.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "GotoMeetingWinStore.exe", OriginalName = "GotoMeetingWinStore.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "TeamViewer.exe", OriginalName = "TeamViewer.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "vncserver.exe", OriginalName = "vncserver.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "vncviewer.exe", OriginalName = "vncviewer.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "vncserverui.exe", OriginalName = "vncserverui.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "chromoting.exe", OriginalName = "chromoting.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "Mikogo-host.exe", OriginalName = "Mikogo-host.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "AeroAdmin.exe", OriginalName = "AeroAdmin.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "beamyourscreen-host.exe", OriginalName = "beamyourscreen-host.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "RemotePCDesktop.exe", OriginalName = "RemotePCDesktop.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "RPCService.exe", OriginalName = "RPCService.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "RPCSuite.exe", OriginalName = "RPCSuite.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "Discord.exe", OriginalName = "Discord.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "Camtasia.exe", OriginalName = "Camtasia.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "CamtasiaStudio.exe", OriginalName = "CamtasiaStudio.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "Camtasia_Studio.exe", OriginalName = "Camtasia_Studio.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "CamPlay.exe", OriginalName = "CamPlay.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "CamRecorder.exe", OriginalName = "CamRecorder.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "CamtasiaUtl.exe", OriginalName = "CamtasiaUtl.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "slack.exe", OriginalName = "slack.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "Element.exe", OriginalName = "Element.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "Zoom.exe", OriginalName = "Zoom.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "Telegram.exe", OriginalName = "Telegram.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "g2mcomm.exe", OriginalName = "g2mcomm.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "g2mlauncher.exe", OriginalName = "g2mlauncher.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "g2mstart.exe", OriginalName = "g2mstart.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "join.me.exe", OriginalName = "join.me.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "join.me.sentinel.exe", OriginalName = "join.me.sentinel.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "Teams.exe", OriginalName = "Teams.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "webexmta.exe", OriginalName = "webexmta.exe" }); + settings.Applications.Blacklist.Add(new BlacklistApplication { ExecutableName = "ptoneclk.exe", OriginalName = "ptoneclk.exe" }); + settings.Browser.AdditionalWindow.AllowAddressBar = false; settings.Browser.AdditionalWindow.AllowBackwardNavigation = true; settings.Browser.AdditionalWindow.AllowDeveloperConsole = false;