Almost done first beta

This commit is contained in:
Vichingo455 2025-06-23 16:03:48 +02:00
parent 2d36fecb45
commit a6b60d72bd
12 changed files with 551 additions and 24 deletions

View File

@ -41,12 +41,12 @@ namespace SafeExamBrowser.Runtime.Operations
}
else
{
logger.Info("Application integrity successfully verified.");
logger.Warn("Application integrity is compromised!");
}
}
else
{
logger.Info("Application integrity successfully verified.");
logger.Warn("Failed to verify application integrity!");
}
return OperationResult.Success;

View File

@ -33,6 +33,7 @@
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// label1
@ -65,9 +66,9 @@
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.button1.Location = new System.Drawing.Point(435, 262);
this.button1.Location = new System.Drawing.Point(389, 262);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(124, 46);
this.button1.Size = new System.Drawing.Size(170, 46);
this.button1.TabIndex = 2;
this.button1.Text = "PATCH";
this.button1.UseVisualStyleBackColor = true;
@ -85,11 +86,26 @@
this.checkBox1.Text = "Backup";
this.checkBox1.UseVisualStyleBackColor = true;
//
// checkBox2
//
this.checkBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.checkBox2.AutoSize = true;
this.checkBox2.Checked = true;
this.checkBox2.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox2.Location = new System.Drawing.Point(128, 274);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(151, 25);
this.checkBox2.TabIndex = 4;
this.checkBox2.Text = "Install Certificate";
this.checkBox2.UseVisualStyleBackColor = true;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 21F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(571, 330);
this.Controls.Add(this.checkBox2);
this.Controls.Add(this.checkBox1);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1);
@ -114,6 +130,7 @@
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.CheckBox checkBox1;
}
private System.Windows.Forms.CheckBox checkBox2;
}
}

View File

@ -21,7 +21,6 @@ namespace patch_seb
public static bool started = false;
public static bool alreadyPatched = false;
public static string SEBPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"\SafeExamBrowser\Application\";
public static string SupportedSEB = "3.9.0.787";
public static int something = 0;
public Form1()
@ -35,8 +34,11 @@ namespace patch_seb
private void Form1_Load(object sender, EventArgs e)
{
AddLog("Safe Exam Browser Patch v" + Application.ProductVersion + " (Safe Exam Browser v" + SupportedSEB + ")");
//AddLog("For Safe Exam Browser version " + SupportedSEB);
#if DEBUG
AddLog("Safe Exam Browser Patch (Debug/Beta) v" + Application.ProductVersion + " (Safe Exam Browser v" + Variables.SupportedSEB + ")");
#else
AddLog("Safe Exam Browser Patch v" + Application.ProductVersion + " (Safe Exam Browser v" + Variables.SupportedSEB + ")");
#endif
AddLog("");
if (Environment.Is64BitOperatingSystem)
{
@ -61,12 +63,12 @@ namespace patch_seb
{
FileVersionInfo SEBVersion = FileVersionInfo.GetVersionInfo(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"\SafeExamBrowser\Application\SafeExamBrowser.exe");
FileVersionInfo SEBDLLVersion = FileVersionInfo.GetVersionInfo(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"\SafeExamBrowser\Application\SafeExamBrowser.Configuration.dll");
if (SEBVersion.FileVersion != SupportedSEB)
if (SEBVersion.FileVersion != Variables.SupportedSEB)
{
AddLog("[ERROR] Found unsupported Safe Exam Browser version.");
button1.Enabled = false;
}
else if (SEBVersion.ProductVersion == SupportedSEB || SEBDLLVersion.ProductVersion == "1.0.0.0") // Somehow the patched version string differs from the official version string.
else if (SEBVersion.ProductVersion == Variables.SupportedSEB || SEBDLLVersion.ProductVersion == "1.0.0.0") // Somehow the patched version string differs from the official version string.
{
checkBox1.Checked = false;
checkBox1.Enabled = false;
@ -170,6 +172,19 @@ namespace patch_seb
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.UserInterface.Desktop.dll", Resources.SafeExamBrowser_UserInterface_Desktop1);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.UserInterface.Mobile.dll", Resources.SafeExamBrowser_UserInterface_Mobile1);
}
if (checkBox2.Checked)
{
File.WriteAllText(Path.GetTempPath() + @"\SEB.reg", Resources.cert);
ProcessStartInfo info = new ProcessStartInfo
{
FileName = Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\regedit.exe",
Arguments = $@"/s \""{Path.GetTempPath() + @"\SEB.reg"}\""",
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden
};
Process.Start(info).WaitForExit();
File.Delete(Path.GetTempPath() + @"\SEB.reg");
}
AddLog("PATCHING DONE");
button1.Text = "PATCH DONE";
}
@ -184,7 +199,7 @@ namespace patch_seb
if (something == 4)
{
something = 0;
MessageBox.Show("Safe Exam Browser Patch v" + Application.ProductVersion + "\nFor Safe Exam Browser version " + SupportedSEB + "\nCreated with love by Vichingo455\n\nBecause Freedom is a right, respect it.", "Safe Exam Browser Patch", MessageBoxButtons.OK, MessageBoxIcon.Information);
MessageBox.Show("Safe Exam Browser Patch v" + Application.ProductVersion + "\nFor Safe Exam Browser version " + Variables.SupportedSEB + "\nCreated with love by Vichingo455\n\nBecause Freedom is a right, respect it.", "Safe Exam Browser Patch", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{

View File

@ -30,6 +30,24 @@
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OfflinePatcher));
this.label1 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.partitionComboBox = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.label3 = new System.Windows.Forms.Label();
this.selectedinstallation = new System.Windows.Forms.Label();
this.autodetect = new System.Windows.Forms.RadioButton();
this.x64 = new System.Windows.Forms.RadioButton();
this.x86 = new System.Windows.Forms.RadioButton();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.button2 = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// label1
@ -38,17 +56,180 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(336, 9);
this.label1.Location = new System.Drawing.Point(215, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(343, 28);
this.label1.Size = new System.Drawing.Size(324, 28);
this.label1.TabIndex = 0;
this.label1.Text = "Safe Exam Browser Offline Patcher";
this.label1.Text = "Safe Exam Browser Offline Patch";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.partitionComboBox);
this.groupBox1.Location = new System.Drawing.Point(12, 54);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(716, 100);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Safe Exam Browser installations";
//
// partitionComboBox
//
this.partitionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.partitionComboBox.FormattingEnabled = true;
this.partitionComboBox.Location = new System.Drawing.Point(178, 44);
this.partitionComboBox.Name = "partitionComboBox";
this.partitionComboBox.Size = new System.Drawing.Size(381, 29);
this.partitionComboBox.TabIndex = 0;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 47);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(149, 21);
this.label2.TabIndex = 1;
this.label2.Text = "Installation to patch:";
//
// button1
//
this.button1.Location = new System.Drawing.Point(583, 44);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(116, 29);
this.button1.TabIndex = 2;
this.button1.Text = "USE";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.checkBox2);
this.groupBox2.Controls.Add(this.checkBox1);
this.groupBox2.Controls.Add(this.x86);
this.groupBox2.Controls.Add(this.x64);
this.groupBox2.Controls.Add(this.autodetect);
this.groupBox2.Controls.Add(this.selectedinstallation);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Enabled = false;
this.groupBox2.Location = new System.Drawing.Point(12, 176);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(716, 222);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Patch settings";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(21, 73);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(233, 21);
this.label3.TabIndex = 0;
this.label3.Text = "Safe Exam Browser Architecture:";
//
// selectedinstallation
//
this.selectedinstallation.AutoSize = true;
this.selectedinstallation.Location = new System.Drawing.Point(21, 38);
this.selectedinstallation.Name = "selectedinstallation";
this.selectedinstallation.Size = new System.Drawing.Size(190, 21);
this.selectedinstallation.TabIndex = 1;
this.selectedinstallation.Text = "Selected Installation: none";
//
// autodetect
//
this.autodetect.AutoSize = true;
this.autodetect.Checked = true;
this.autodetect.Location = new System.Drawing.Point(260, 73);
this.autodetect.Name = "autodetect";
this.autodetect.Size = new System.Drawing.Size(233, 25);
this.autodetect.TabIndex = 2;
this.autodetect.TabStop = true;
this.autodetect.Text = "Auto-Detect (recommended)";
this.autodetect.UseVisualStyleBackColor = true;
//
// x64
//
this.x64.AutoSize = true;
this.x64.Location = new System.Drawing.Point(525, 73);
this.x64.Name = "x64";
this.x64.Size = new System.Drawing.Size(60, 25);
this.x64.TabIndex = 3;
this.x64.Text = "x64";
this.x64.UseVisualStyleBackColor = true;
//
// x86
//
this.x86.AutoSize = true;
this.x86.Location = new System.Drawing.Point(605, 73);
this.x86.Name = "x86";
this.x86.Size = new System.Drawing.Size(60, 25);
this.x86.TabIndex = 4;
this.x86.Text = "x86";
this.x86.UseVisualStyleBackColor = true;
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(25, 110);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(86, 25);
this.checkBox1.TabIndex = 5;
this.checkBox1.Text = "Backup";
this.checkBox1.UseVisualStyleBackColor = true;
//
// checkBox2
//
this.checkBox2.AutoSize = true;
this.checkBox2.Checked = true;
this.checkBox2.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox2.Location = new System.Drawing.Point(25, 152);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(467, 25);
this.checkBox2.TabIndex = 6;
this.checkBox2.Text = "Install custom certificate on the offline system (recommended)";
this.checkBox2.UseVisualStyleBackColor = true;
//
// button2
//
this.button2.Enabled = false;
this.button2.Location = new System.Drawing.Point(220, 679);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(270, 62);
this.button2.TabIndex = 3;
this.button2.Text = "PATCH";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.textBox1);
this.groupBox3.Location = new System.Drawing.Point(12, 414);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(716, 245);
this.groupBox3.TabIndex = 4;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Patch logs";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(3, 25);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(707, 204);
this.textBox1.TabIndex = 0;
//
// OfflinePatcher
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 21F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1069, 637);
this.ClientSize = new System.Drawing.Size(742, 753);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.button2);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.label1);
this.Font = new System.Drawing.Font("Segoe UI", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
@ -57,6 +238,13 @@
this.Name = "OfflinePatcher";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Safe Exam Browser Offline Patcher";
this.Load += new System.EventHandler(this.OfflinePatcher_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@ -65,5 +253,20 @@
#endregion
private System.Windows.Forms.Label label1;
}
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox partitionComboBox;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.RadioButton x86;
private System.Windows.Forms.RadioButton x64;
private System.Windows.Forms.RadioButton autodetect;
private System.Windows.Forms.Label selectedinstallation;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.CheckBox checkBox2;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.TextBox textBox1;
}
}

View File

@ -1,10 +1,14 @@
using System;
using patch_seb.Properties;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
@ -12,9 +16,232 @@ namespace patch_seb
{
public partial class OfflinePatcher : Form
{
public static string installation = "";
public static bool isBackup;
public static bool started = false;
public static bool alreadyPatched = false;
public static bool is64bits = false;
public static string SEBPath = "";
public OfflinePatcher()
{
InitializeComponent();
}
public void AddLog(string log)
{
this.textBox1.Text += log + Environment.NewLine;
}
private void button1_Click(object sender, EventArgs e)
{
installation = partitionComboBox.SelectedItem.ToString();
selectedinstallation.Text = $"Selected Installation: {installation}";
AddLog($"[INFO] Selected {installation}");
groupBox2.Enabled = true;
button2.Enabled = true;
if (File.Exists(installation + @"Windows\SysWOW64\cmd.exe"))
{
AddLog($"[INFO] Detected x64 installation on {installation}.");
is64bits = true;
}
else
{
AddLog($"[INFO] Detected x86 installation on {installation}.");
}
FileVersionInfo SEBVersion = FileVersionInfo.GetVersionInfo(installation + @"Program Files\SafeExamBrowser\Application\SafeExamBrowser.exe");
FileVersionInfo SEBDLLVersion = FileVersionInfo.GetVersionInfo(installation + @"Program Files\SafeExamBrowser\Application\SafeExamBrowser.Configuration.dll");
if (SEBVersion.ProductVersion == Variables.SupportedSEB || SEBDLLVersion.ProductVersion == "1.0.0.0") // Somehow the patched version string differs from the official version string.
{
alreadyPatched = true;
isBackup = false;
checkBox1.Enabled = false;
button2.Text = "PATCH AGAIN/UPDATE";
AddLog($"READY TO UPDATE/PATCH AGAIN {installation}.");
}
else
{
AddLog($"READY TO PATCH {installation}.");
}
started = false;
}
private void OfflinePatcher_Load(object sender, EventArgs e)
{
#if DEBUG
AddLog("Safe Exam Browser Offline Patch (Debug/Beta) v" + Application.ProductVersion + " (Safe Exam Browser v" + Variables.SupportedSEB + ")");
#else
AddLog("Safe Exam Browser Offline Patch v" + Application.ProductVersion + " (Safe Exam Browser v" + Variables.SupportedSEB + ")");
#endif
AddLog("");
partitionComboBox.Items.Clear();
AddLog("[INFO] Searching for suitable partitions...");
DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo drive in allDrives)
{
if (drive.IsReady && drive.Name != @"X:\" && File.Exists(drive.Name + @"Program Files\SafeExamBrowser\Application\SafeExamBrowser.exe"))
{
FileVersionInfo SEBVersion = FileVersionInfo.GetVersionInfo(drive.Name + @"Program Files\SafeExamBrowser\Application\SafeExamBrowser.exe");
FileVersionInfo SEBDLLVersion = FileVersionInfo.GetVersionInfo(drive.Name + @"Program Files\SafeExamBrowser\Application\SafeExamBrowser.Configuration.dll");
if (SEBVersion.FileVersion != Variables.SupportedSEB)
{
AddLog($"[WARNING] Partition {drive.Name} contains unsupported Safe Exam Browser version, not adding to the list.");
}
else if (SEBVersion.ProductVersion == Variables.SupportedSEB || SEBDLLVersion.ProductVersion == "1.0.0.0") // Somehow the patched version string differs from the official version string.
{
AddLog($"[WARNING] Partition {drive.Name} contains an already patched Safe Exam Browser, adding to the list anyway.");
string label = $"{drive.Name}";
partitionComboBox.Items.Add(label);
}
else
{
AddLog($"[INFO] Partition {drive.Name} contains a supported Safe Exam Browser version, adding to the list.");
string label = $"{drive.Name}";
partitionComboBox.Items.Add(label);
}
}
else
{
AddLog($"[WARNING] Partition {drive.Name} doesn't contain an installed Safe Exam Browser version or is not formatted correctly, not adding to the list.");
}
}
if (partitionComboBox.Items.Count > 0)
{
AddLog($"[INFO] Found {partitionComboBox.Items.Count} partitions suitable for the patch.");
partitionComboBox.SelectedIndex = 0;
}
else
{
AddLog("[ERROR] Found 0 partitions suitable for the patch.");
button1.Enabled = false;
}
}
private void button2_Click(object sender, EventArgs e)
{
SEBPath = installation + @"Program Files\SafeExamBrowser\Application";
if (alreadyPatched)
{
var dialog = MessageBox.Show("An already patched Safe Exam Browser has been found. Are you sure to continue?", "Safe Exam Browser Offline Patch", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
if (dialog == DialogResult.No)
{
return;
}
}
isBackup = checkBox1.Checked;
if (!started)
{
started = true;
Thread thr = new Thread(PatchThread);
thr.Start();
}
}
private void PatchThread()
{
if (isBackup)
{
try
{
if (File.Exists(SEBPath + @"SafeExamBrowser.exe.backup"))
{
File.Delete(SEBPath + @"SafeExamBrowser.exe.backup");
}
File.Copy(SEBPath + @"SafeExamBrowser.exe", SEBPath + @"SafeExamBrowser.exe.backup");
if (File.Exists(SEBPath + @"SafeExamBrowser.Client.exe.backup"))
{
File.Delete(SEBPath + @"SafeExamBrowser.Client.exe.backup");
}
File.Copy(SEBPath + @"SafeExamBrowser.Client.exe", SEBPath + @"SafeExamBrowser.Client.exe.backup");
if (File.Exists(SEBPath + @"SafeExamBrowser.Configuration.dll.backup"))
{
File.Delete(SEBPath + @"SafeExamBrowser.Configuration.dll.backup");
}
File.Copy(SEBPath + @"SafeExamBrowser.Configuration.dll", SEBPath + @"SafeExamBrowser.Configuration.dll.backup");
if (File.Exists(SEBPath + @"SafeExamBrowser.Monitoring.dll.backup"))
{
File.Delete(SEBPath + @"SafeExamBrowser.Monitoring.dll.backup");
}
File.Copy(SEBPath + @"SafeExamBrowser.Monitoring.dll", SEBPath + @"SafeExamBrowser.Monitoring.dll.backup");
if (File.Exists(SEBPath + @"SafeExamBrowser.UserInterface.Desktop.dll.backup"))
{
File.Delete(SEBPath + @"SafeExamBrowser.UserInterface.Desktop.dll.backup");
}
File.Copy(SEBPath + @"SafeExamBrowser.UserInterface.Desktop.dll", SEBPath + @"SafeExamBrowser.UserInterface.Desktop.dll.backup");
if (File.Exists(SEBPath + @"SafeExamBrowser.UserInterface.Mobile.dll.backup"))
{
File.Delete(SEBPath + @"SafeExamBrowser.UserInterface.Mobile.dll.backup");
}
File.Copy(SEBPath + @"SafeExamBrowser.UserInterface.Mobile.dll", SEBPath + @"SafeExamBrowser.UserInterface.Mobile.dll.backup");
}
catch (Exception ex)
{
AddLog("[ERROR] " + ex.Message);
}
}
try
{
File.Delete(SEBPath + @"SafeExamBrowser.exe");
File.Delete(SEBPath + @"SafeExamBrowser.Client.exe");
File.Delete(SEBPath + @"SafeExamBrowser.Configuration.dll");
File.Delete(SEBPath + @"SafeExamBrowser.Monitoring.dll");
File.Delete(SEBPath + @"SafeExamBrowser.UserInterface.Desktop.dll");
File.Delete(SEBPath + @"SafeExamBrowser.UserInterface.Mobile.dll");
if (is64bits) // 64 bits patch
{
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.exe", Resources.SafeExamBrowser);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.Client.exe", Resources.SafeExamBrowser_Client);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.Configuration.dll", Resources.SafeExamBrowser_Configuration);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.Monitoring.dll", Resources.SafeExamBrowser_Monitoring);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.UserInterface.Desktop.dll", Resources.SafeExamBrowser_UserInterface_Desktop);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.UserInterface.Mobile.dll", Resources.SafeExamBrowser_UserInterface_Mobile);
}
else // 32 bits patch
{
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.exe", Resources.SafeExamBrowser1);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.Client.exe", Resources.SafeExamBrowser_Client1);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.Configuration.dll", Resources.SafeExamBrowser_Configuration1);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.Monitoring.dll", Resources.SafeExamBrowser_Monitoring1);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.UserInterface.Desktop.dll", Resources.SafeExamBrowser_UserInterface_Desktop1);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.UserInterface.Mobile.dll", Resources.SafeExamBrowser_UserInterface_Mobile1);
}
if (checkBox2.Checked)
{
// Load offline registry
ProcessStartInfo load = new ProcessStartInfo
{
FileName = Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"System32\reg.exe",
Arguments = $@"load HKLM\OFFSOFTWARE {installation}Windows\System32\config\software",
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden
};
Process.Start(load).WaitForExit();
// Add certificate to offline registry
File.WriteAllText(Path.GetTempPath() + @"\SEB.reg", Resources.cert_offline);
ProcessStartInfo info = new ProcessStartInfo
{
FileName = Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\regedit.exe",
Arguments = $@"/s \""{Path.GetTempPath() + @"\SEB.reg"}\""",
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden
};
Process.Start(info).WaitForExit();
File.Delete(Path.GetTempPath() + @"\SEB.reg");
// Unload offline registry
ProcessStartInfo unload = new ProcessStartInfo
{
FileName = Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"System32\reg.exe",
Arguments = $@"unload HKLM\OFFSOFTWARE",
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden
};
Process.Start(unload).WaitForExit();
}
AddLog($"PATCHING DONE ON {installation}.");
button2.Text = "PATCH DONE";
}
catch (Exception ex)
{
AddLog("[ERROR] " + ex.Message);
}
}
}
}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
@ -16,21 +17,31 @@ namespace patch_seb
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (args.Length == 1)
// Checks
if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\System32\wpeinit.exe"))
{
if (args[1] == "/offline" || args[1] == "/Offline")
// Running in Windows PE environment, launch the offline patcher
Application.Run(new OfflinePatcher());
}
else
{
// Check if the user wants the offline patcher
if (args.Length == 1)
{
Application.Run(new OfflinePatcher());
if (args[1] == "/offline" || args[1] == "/Offline")
{
Application.Run(new OfflinePatcher());
}
else
{
Application.Run(new Form1());
}
}
else
{
Application.Run(new Form1());
}
}
else
{
Application.Run(new Form1());
}
}
}
}

View File

@ -60,6 +60,38 @@ namespace patch_seb.Properties {
}
}
/// <summary>
/// Cerca una stringa localizzata simile a Windows Registry Editor Version 5.00
///
///[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SystemCertificates\ROOT\Certificates\05737772423FD69437E6CB3414588365A01BC1CF]
///&quot;Blob&quot;=hex:5c,00,00,00,01,00,00,00,04,00,00,00,00,08,00,00,19,00,00,00,01,00,\
/// 00,00,10,00,00,00,89,b3,20,3f,64,c9,40,55,fa,01,d8,bc,c2,46,23,f5,0f,00,00,\
/// 00,01,00,00,00,14,00,00,00,9b,59,e4,8f,91,2b,32,28,53,7d,fa,59,57,11,4d,24,\
/// 9e,c3,79,4f,03,00,00,00,01,00,00,00,14,00,00,00,05,73,77,72,42,3f,d6,94,37,\
/// e6,cb,34,14,58,83,65,a0,1b,c1,c [stringa troncata]&quot;;.
/// </summary>
internal static string cert {
get {
return ResourceManager.GetString("cert", resourceCulture);
}
}
/// <summary>
/// Cerca una stringa localizzata simile a Windows Registry Editor Version 5.00
///
///[HKEY_LOCAL_MACHINE\OFFSOFTWARE\Microsoft\SystemCertificates\ROOT\Certificates\05737772423FD69437E6CB3414588365A01BC1CF]
///&quot;Blob&quot;=hex:5c,00,00,00,01,00,00,00,04,00,00,00,00,08,00,00,19,00,00,00,01,00,\
/// 00,00,10,00,00,00,89,b3,20,3f,64,c9,40,55,fa,01,d8,bc,c2,46,23,f5,0f,00,00,\
/// 00,01,00,00,00,14,00,00,00,9b,59,e4,8f,91,2b,32,28,53,7d,fa,59,57,11,4d,24,\
/// 9e,c3,79,4f,03,00,00,00,01,00,00,00,14,00,00,00,05,73,77,72,42,3f,d6,94,37,\
/// e6,cb,34,14,58,83,65,a0,1b,c [stringa troncata]&quot;;.
/// </summary>
internal static string cert_offline {
get {
return ResourceManager.GetString("cert_offline", resourceCulture);
}
}
/// <summary>
/// Cerca una risorsa localizzata di tipo System.Byte[].
/// </summary>

View File

@ -118,6 +118,12 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="cert" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\cert.reg;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
</data>
<data name="cert_offline" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\cert_offline.reg;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
</data>
<data name="SafeExamBrowser" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\x64\SafeExamBrowser.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>

Binary file not shown.

Binary file not shown.

13
patch-seb/Variables.cs Normal file
View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace patch_seb
{
internal class Variables
{
public static string SupportedSEB = "3.9.0.787";
}
}

View File

@ -68,6 +68,7 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Variables.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
@ -99,6 +100,8 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\cert.reg" />
<None Include="Resources\cert_offline.reg" />
<None Include="Resources\x64\SafeExamBrowser.Client.exe" />
<None Include="Resources\x64\SafeExamBrowser.Configuration.dll" />
<None Include="Resources\x64\SafeExamBrowser.exe" />