SEBSP-107: Implemented resp. improved configuration for metadata capturing.
This commit is contained in:
parent
91f2c14a77
commit
e5c02a1f74
8 changed files with 107 additions and 49 deletions
|
@ -75,15 +75,6 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping
|
||||||
case Keys.Proctoring.JitsiMeet.VideoMuted:
|
case Keys.Proctoring.JitsiMeet.VideoMuted:
|
||||||
MapJitsiMeetVideoMuted(settings, value);
|
MapJitsiMeetVideoMuted(settings, value);
|
||||||
break;
|
break;
|
||||||
case Keys.Proctoring.ScreenProctoring.CaptureApplicationName:
|
|
||||||
MapCaptureApplicationName(settings, value);
|
|
||||||
break;
|
|
||||||
case Keys.Proctoring.ScreenProctoring.CaptureBrowserUrl:
|
|
||||||
MapCaptureBrowserUrl(settings, value);
|
|
||||||
break;
|
|
||||||
case Keys.Proctoring.ScreenProctoring.CaptureWindowTitle:
|
|
||||||
MapCaptureWindowTitle(settings, value);
|
|
||||||
break;
|
|
||||||
case Keys.Proctoring.ScreenProctoring.ClientId:
|
case Keys.Proctoring.ScreenProctoring.ClientId:
|
||||||
MapClientId(settings, value);
|
MapClientId(settings, value);
|
||||||
break;
|
break;
|
||||||
|
@ -108,6 +99,15 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping
|
||||||
case Keys.Proctoring.ScreenProctoring.MaxInterval:
|
case Keys.Proctoring.ScreenProctoring.MaxInterval:
|
||||||
MapMaxInterval(settings, value);
|
MapMaxInterval(settings, value);
|
||||||
break;
|
break;
|
||||||
|
case Keys.Proctoring.ScreenProctoring.MetaData.CaptureApplicationData:
|
||||||
|
MapCaptureApplicationData(settings, value);
|
||||||
|
break;
|
||||||
|
case Keys.Proctoring.ScreenProctoring.MetaData.CaptureBrowserData:
|
||||||
|
MapCaptureBrowserData(settings, value);
|
||||||
|
break;
|
||||||
|
case Keys.Proctoring.ScreenProctoring.MetaData.CaptureWindowTitle:
|
||||||
|
MapCaptureWindowTitle(settings, value);
|
||||||
|
break;
|
||||||
case Keys.Proctoring.ScreenProctoring.MinInterval:
|
case Keys.Proctoring.ScreenProctoring.MinInterval:
|
||||||
MapMinInterval(settings, value);
|
MapMinInterval(settings, value);
|
||||||
break;
|
break;
|
||||||
|
@ -320,19 +320,19 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MapCaptureApplicationName(AppSettings settings, object value)
|
private void MapCaptureApplicationData(AppSettings settings, object value)
|
||||||
{
|
{
|
||||||
if (value is bool capture)
|
if (value is bool capture)
|
||||||
{
|
{
|
||||||
settings.Proctoring.ScreenProctoring.CaptureApplicationName = capture;
|
settings.Proctoring.ScreenProctoring.MetaData.CaptureApplicationData = capture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MapCaptureBrowserUrl(AppSettings settings, object value)
|
private void MapCaptureBrowserData(AppSettings settings, object value)
|
||||||
{
|
{
|
||||||
if (value is bool capture)
|
if (value is bool capture)
|
||||||
{
|
{
|
||||||
settings.Proctoring.ScreenProctoring.CaptureBrowserUrl = capture;
|
settings.Proctoring.ScreenProctoring.MetaData.CaptureBrowserData = capture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping
|
||||||
{
|
{
|
||||||
if (value is bool capture)
|
if (value is bool capture)
|
||||||
{
|
{
|
||||||
settings.Proctoring.ScreenProctoring.CaptureWindowTitle = capture;
|
settings.Proctoring.ScreenProctoring.MetaData.CaptureWindowTitle = capture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -257,14 +257,14 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
|
||||||
settings.Proctoring.JitsiMeet.SendVideo = true;
|
settings.Proctoring.JitsiMeet.SendVideo = true;
|
||||||
settings.Proctoring.JitsiMeet.ShowMeetingName = false;
|
settings.Proctoring.JitsiMeet.ShowMeetingName = false;
|
||||||
settings.Proctoring.JitsiMeet.VideoMuted = false;
|
settings.Proctoring.JitsiMeet.VideoMuted = false;
|
||||||
settings.Proctoring.ScreenProctoring.CaptureApplicationName = true;
|
|
||||||
settings.Proctoring.ScreenProctoring.CaptureBrowserUrl = true;
|
|
||||||
settings.Proctoring.ScreenProctoring.CaptureWindowTitle = true;
|
|
||||||
settings.Proctoring.ScreenProctoring.Enabled = false;
|
settings.Proctoring.ScreenProctoring.Enabled = false;
|
||||||
settings.Proctoring.ScreenProctoring.ImageDownscaling = 1.0;
|
settings.Proctoring.ScreenProctoring.ImageDownscaling = 1.0;
|
||||||
settings.Proctoring.ScreenProctoring.ImageFormat = ImageFormat.Png;
|
settings.Proctoring.ScreenProctoring.ImageFormat = ImageFormat.Png;
|
||||||
settings.Proctoring.ScreenProctoring.ImageQuantization = ImageQuantization.Grayscale4bpp;
|
settings.Proctoring.ScreenProctoring.ImageQuantization = ImageQuantization.Grayscale4bpp;
|
||||||
settings.Proctoring.ScreenProctoring.MaxInterval = 5000;
|
settings.Proctoring.ScreenProctoring.MaxInterval = 5000;
|
||||||
|
settings.Proctoring.ScreenProctoring.MetaData.CaptureApplicationData = true;
|
||||||
|
settings.Proctoring.ScreenProctoring.MetaData.CaptureBrowserData = true;
|
||||||
|
settings.Proctoring.ScreenProctoring.MetaData.CaptureWindowTitle = true;
|
||||||
settings.Proctoring.ScreenProctoring.MinInterval = 1000;
|
settings.Proctoring.ScreenProctoring.MinInterval = 1000;
|
||||||
settings.Proctoring.ShowRaiseHandNotification = true;
|
settings.Proctoring.ShowRaiseHandNotification = true;
|
||||||
settings.Proctoring.ShowTaskbarNotification = true;
|
settings.Proctoring.ShowTaskbarNotification = true;
|
||||||
|
|
|
@ -258,9 +258,6 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
|
||||||
|
|
||||||
internal static class ScreenProctoring
|
internal static class ScreenProctoring
|
||||||
{
|
{
|
||||||
internal const string CaptureApplicationName = "screenProctoringMetadataActiveAppEnabled";
|
|
||||||
internal const string CaptureBrowserUrl = "screenProctoringMetadataURLEnabled";
|
|
||||||
internal const string CaptureWindowTitle = "screenProctoringMetadataWindowTitleEnabled";
|
|
||||||
internal const string ClientId = "screenProctoringClientId";
|
internal const string ClientId = "screenProctoringClientId";
|
||||||
internal const string ClientSecret = "screenProctoringClientSecret";
|
internal const string ClientSecret = "screenProctoringClientSecret";
|
||||||
internal const string Enabled = "enableScreenProctoring";
|
internal const string Enabled = "enableScreenProctoring";
|
||||||
|
@ -271,6 +268,13 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
|
||||||
internal const string MaxInterval = "screenProctoringScreenshotMaxInterval";
|
internal const string MaxInterval = "screenProctoringScreenshotMaxInterval";
|
||||||
internal const string MinInterval = "screenProctoringScreenshotMinInterval";
|
internal const string MinInterval = "screenProctoringScreenshotMinInterval";
|
||||||
internal const string ServiceUrl = "screenProctoringServiceURL";
|
internal const string ServiceUrl = "screenProctoringServiceURL";
|
||||||
|
|
||||||
|
internal static class MetaData
|
||||||
|
{
|
||||||
|
internal const string CaptureApplicationData = "screenProctoringMetadataActiveAppEnabled";
|
||||||
|
internal const string CaptureBrowserData = "screenProctoringMetadataURLEnabled";
|
||||||
|
internal const string CaptureWindowTitle = "screenProctoringMetadataWindowTitleEnabled";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static class Zoom
|
internal static class Zoom
|
||||||
|
|
|
@ -12,6 +12,7 @@ using System.Text;
|
||||||
using SafeExamBrowser.Browser.Contracts;
|
using SafeExamBrowser.Browser.Contracts;
|
||||||
using SafeExamBrowser.Logging.Contracts;
|
using SafeExamBrowser.Logging.Contracts;
|
||||||
using SafeExamBrowser.Monitoring.Contracts.Applications;
|
using SafeExamBrowser.Monitoring.Contracts.Applications;
|
||||||
|
using SafeExamBrowser.Settings.Proctoring;
|
||||||
using SafeExamBrowser.WindowsApi.Contracts.Events;
|
using SafeExamBrowser.WindowsApi.Contracts.Events;
|
||||||
|
|
||||||
namespace SafeExamBrowser.Proctoring.ScreenProctoring.Data
|
namespace SafeExamBrowser.Proctoring.ScreenProctoring.Data
|
||||||
|
@ -21,6 +22,7 @@ namespace SafeExamBrowser.Proctoring.ScreenProctoring.Data
|
||||||
private readonly IApplicationMonitor applicationMonitor;
|
private readonly IApplicationMonitor applicationMonitor;
|
||||||
private readonly IBrowserApplication browser;
|
private readonly IBrowserApplication browser;
|
||||||
private readonly ILogger logger;
|
private readonly ILogger logger;
|
||||||
|
private readonly MetaDataSettings settings;
|
||||||
|
|
||||||
private string applicationInfo;
|
private string applicationInfo;
|
||||||
private string browserInfo;
|
private string browserInfo;
|
||||||
|
@ -41,16 +43,23 @@ namespace SafeExamBrowser.Proctoring.ScreenProctoring.Data
|
||||||
WindowTitle = windowTitle
|
WindowTitle = windowTitle
|
||||||
};
|
};
|
||||||
|
|
||||||
internal MetaDataAggregator(IApplicationMonitor applicationMonitor, IBrowserApplication browser, TimeSpan elapsed, ILogger logger)
|
internal MetaDataAggregator(
|
||||||
|
IApplicationMonitor applicationMonitor,
|
||||||
|
IBrowserApplication browser,
|
||||||
|
TimeSpan elapsed,
|
||||||
|
ILogger logger,
|
||||||
|
MetaDataSettings settings)
|
||||||
{
|
{
|
||||||
this.applicationMonitor = applicationMonitor;
|
this.applicationMonitor = applicationMonitor;
|
||||||
this.browser = browser;
|
this.browser = browser;
|
||||||
this.elapsed = elapsed;
|
this.elapsed = elapsed;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
|
this.settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Capture(IntervalTrigger interval = default, KeyboardTrigger keyboard = default, MouseTrigger mouse = default)
|
internal void Capture(IntervalTrigger interval = default, KeyboardTrigger keyboard = default, MouseTrigger mouse = default)
|
||||||
{
|
{
|
||||||
|
Initialize();
|
||||||
CaptureApplicationData();
|
CaptureApplicationData();
|
||||||
CaptureBrowserData();
|
CaptureBrowserData();
|
||||||
|
|
||||||
|
@ -74,24 +83,29 @@ namespace SafeExamBrowser.Proctoring.ScreenProctoring.Data
|
||||||
{
|
{
|
||||||
if (applicationMonitor.TryGetActiveApplication(out var application))
|
if (applicationMonitor.TryGetActiveApplication(out var application))
|
||||||
{
|
{
|
||||||
applicationInfo = BuildApplicationInfo(application);
|
if (settings.CaptureApplicationData)
|
||||||
windowTitle = string.IsNullOrEmpty(application.Window.Title) ? "-" : application.Window.Title;
|
{
|
||||||
}
|
applicationInfo = BuildApplicationInfo(application);
|
||||||
else
|
}
|
||||||
{
|
|
||||||
applicationInfo = "-";
|
if (settings.CaptureWindowTitle)
|
||||||
windowTitle = "-";
|
{
|
||||||
|
windowTitle = string.IsNullOrEmpty(application.Window.Title) ? "-" : application.Window.Title;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CaptureBrowserData()
|
private void CaptureBrowserData()
|
||||||
{
|
{
|
||||||
var windows = browser.GetWindows();
|
if (settings.CaptureBrowserData)
|
||||||
|
{
|
||||||
|
var windows = browser.GetWindows();
|
||||||
|
|
||||||
browserInfo = string.Join(", ", windows.Select(w => $"{(w.IsMainWindow ? "Main" : "Additional")} Window: {w.Title} ({w.Url})"));
|
browserInfo = string.Join(", ", windows.Select(w => $"{(w.IsMainWindow ? "Main" : "Additional")} Window: {w.Title} ({w.Url})"));
|
||||||
browserInfoWithoutUrls = string.Join(", ", windows.Select(w => $"{(w.IsMainWindow ? "Main" : "Additional")} Window: {w.Title}"));
|
browserInfoWithoutUrls = string.Join(", ", windows.Select(w => $"{(w.IsMainWindow ? "Main" : "Additional")} Window: {w.Title}"));
|
||||||
urls = string.Join(", ", windows.Select(w => w.Url));
|
urls = string.Join(", ", windows.Select(w => w.Url));
|
||||||
urlCount = windows.Count();
|
urlCount = windows.Count();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CaptureIntervalTrigger(IntervalTrigger interval)
|
private void CaptureIntervalTrigger(IntervalTrigger interval)
|
||||||
|
@ -137,5 +151,15 @@ namespace SafeExamBrowser.Proctoring.ScreenProctoring.Data
|
||||||
|
|
||||||
return info.ToString();
|
return info.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Initialize()
|
||||||
|
{
|
||||||
|
applicationInfo = "-";
|
||||||
|
browserInfo = "-";
|
||||||
|
browserInfoWithoutUrls = "-";
|
||||||
|
triggerInfo = "-";
|
||||||
|
urls = "-";
|
||||||
|
windowTitle = "-";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ namespace SafeExamBrowser.Proctoring.ScreenProctoring
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var metaData = new MetaDataAggregator(applicationMonitor, browser, elapsed, logger.CloneFor(nameof(MetaDataAggregator)));
|
var metaData = new MetaDataAggregator(applicationMonitor, browser, elapsed, logger.CloneFor(nameof(MetaDataAggregator)), settings.MetaData);
|
||||||
var screenShot = new ScreenShotProcessor(logger.CloneFor(nameof(ScreenShotProcessor)), settings);
|
var screenShot = new ScreenShotProcessor(logger.CloneFor(nameof(ScreenShotProcessor)), settings);
|
||||||
|
|
||||||
metaData.Capture(interval, keyboard, mouse);
|
metaData.Capture(interval, keyboard, mouse);
|
||||||
|
|
34
SafeExamBrowser.Settings/Proctoring/MetaDataSettings.cs
Normal file
34
SafeExamBrowser.Settings/Proctoring/MetaDataSettings.cs
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 ETH Zürich, Educational Development and Technology (LET)
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace SafeExamBrowser.Settings.Proctoring
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// All settings related to the metadata capturing of the screen proctoring.
|
||||||
|
/// </summary>
|
||||||
|
[Serializable]
|
||||||
|
public class MetaDataSettings
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether data of the active application shall be captured and transmitted.
|
||||||
|
/// </summary>
|
||||||
|
public bool CaptureApplicationData { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether data of the browser application shall be captured and transmitted.
|
||||||
|
/// </summary>
|
||||||
|
public bool CaptureBrowserData { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the title of the currently active window shall be captured and transmitted.
|
||||||
|
/// </summary>
|
||||||
|
public bool CaptureWindowTitle { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,21 +16,6 @@ namespace SafeExamBrowser.Settings.Proctoring
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class ScreenProctoringSettings
|
public class ScreenProctoringSettings
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Determines whether the name of the active application shall be captured and transmitted as part of the image meta data.
|
|
||||||
/// </summary>
|
|
||||||
public bool CaptureApplicationName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Determines whether the URL of the currently opened web page shall be captured and transmitted as part of the image meta data.
|
|
||||||
/// </summary>
|
|
||||||
public bool CaptureBrowserUrl { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Determines whether the title of the currently active window shall be captured and transmitted as part of the image meta data.
|
|
||||||
/// </summary>
|
|
||||||
public bool CaptureWindowTitle { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The client identifier used for authentication with the screen proctoring service.
|
/// The client identifier used for authentication with the screen proctoring service.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -71,6 +56,11 @@ namespace SafeExamBrowser.Settings.Proctoring
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int MaxInterval { get; set; }
|
public int MaxInterval { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// All settings related to the metadata capturing of the screen proctoring.
|
||||||
|
/// </summary>
|
||||||
|
public MetaDataSettings MetaData { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The minimum time interval in milliseconds between screen shot transmissions.
|
/// The minimum time interval in milliseconds between screen shot transmissions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -80,5 +70,10 @@ namespace SafeExamBrowser.Settings.Proctoring
|
||||||
/// The URL of the screen proctoring service.
|
/// The URL of the screen proctoring service.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ServiceUrl { get; set; }
|
public string ServiceUrl { get; set; }
|
||||||
|
|
||||||
|
public ScreenProctoringSettings()
|
||||||
|
{
|
||||||
|
MetaData = new MetaDataSettings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,7 @@
|
||||||
<Compile Include="Proctoring\ImageFormat.cs" />
|
<Compile Include="Proctoring\ImageFormat.cs" />
|
||||||
<Compile Include="Proctoring\ImageQuantization.cs" />
|
<Compile Include="Proctoring\ImageQuantization.cs" />
|
||||||
<Compile Include="Proctoring\JitsiMeetSettings.cs" />
|
<Compile Include="Proctoring\JitsiMeetSettings.cs" />
|
||||||
|
<Compile Include="Proctoring\MetaDataSettings.cs" />
|
||||||
<Compile Include="Proctoring\ProctoringSettings.cs" />
|
<Compile Include="Proctoring\ProctoringSettings.cs" />
|
||||||
<Compile Include="Proctoring\ScreenProctoringSettings.cs" />
|
<Compile Include="Proctoring\ScreenProctoringSettings.cs" />
|
||||||
<Compile Include="Proctoring\WindowVisibility.cs" />
|
<Compile Include="Proctoring\WindowVisibility.cs" />
|
||||||
|
|
Loading…
Reference in a new issue