diff --git a/AsyncRAT-C#/AsyncRAT-Sharp.sln b/AsyncRAT-C#/AsyncRAT-Sharp.sln
new file mode 100644
index 0000000..62d96fd
--- /dev/null
+++ b/AsyncRAT-C#/AsyncRAT-Sharp.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.28307.168
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsyncRAT-Sharp", "AsyncRAT-Sharp\AsyncRAT-Sharp.csproj", "{7767C300-5FD5-4A5D-9D4C-59559CCE48A3}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "Client\Client.csproj", "{C3C49F45-2589-4E04-9C50-71B6035C14AE}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {7767C300-5FD5-4A5D-9D4C-59559CCE48A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7767C300-5FD5-4A5D-9D4C-59559CCE48A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7767C300-5FD5-4A5D-9D4C-59559CCE48A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7767C300-5FD5-4A5D-9D4C-59559CCE48A3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C3C49F45-2589-4E04-9C50-71B6035C14AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C3C49F45-2589-4E04-9C50-71B6035C14AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C3C49F45-2589-4E04-9C50-71B6035C14AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C3C49F45-2589-4E04-9C50-71B6035C14AE}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {B9F2462F-603A-41C4-9CFC-1FAC60B4731C}
+ EndGlobalSection
+EndGlobal
diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/App.config b/AsyncRAT-C#/AsyncRAT-Sharp/App.config
new file mode 100644
index 0000000..8e15646
--- /dev/null
+++ b/AsyncRAT-C#/AsyncRAT-Sharp/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/AsyncRAT-Sharp.csproj b/AsyncRAT-C#/AsyncRAT-Sharp/AsyncRAT-Sharp.csproj
new file mode 100644
index 0000000..3b8dbef
--- /dev/null
+++ b/AsyncRAT-C#/AsyncRAT-Sharp/AsyncRAT-Sharp.csproj
@@ -0,0 +1,91 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {7767C300-5FD5-4A5D-9D4C-59559CCE48A3}
+ WinExe
+ AsyncRAT_Sharp
+ AsyncRAT-Sharp
+ v4.5
+ 512
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ Form1.cs
+
+
+
+
+
+
+
+
+
+
+
+
+ Form1.cs
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Form1.Designer.cs b/AsyncRAT-C#/AsyncRAT-Sharp/Form1.Designer.cs
new file mode 100644
index 0000000..7fe46b8
--- /dev/null
+++ b/AsyncRAT-C#/AsyncRAT-Sharp/Form1.Designer.cs
@@ -0,0 +1,110 @@
+namespace AsyncRAT_Sharp
+{
+ partial class Form1
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.listView1 = new System.Windows.Forms.ListView();
+ this.lv_ip = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.lv_user = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ 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.contextMenuStrip1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // listView1
+ //
+ this.listView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.lv_ip,
+ this.lv_user,
+ this.lv_os});
+ this.listView1.ContextMenuStrip = this.contextMenuStrip1;
+ this.listView1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.listView1.FullRowSelect = true;
+ this.listView1.GridLines = true;
+ this.listView1.Location = new System.Drawing.Point(0, 0);
+ this.listView1.Name = "listView1";
+ this.listView1.Size = new System.Drawing.Size(849, 372);
+ this.listView1.TabIndex = 0;
+ this.listView1.UseCompatibleStateImageBehavior = false;
+ this.listView1.View = System.Windows.Forms.View.Details;
+ //
+ // lv_ip
+ //
+ this.lv_ip.Text = "IP";
+ //
+ // lv_user
+ //
+ this.lv_user.Text = "USER";
+ //
+ // lv_os
+ //
+ this.lv_os.Text = "OS";
+ //
+ // contextMenuStrip1
+ //
+ this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24);
+ this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.sendMessageToolStripMenuItem});
+ this.contextMenuStrip1.Name = "contextMenuStrip1";
+ this.contextMenuStrip1.Size = new System.Drawing.Size(200, 34);
+ //
+ // sendMessageToolStripMenuItem
+ //
+ this.sendMessageToolStripMenuItem.Name = "sendMessageToolStripMenuItem";
+ this.sendMessageToolStripMenuItem.Size = new System.Drawing.Size(199, 30);
+ this.sendMessageToolStripMenuItem.Text = "Send Message";
+ this.sendMessageToolStripMenuItem.Click += new System.EventHandler(this.sendMessageToolStripMenuItem_Click);
+ //
+ // Form1
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(849, 372);
+ this.Controls.Add(this.listView1);
+ this.Name = "Form1";
+ this.Text = "AsyncRAT-Sharp // NYAN CAT";
+ this.Load += new System.EventHandler(this.Form1_Load);
+ this.contextMenuStrip1.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ public System.Windows.Forms.ListView listView1;
+ private System.Windows.Forms.ColumnHeader lv_ip;
+ private System.Windows.Forms.ColumnHeader lv_user;
+ private System.Windows.Forms.ColumnHeader lv_os;
+ private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
+ private System.Windows.Forms.ToolStripMenuItem sendMessageToolStripMenuItem;
+ }
+}
+
diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Form1.cs b/AsyncRAT-C#/AsyncRAT-Sharp/Form1.cs
new file mode 100644
index 0000000..b77faa2
--- /dev/null
+++ b/AsyncRAT-C#/AsyncRAT-Sharp/Form1.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Windows.Forms;
+using AsyncRAT_Sharp.MessagePack;
+using AsyncRAT_Sharp.Sockets;
+using Microsoft.VisualBasic;
+namespace AsyncRAT_Sharp
+{
+ public partial class Form1 : Form
+ {
+ public Form1()
+ {
+ InitializeComponent();
+ }
+
+ private void Form1_Load(object sender, EventArgs e)
+ {
+ Handle_Packet.HandlePacket.Form = this;
+
+ Listener listener = new Listener();
+ listener.Connect(8080);
+ }
+
+ private void sendMessageToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ string URL = Interaction.InputBox("Message", "Message", "Hello World!");
+ if (string.IsNullOrEmpty(URL))
+ return;
+ else
+ {
+ MsgPack msgpack = new MsgPack();
+ msgpack.ForcePathObject("Packet").AsString = "MessageBox";
+ msgpack.ForcePathObject("Message").AsString = URL;
+ foreach (ListViewItem C in listView1.SelectedItems)
+ {
+ Clients CL = (Clients)C.Tag;
+ CL.BeginSend(msgpack.Encode2Bytes());
+ }
+ }
+ }
+ }
+}
diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Form1.resx b/AsyncRAT-C#/AsyncRAT-Sharp/Form1.resx
new file mode 100644
index 0000000..ad53752
--- /dev/null
+++ b/AsyncRAT-C#/AsyncRAT-Sharp/Form1.resx
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
\ No newline at end of file
diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Handle Packet/HandlePacket.cs b/AsyncRAT-C#/AsyncRAT-Sharp/Handle Packet/HandlePacket.cs
new file mode 100644
index 0000000..0df8860
--- /dev/null
+++ b/AsyncRAT-C#/AsyncRAT-Sharp/Handle Packet/HandlePacket.cs
@@ -0,0 +1,34 @@
+using AsyncRAT_Sharp.Sockets;
+using System.Windows.Forms;
+using AsyncRAT_Sharp.MessagePack;
+
+namespace AsyncRAT_Sharp.Handle_Packet
+{
+ class HandlePacket
+ {
+ public static Form1 Form;
+ public delegate void UpdateListViewDelegatevoid(Clients Client, byte[] Data);
+ public static void Read(Clients Client, byte[] Data)
+ {
+ MsgPack unpack_msgpack = new MsgPack();
+ unpack_msgpack.DecodeFromBytes(Data);
+ switch (unpack_msgpack.ForcePathObject("Packet").AsString)
+ {
+ case "ClientInfo":
+ if (Form.listView1.InvokeRequired)
+ Form.listView1.Invoke(new UpdateListViewDelegatevoid(Read), new object[] {Client, Data});
+ else
+ {
+ Client.LV = new ListViewItem();
+ Client.LV.Tag = Client;
+ Client.LV.Text = string.Concat(Client.client.RemoteEndPoint.ToString());
+ Client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("User").AsString);
+ Client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("OS").AsString);
+ Form.listView1.Items.Insert(0, Client.LV);
+ Form.listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
+ }
+ break;
+ }
+ }
+ }
+}
diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/MessagePack/BytesTools.cs b/AsyncRAT-C#/AsyncRAT-Sharp/MessagePack/BytesTools.cs
new file mode 100644
index 0000000..8ca0275
--- /dev/null
+++ b/AsyncRAT-C#/AsyncRAT-Sharp/MessagePack/BytesTools.cs
@@ -0,0 +1,102 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AsyncRAT_Sharp.MessagePack
+{
+ public class BytesTools
+ {
+ static UTF8Encoding utf8Encode = new UTF8Encoding();
+
+ public static byte[] GetUtf8Bytes(String s)
+ {
+
+ return utf8Encode.GetBytes(s);
+ }
+
+ public static String GetString(byte[] utf8Bytes)
+ {
+ return utf8Encode.GetString(utf8Bytes);
+ }
+
+ public static String BytesAsString(byte[] bytes)
+ {
+ StringBuilder sb = new StringBuilder();
+ foreach (byte b in bytes)
+ {
+ sb.Append(String.Format("{0:D3} ", b));
+ }
+ return sb.ToString();
+ }
+
+
+ public static String BytesAsHexString(byte[] bytes)
+ {
+ StringBuilder sb = new StringBuilder();
+ foreach (byte b in bytes)
+ {
+ sb.Append(String.Format("{0:X2} ", b));
+ }
+ return sb.ToString();
+ }
+
+ ///
+ /// 交换byte数组数据
+ /// 可用于高低数据交换
+ ///
+ /// 要交换的byte数组
+ /// 返回交换后的数据
+ public static byte[] SwapBytes(byte[] v)
+ {
+ byte[] r = new byte[v.Length];
+ int j = v.Length - 1;
+ for (int i = 0; i < r.Length; i++)
+ {
+ r[i] = v[j];
+ j--;
+ }
+ return r;
+ }
+
+ public static byte[] SwapInt64(Int64 v)
+ {
+ //byte[] r = new byte[8];
+ //r[7] = (byte)v;
+ //r[6] = (byte)(v >> 8);
+ //r[5] = (byte)(v >> 16);
+ //r[4] = (byte)(v >> 24);
+ //r[3] = (byte)(v >> 32);
+ //r[2] = (byte)(v >> 40);
+ //r[1] = (byte)(v >> 48);
+ //r[0] = (byte)(v >> 56);
+ return SwapBytes(BitConverter.GetBytes(v));
+ }
+
+ public static byte[] SwapInt32(Int32 v)
+ {
+ byte[] r = new byte[4];
+ r[3] = (byte)v;
+ r[2] = (byte)(v >> 8);
+ r[1] = (byte)(v >> 16);
+ r[0] = (byte)(v >> 24);
+ return r;
+ }
+
+
+ public static byte[] SwapInt16(Int16 v)
+ {
+ byte[] r = new byte[2];
+ r[1] = (byte)v;
+ r[0] = (byte)(v >> 8);
+ return r;
+ }
+
+ public static byte[] SwapDouble(Double v)
+ {
+ return SwapBytes(BitConverter.GetBytes(v));
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/MessagePack/MsgPack.cs b/AsyncRAT-C#/AsyncRAT-Sharp/MessagePack/MsgPack.cs
new file mode 100644
index 0000000..bb8d6d2
--- /dev/null
+++ b/AsyncRAT-C#/AsyncRAT-Sharp/MessagePack/MsgPack.cs
@@ -0,0 +1,932 @@
+/*
+ * 添加DecodeFormFile函数
+ * 2015-07-14 16:31:32
+ *
+ * 修复ForcePathObject查找不到子对象的bug,感谢(Putree 274638001)反馈
+ * 2015-07-14 16:32:13
+ *
+ * 修复整数值为127时解码出来为0的情况,感谢(Putree 274638001)反馈
+ * 2015-07-14 15:28:45
+ *
+ * Credit -> github.com/ymofen/SimpleMsgPack.Net
+ */
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+
+namespace AsyncRAT_Sharp.MessagePack
+{
+ public class MsgPackEnum : IEnumerator
+ {
+ List children;
+ int position = -1;
+
+ public MsgPackEnum(List obj)
+ {
+ children = obj;
+ }
+ object IEnumerator.Current
+ {
+ get { return children[position]; }
+ }
+
+ bool IEnumerator.MoveNext()
+ {
+ position++;
+ return (position < children.Count);
+ }
+
+ void IEnumerator.Reset()
+ {
+ position = -1;
+ }
+
+ }
+
+ public class MsgPackArray
+ {
+ List children;
+ MsgPack owner;
+
+ public MsgPackArray(MsgPack msgpackObj, List listObj)
+ {
+ owner = msgpackObj;
+ children = listObj;
+ }
+
+ public MsgPack Add()
+ {
+ return owner.AddArrayChild();
+ }
+
+ public MsgPack Add(String value)
+ {
+ MsgPack obj = owner.AddArrayChild();
+ obj.AsString = value;
+ return obj;
+ }
+
+ public MsgPack Add(Int64 value)
+ {
+ MsgPack obj = owner.AddArrayChild();
+ obj.SetAsInteger(value);
+ return obj;
+ }
+
+ public MsgPack Add(Double value)
+ {
+ MsgPack obj = owner.AddArrayChild();
+ obj.SetAsFloat(value);
+ return obj;
+ }
+
+ public MsgPack this[int index]
+ {
+ get { return children[index]; }
+ }
+
+ public int Length
+ {
+ get { return children.Count; }
+ }
+ }
+
+ public class MsgPack : IEnumerable
+ {
+ string name;
+ string lowerName;
+ object innerValue;
+ MsgPackType valueType;
+ MsgPack parent;
+ List children = new List();
+ MsgPackArray refAsArray = null;
+
+ private void SetName(string value)
+ {
+ this.name = value;
+ this.lowerName = name.ToLower();
+ }
+
+ private void Clear()
+ {
+ for (int i = 0; i < children.Count; i++)
+ {
+ ((MsgPack)children[i]).Clear();
+ }
+ children.Clear();
+ }
+
+ private MsgPack InnerAdd()
+ {
+ MsgPack r = new MsgPack();
+ r.parent = this;
+ this.children.Add(r);
+ return r;
+ }
+
+ private int IndexOf(string name)
+ {
+ int i = -1;
+ int r = -1;
+
+ string tmp = name.ToLower();
+ foreach (MsgPack item in children)
+ {
+ i++;
+ if (tmp.Equals(item.lowerName))
+ {
+ r = i;
+ break;
+ }
+ }
+ return r;
+ }
+
+ public MsgPack FindObject(string name)
+ {
+ int i = IndexOf(name);
+ if (i == -1)
+ {
+ return null;
+ }
+ else
+ {
+ return this.children[i];
+ }
+ }
+
+
+ private MsgPack InnerAddMapChild()
+ {
+ if (valueType != MsgPackType.Map)
+ {
+ Clear();
+ this.valueType = MsgPackType.Map;
+ }
+ return InnerAdd();
+ }
+
+ private MsgPack InnerAddArrayChild()
+ {
+ if (valueType != MsgPackType.Array)
+ {
+ Clear();
+ this.valueType = MsgPackType.Array;
+ }
+ return InnerAdd();
+ }
+
+ public MsgPack AddArrayChild()
+ {
+ return InnerAddArrayChild();
+ }
+
+ private void WriteMap(Stream ms)
+ {
+ byte b;
+ byte[] lenBytes;
+ int len = children.Count;
+ if (len <= 15)
+ {
+ b = (byte)(0x80 + (byte)len);
+ ms.WriteByte(b);
+ }
+ else if (len <= 65535)
+ {
+ b = 0xDE;
+ ms.WriteByte(b);
+
+ lenBytes = BytesTools.SwapBytes(BitConverter.GetBytes((Int16)len));
+ ms.Write(lenBytes, 0, lenBytes.Length);
+ }
+ else
+ {
+ b = 0xDF;
+ ms.WriteByte(b);
+ lenBytes = BytesTools.SwapBytes(BitConverter.GetBytes((Int32)len));
+ ms.Write(lenBytes, 0, lenBytes.Length);
+ }
+
+ for (int i = 0; i < len; i++)
+ {
+ WriteTools.WriteString(ms, children[i].name);
+ children[i].Encode2Stream(ms);
+ }
+ }
+
+ private void WirteArray(Stream ms)
+ {
+ byte b;
+ byte[] lenBytes;
+ int len = children.Count;
+ if (len <= 15)
+ {
+ b = (byte)(0x90 + (byte)len);
+ ms.WriteByte(b);
+ }
+ else if (len <= 65535)
+ {
+ b = 0xDC;
+ ms.WriteByte(b);
+
+ lenBytes = BytesTools.SwapBytes(BitConverter.GetBytes((Int16)len));
+ ms.Write(lenBytes, 0, lenBytes.Length);
+ }
+ else
+ {
+ b = 0xDD;
+ ms.WriteByte(b);
+ lenBytes = BytesTools.SwapBytes(BitConverter.GetBytes((Int32)len));
+ ms.Write(lenBytes, 0, lenBytes.Length);
+ }
+
+
+ for (int i = 0; i < len; i++)
+ {
+ ((MsgPack)children[i]).Encode2Stream(ms);
+ }
+ }
+
+ public void SetAsInteger(Int64 value)
+ {
+ this.innerValue = value;
+ this.valueType = MsgPackType.Integer;
+ }
+
+ public void SetAsUInt64(UInt64 value)
+ {
+ this.innerValue = value;
+ this.valueType = MsgPackType.UInt64;
+ }
+
+ public UInt64 GetAsUInt64()
+ {
+ switch (this.valueType)
+ {
+ case MsgPackType.Integer:
+ return Convert.ToUInt64((Int64)this.innerValue);
+ case MsgPackType.UInt64:
+ return (UInt64)this.innerValue;
+ case MsgPackType.String:
+ return UInt64.Parse(this.innerValue.ToString().Trim());
+ case MsgPackType.Float:
+ return Convert.ToUInt64((Double)this.innerValue);
+ case MsgPackType.Single:
+ return Convert.ToUInt64((Single)this.innerValue);
+ case MsgPackType.DateTime:
+ return Convert.ToUInt64((DateTime)this.innerValue);
+ default:
+ return 0;
+ }
+
+ }
+
+ public Int64 GetAsInteger()
+ {
+ switch (this.valueType)
+ {
+ case MsgPackType.Integer:
+ return (Int64)this.innerValue;
+ case MsgPackType.UInt64:
+ return Convert.ToInt64((Int64)this.innerValue);
+ case MsgPackType.String:
+ return Int64.Parse(this.innerValue.ToString().Trim());
+ case MsgPackType.Float:
+ return Convert.ToInt64((Double)this.innerValue);
+ case MsgPackType.Single:
+ return Convert.ToInt64((Single)this.innerValue);
+ case MsgPackType.DateTime:
+ return Convert.ToInt64((DateTime)this.innerValue);
+ default:
+ return 0;
+ }
+ }
+
+ public Double GetAsFloat()
+ {
+ switch (this.valueType)
+ {
+ case MsgPackType.Integer:
+ return Convert.ToDouble((Int64)this.innerValue);
+ case MsgPackType.String:
+ return Double.Parse((String)this.innerValue);
+ case MsgPackType.Float:
+ return (Double)this.innerValue;
+ case MsgPackType.Single:
+ return (Single)this.innerValue;
+ case MsgPackType.DateTime:
+ return Convert.ToInt64((DateTime)this.innerValue);
+ default:
+ return 0;
+ }
+ }
+
+
+ public void SetAsBytes(byte[] value)
+ {
+ this.innerValue = value;
+ this.valueType = MsgPackType.Binary;
+ }
+
+ public byte[] GetAsBytes()
+ {
+ switch (this.valueType)
+ {
+ case MsgPackType.Integer:
+ return BitConverter.GetBytes((Int64)this.innerValue);
+ case MsgPackType.String:
+ return BytesTools.GetUtf8Bytes(this.innerValue.ToString());
+ case MsgPackType.Float:
+ return BitConverter.GetBytes((Double)this.innerValue);
+ case MsgPackType.Single:
+ return BitConverter.GetBytes((Single)this.innerValue);
+ case MsgPackType.DateTime:
+ long dateval = ((DateTime)this.innerValue).ToBinary();
+ return BitConverter.GetBytes(dateval);
+ case MsgPackType.Binary:
+ return (byte[])this.innerValue;
+ default:
+ return new byte[] { };
+ }
+ }
+
+ public void Add(string key, String value)
+ {
+ MsgPack tmp = InnerAddArrayChild();
+ tmp.name = key;
+ tmp.SetAsString(value);
+ }
+
+ public void Add(string key, int value)
+ {
+ MsgPack tmp = InnerAddArrayChild();
+ tmp.name = key;
+ tmp.SetAsInteger(value);
+ }
+
+ public bool LoadFileAsBytes(string fileName)
+ {
+ if (File.Exists(fileName))
+ {
+ byte[] value = null;
+ FileStream fs = new FileStream(fileName, FileMode.Open);
+ value = new byte[fs.Length];
+ fs.Read(value, 0, (int)fs.Length);
+ fs.Close();
+ SetAsBytes(value);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+
+ }
+
+ public bool SaveBytesToFile(string fileName)
+ {
+ if (this.innerValue != null)
+ {
+ FileStream fs = new FileStream(fileName, FileMode.Append);
+ fs.Write(((byte[])this.innerValue), 0, ((byte[])this.innerValue).Length);
+ fs.Close();
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public MsgPack ForcePathObject(string path)
+ {
+ MsgPack tmpParent, tmpObject;
+ tmpParent = this;
+ string[] pathList = path.Trim().Split(new Char[] { '.', '/', '\\' });
+ string tmp = null;
+ if (pathList.Length == 0)
+ {
+ return null;
+ }
+ else if (pathList.Length > 1)
+ {
+ for (int i = 0; i < pathList.Length - 1; i++)
+ {
+ tmp = pathList[i];
+ tmpObject = tmpParent.FindObject(tmp);
+ if (tmpObject == null)
+ {
+ tmpParent = tmpParent.InnerAddMapChild();
+ tmpParent.SetName(tmp);
+ }
+ else
+ {
+ tmpParent = tmpObject;
+ }
+ }
+ }
+ tmp = pathList[pathList.Length - 1];
+ int j = tmpParent.IndexOf(tmp);
+ if (j > -1)
+ {
+ return tmpParent.children[j];
+ }
+ else
+ {
+ tmpParent = tmpParent.InnerAddMapChild();
+ tmpParent.SetName(tmp);
+ return tmpParent;
+ }
+ }
+
+ public void SetAsNull()
+ {
+ Clear();
+ this.innerValue = null;
+ this.valueType = MsgPackType.Null;
+ }
+
+ public void SetAsString(String value)
+ {
+ this.innerValue = value;
+ this.valueType = MsgPackType.String;
+ }
+
+ public String GetAsString()
+ {
+ if (this.innerValue == null)
+ {
+ return "";
+ }
+ else
+ {
+ return this.innerValue.ToString();
+ }
+
+ }
+
+ public void SetAsBoolean(Boolean bVal)
+ {
+ this.valueType = MsgPackType.Boolean;
+ this.innerValue = bVal;
+ }
+
+ public void SetAsSingle(Single fVal)
+ {
+ this.valueType = MsgPackType.Single;
+ this.innerValue = fVal;
+ }
+
+ public void SetAsFloat(Double fVal)
+ {
+ this.valueType = MsgPackType.Float;
+ this.innerValue = fVal;
+ }
+
+
+
+ public void DecodeFromBytes(byte[] bytes)
+ {
+ MemoryStream ms = new MemoryStream();
+ ms.Write(bytes, 0, bytes.Length);
+ ms.Position = 0;
+ DecodeFromStream(ms);
+ }
+
+ public void DecodeFromFile(string fileName)
+ {
+ FileStream fs = new FileStream(fileName, FileMode.Open);
+ DecodeFromStream(fs);
+ fs.Dispose();
+ }
+
+
+
+ public void DecodeFromStream(Stream ms)
+ {
+ byte lvByte = (byte)ms.ReadByte();
+ byte[] rawByte = null;
+ MsgPack msgPack = null;
+ int len = 0;
+ int i = 0;
+
+ if (lvByte <= 0x7F)
+ { //positive fixint 0xxxxxxx 0x00 - 0x7f
+ SetAsInteger(lvByte);
+ }
+ else if ((lvByte >= 0x80) && (lvByte <= 0x8F))
+ {
+ //fixmap 1000xxxx 0x80 - 0x8f
+ this.Clear();
+ this.valueType = MsgPackType.Map;
+ len = lvByte - 0x80;
+ for (i = 0; i < len; i++)
+ {
+ msgPack = InnerAdd();
+ msgPack.SetName(ReadTools.ReadString(ms));
+ msgPack.DecodeFromStream(ms);
+ }
+ }
+ else if ((lvByte >= 0x90) && (lvByte <= 0x9F)) //fixarray 1001xxxx 0x90 - 0x9f
+ {
+ //fixmap 1000xxxx 0x80 - 0x8f
+ this.Clear();
+ this.valueType = MsgPackType.Array;
+ len = lvByte - 0x90;
+ for (i = 0; i < len; i++)
+ {
+ msgPack = InnerAdd();
+ msgPack.DecodeFromStream(ms);
+ }
+ }
+ else if ((lvByte >= 0xA0) && (lvByte <= 0xBF)) // fixstr 101xxxxx 0xa0 - 0xbf
+ {
+ len = lvByte - 0xA0;
+ SetAsString(ReadTools.ReadString(ms, len));
+ }
+ else if ((lvByte >= 0xE0) && (lvByte <= 0xFF))
+ { /// -1..-32
+ // negative fixnum stores 5-bit negative integer
+ // +--------+
+ // |111YYYYY|
+ // +--------+
+ SetAsInteger((sbyte)lvByte);
+ }
+ else if (lvByte == 0xC0)
+ {
+ SetAsNull();
+ }
+ else if (lvByte == 0xC1)
+ {
+ throw new Exception("(never used) type $c1");
+ }
+ else if (lvByte == 0xC2)
+ {
+ SetAsBoolean(false);
+ }
+ else if (lvByte == 0xC3)
+ {
+ SetAsBoolean(true);
+ }
+ else if (lvByte == 0xC4)
+ { // max 255
+ len = ms.ReadByte();
+ rawByte = new byte[len];
+ ms.Read(rawByte, 0, len);
+ SetAsBytes(rawByte);
+ }
+ else if (lvByte == 0xC5)
+ { // max 65535
+ rawByte = new byte[2];
+ ms.Read(rawByte, 0, 2);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ len = BitConverter.ToInt16(rawByte, 0);
+
+ // read binary
+ rawByte = new byte[len];
+ ms.Read(rawByte, 0, len);
+ SetAsBytes(rawByte);
+ }
+ else if (lvByte == 0xC6)
+ { // binary max: 2^32-1
+ rawByte = new byte[4];
+ ms.Read(rawByte, 0, 4);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ len = BitConverter.ToInt32(rawByte, 0);
+
+ // read binary
+ rawByte = new byte[len];
+ ms.Read(rawByte, 0, len);
+ SetAsBytes(rawByte);
+ }
+ else if ((lvByte == 0xC7) || (lvByte == 0xC8) || (lvByte == 0xC9))
+ {
+ throw new Exception("(ext8,ext16,ex32) type $c7,$c8,$c9");
+ }
+ else if (lvByte == 0xCA)
+ { // float 32
+ rawByte = new byte[4];
+ ms.Read(rawByte, 0, 4);
+ rawByte = BytesTools.SwapBytes(rawByte);
+
+ SetAsSingle(BitConverter.ToSingle(rawByte, 0));
+ }
+ else if (lvByte == 0xCB)
+ { // float 64
+ rawByte = new byte[8];
+ ms.Read(rawByte, 0, 8);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ SetAsFloat(BitConverter.ToDouble(rawByte, 0));
+ }
+ else if (lvByte == 0xCC)
+ { // uint8
+ // uint 8 stores a 8-bit unsigned integer
+ // +--------+--------+
+ // | 0xcc |ZZZZZZZZ|
+ // +--------+--------+
+ lvByte = (byte)ms.ReadByte();
+ SetAsInteger(lvByte);
+ }
+ else if (lvByte == 0xCD)
+ { // uint16
+ // uint 16 stores a 16-bit big-endian unsigned integer
+ // +--------+--------+--------+
+ // | 0xcd |ZZZZZZZZ|ZZZZZZZZ|
+ // +--------+--------+--------+
+ rawByte = new byte[2];
+ ms.Read(rawByte, 0, 2);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ SetAsInteger(BitConverter.ToUInt16(rawByte, 0));
+ }
+ else if (lvByte == 0xCE)
+ {
+ // uint 32 stores a 32-bit big-endian unsigned integer
+ // +--------+--------+--------+--------+--------+
+ // | 0xce |ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ
+ // +--------+--------+--------+--------+--------+
+ rawByte = new byte[4];
+ ms.Read(rawByte, 0, 4);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ SetAsInteger(BitConverter.ToUInt32(rawByte, 0));
+ }
+ else if (lvByte == 0xCF)
+ {
+ // uint 64 stores a 64-bit big-endian unsigned integer
+ // +--------+--------+--------+--------+--------+--------+--------+--------+--------+
+ // | 0xcf |ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|
+ // +--------+--------+--------+--------+--------+--------+--------+--------+--------+
+ rawByte = new byte[8];
+ ms.Read(rawByte, 0, 8);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ SetAsUInt64(BitConverter.ToUInt64(rawByte, 0));
+ }
+ else if (lvByte == 0xDC)
+ {
+ // +--------+--------+--------+~~~~~~~~~~~~~~~~~+
+ // | 0xdc |YYYYYYYY|YYYYYYYY| N objects |
+ // +--------+--------+--------+~~~~~~~~~~~~~~~~~+
+ rawByte = new byte[2];
+ ms.Read(rawByte, 0, 2);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ len = BitConverter.ToInt16(rawByte, 0);
+
+ this.Clear();
+ this.valueType = MsgPackType.Array;
+ for (i = 0; i < len; i++)
+ {
+ msgPack = InnerAdd();
+ msgPack.DecodeFromStream(ms);
+ }
+ }
+ else if (lvByte == 0xDD)
+ {
+ // +--------+--------+--------+--------+--------+~~~~~~~~~~~~~~~~~+
+ // | 0xdd |ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ| N objects |
+ // +--------+--------+--------+--------+--------+~~~~~~~~~~~~~~~~~+
+ rawByte = new byte[4];
+ ms.Read(rawByte, 0, 4);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ len = BitConverter.ToInt16(rawByte, 0);
+
+ this.Clear();
+ this.valueType = MsgPackType.Array;
+ for (i = 0; i < len; i++)
+ {
+ msgPack = InnerAdd();
+ msgPack.DecodeFromStream(ms);
+ }
+ }
+ else if (lvByte == 0xD9)
+ {
+ // str 8 stores a byte array whose length is upto (2^8)-1 bytes:
+ // +--------+--------+========+
+ // | 0xd9 |YYYYYYYY| data |
+ // +--------+--------+========+
+ SetAsString(ReadTools.ReadString(lvByte, ms));
+ }
+ else if (lvByte == 0xDE)
+ {
+ // +--------+--------+--------+~~~~~~~~~~~~~~~~~+
+ // | 0xde |YYYYYYYY|YYYYYYYY| N*2 objects |
+ // +--------+--------+--------+~~~~~~~~~~~~~~~~~+
+ rawByte = new byte[2];
+ ms.Read(rawByte, 0, 2);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ len = BitConverter.ToInt16(rawByte, 0);
+
+ this.Clear();
+ this.valueType = MsgPackType.Map;
+ for (i = 0; i < len; i++)
+ {
+ msgPack = InnerAdd();
+ msgPack.SetName(ReadTools.ReadString(ms));
+ msgPack.DecodeFromStream(ms);
+ }
+ }
+ else if (lvByte == 0xDE)
+ {
+ // +--------+--------+--------+~~~~~~~~~~~~~~~~~+
+ // | 0xde |YYYYYYYY|YYYYYYYY| N*2 objects |
+ // +--------+--------+--------+~~~~~~~~~~~~~~~~~+
+ rawByte = new byte[2];
+ ms.Read(rawByte, 0, 2);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ len = BitConverter.ToInt16(rawByte, 0);
+
+ this.Clear();
+ this.valueType = MsgPackType.Map;
+ for (i = 0; i < len; i++)
+ {
+ msgPack = InnerAdd();
+ msgPack.SetName(ReadTools.ReadString(ms));
+ msgPack.DecodeFromStream(ms);
+ }
+ }
+ else if (lvByte == 0xDF)
+ {
+ // +--------+--------+--------+--------+--------+~~~~~~~~~~~~~~~~~+
+ // | 0xdf |ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ| N*2 objects |
+ // +--------+--------+--------+--------+--------+~~~~~~~~~~~~~~~~~+
+ rawByte = new byte[4];
+ ms.Read(rawByte, 0, 4);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ len = BitConverter.ToInt32(rawByte, 0);
+
+ this.Clear();
+ this.valueType = MsgPackType.Map;
+ for (i = 0; i < len; i++)
+ {
+ msgPack = InnerAdd();
+ msgPack.SetName(ReadTools.ReadString(ms));
+ msgPack.DecodeFromStream(ms);
+ }
+ }
+ else if (lvByte == 0xDA)
+ {
+ // str 16 stores a byte array whose length is upto (2^16)-1 bytes:
+ // +--------+--------+--------+========+
+ // | 0xda |ZZZZZZZZ|ZZZZZZZZ| data |
+ // +--------+--------+--------+========+
+ SetAsString(ReadTools.ReadString(lvByte, ms));
+ }
+ else if (lvByte == 0xDB)
+ {
+ // str 32 stores a byte array whose length is upto (2^32)-1 bytes:
+ // +--------+--------+--------+--------+--------+========+
+ // | 0xdb |AAAAAAAA|AAAAAAAA|AAAAAAAA|AAAAAAAA| data |
+ // +--------+--------+--------+--------+--------+========+
+ SetAsString(ReadTools.ReadString(lvByte, ms));
+ }
+ else if (lvByte == 0xD0)
+ {
+ // int 8 stores a 8-bit signed integer
+ // +--------+--------+
+ // | 0xd0 |ZZZZZZZZ|
+ // +--------+--------+
+ SetAsInteger((sbyte)ms.ReadByte());
+ }
+ else if (lvByte == 0xD1)
+ {
+ // int 16 stores a 16-bit big-endian signed integer
+ // +--------+--------+--------+
+ // | 0xd1 |ZZZZZZZZ|ZZZZZZZZ|
+ // +--------+--------+--------+
+ rawByte = new byte[2];
+ ms.Read(rawByte, 0, 2);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ SetAsInteger(BitConverter.ToInt16(rawByte, 0));
+ }
+ else if (lvByte == 0xD2)
+ {
+ // int 32 stores a 32-bit big-endian signed integer
+ // +--------+--------+--------+--------+--------+
+ // | 0xd2 |ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|
+ // +--------+--------+--------+--------+--------+
+ rawByte = new byte[4];
+ ms.Read(rawByte, 0, 4);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ SetAsInteger(BitConverter.ToInt32(rawByte, 0));
+ }
+ else if (lvByte == 0xD3)
+ {
+ // int 64 stores a 64-bit big-endian signed integer
+ // +--------+--------+--------+--------+--------+--------+--------+--------+--------+
+ // | 0xd3 |ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|
+ // +--------+--------+--------+--------+--------+--------+--------+--------+--------+
+ rawByte = new byte[8];
+ ms.Read(rawByte, 0, 8);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ SetAsInteger(BitConverter.ToInt64(rawByte, 0));
+ }
+ }
+
+ public byte[] Encode2Bytes()
+ {
+ MemoryStream ms = new MemoryStream();
+ Encode2Stream(ms);
+ byte[] r = new byte[ms.Length];
+ ms.Position = 0;
+ ms.Read(r, 0, (int)ms.Length);
+ return r;
+ }
+
+ public void Encode2Stream(Stream ms)
+ {
+ switch (this.valueType)
+ {
+ case MsgPackType.Unknown:
+ case MsgPackType.Null:
+ WriteTools.WriteNull(ms);
+ break;
+ case MsgPackType.String:
+ WriteTools.WriteString(ms, (String)this.innerValue);
+ break;
+ case MsgPackType.Integer:
+ WriteTools.WriteInteger(ms, (Int64)this.innerValue);
+ break;
+ case MsgPackType.UInt64:
+ WriteTools.WriteUInt64(ms, (UInt64)this.innerValue);
+ break;
+ case MsgPackType.Boolean:
+ WriteTools.WriteBoolean(ms, (Boolean)this.innerValue);
+ break;
+ case MsgPackType.Float:
+ WriteTools.WriteFloat(ms, (Double)this.innerValue);
+ break;
+ case MsgPackType.Single:
+ WriteTools.WriteFloat(ms, (Single)this.innerValue);
+ break;
+ case MsgPackType.DateTime:
+ WriteTools.WriteInteger(ms, GetAsInteger());
+ break;
+ case MsgPackType.Binary:
+ WriteTools.WriteBinary(ms, (byte[])this.innerValue);
+ break;
+ case MsgPackType.Map:
+ WriteMap(ms);
+ break;
+ case MsgPackType.Array:
+ WirteArray(ms);
+ break;
+ default:
+ WriteTools.WriteNull(ms);
+ break;
+ }
+ }
+
+ public String AsString
+ {
+ get
+ {
+ return GetAsString();
+ }
+ set
+ {
+ SetAsString(value);
+ }
+ }
+
+ public Int64 AsInteger
+ {
+ get { return GetAsInteger(); }
+ set { SetAsInteger((Int64)value); }
+ }
+
+ public Double AsFloat
+ {
+ get { return GetAsFloat(); }
+ set { SetAsFloat(value); }
+ }
+ public MsgPackArray AsArray
+ {
+ get
+ {
+ lock (this)
+ {
+ if (refAsArray == null)
+ {
+ refAsArray = new MsgPackArray(this, children);
+ }
+ }
+ return refAsArray;
+ }
+ }
+
+
+ public MsgPackType ValueType
+ {
+ get { return valueType; }
+ }
+
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return new MsgPackEnum(children);
+ }
+ }
+}
\ No newline at end of file
diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/MessagePack/MsgPackType.cs b/AsyncRAT-C#/AsyncRAT-Sharp/MessagePack/MsgPackType.cs
new file mode 100644
index 0000000..8a47d25
--- /dev/null
+++ b/AsyncRAT-C#/AsyncRAT-Sharp/MessagePack/MsgPackType.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AsyncRAT_Sharp.MessagePack
+{
+ public enum MsgPackType
+ {
+ Unknown = 0,
+ Null = 1,
+ Map = 2,
+ Array = 3,
+ String = 4,
+ Integer = 5,
+ UInt64 = 6,
+ Boolean = 7,
+ Float = 8,
+ Single = 9,
+ DateTime = 10,
+ Binary = 11
+ }
+}
\ No newline at end of file
diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/MessagePack/ReadTools.cs b/AsyncRAT-C#/AsyncRAT-Sharp/MessagePack/ReadTools.cs
new file mode 100644
index 0000000..522ea3f
--- /dev/null
+++ b/AsyncRAT-C#/AsyncRAT-Sharp/MessagePack/ReadTools.cs
@@ -0,0 +1,84 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AsyncRAT_Sharp.MessagePack
+{
+ class ReadTools
+ {
+ public static String ReadString(Stream ms, int len)
+ {
+ byte[] rawBytes = new byte[len];
+ ms.Read(rawBytes, 0, len);
+ return BytesTools.GetString(rawBytes);
+ }
+
+ public static String ReadString(Stream ms)
+ {
+ byte strFlag = (byte)ms.ReadByte();
+ return ReadString(strFlag, ms);
+ }
+
+ public static String ReadString(byte strFlag, Stream ms)
+ {
+ //
+ //fixstr stores a byte array whose length is upto 31 bytes:
+ //+--------+========+
+ //|101XXXXX| data |
+ //+--------+========+
+ //
+ //str 8 stores a byte array whose length is upto (2^8)-1 bytes:
+ //+--------+--------+========+
+ //| 0xd9 |YYYYYYYY| data |
+ //+--------+--------+========+
+ //
+ //str 16 stores a byte array whose length is upto (2^16)-1 bytes:
+ //+--------+--------+--------+========+
+ //| 0xda |ZZZZZZZZ|ZZZZZZZZ| data |
+ //+--------+--------+--------+========+
+ //
+ //str 32 stores a byte array whose length is upto (2^32)-1 bytes:
+ //+--------+--------+--------+--------+--------+========+
+ //| 0xdb |AAAAAAAA|AAAAAAAA|AAAAAAAA|AAAAAAAA| data |
+ //+--------+--------+--------+--------+--------+========+
+ //
+ //where
+ //* XXXXX is a 5-bit unsigned integer which represents N
+ //* YYYYYYYY is a 8-bit unsigned integer which represents N
+ //* ZZZZZZZZ_ZZZZZZZZ is a 16-bit big-endian unsigned integer which represents N
+ //* AAAAAAAA_AAAAAAAA_AAAAAAAA_AAAAAAAA is a 32-bit big-endian unsigned integer which represents N
+ //* N is the length of data
+
+ byte[] rawBytes = null;
+ int len = 0;
+ if ((strFlag >= 0xA0) && (strFlag <= 0xBF))
+ {
+ len = strFlag - 0xA0;
+ }
+ else if (strFlag == 0xD9)
+ {
+ len = ms.ReadByte();
+ }
+ else if (strFlag == 0xDA)
+ {
+ rawBytes = new byte[2];
+ ms.Read(rawBytes, 0, 2);
+ rawBytes = BytesTools.SwapBytes(rawBytes);
+ len = BitConverter.ToInt16(rawBytes, 0);
+ }
+ else if (strFlag == 0xDB)
+ {
+ rawBytes = new byte[4];
+ ms.Read(rawBytes, 0, 4);
+ rawBytes = BytesTools.SwapBytes(rawBytes);
+ len = BitConverter.ToInt32(rawBytes, 0);
+ }
+ rawBytes = new byte[len];
+ ms.Read(rawBytes, 0, len);
+ return BytesTools.GetString(rawBytes);
+ }
+ }
+}
\ No newline at end of file
diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/MessagePack/WriteTools.cs b/AsyncRAT-C#/AsyncRAT-Sharp/MessagePack/WriteTools.cs
new file mode 100644
index 0000000..19414a3
--- /dev/null
+++ b/AsyncRAT-C#/AsyncRAT-Sharp/MessagePack/WriteTools.cs
@@ -0,0 +1,203 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AsyncRAT_Sharp.MessagePack
+{
+ class WriteTools
+ {
+ public static void WriteNull(Stream ms)
+ {
+ ms.WriteByte(0xC0);
+ }
+
+ public static void WriteString(Stream ms, String strVal)
+ {
+ //
+ //fixstr stores a byte array whose length is upto 31 bytes:
+ //+--------+========+
+ //|101XXXXX| data |
+ //+--------+========+
+ //
+ //str 8 stores a byte array whose length is upto (2^8)-1 bytes:
+ //+--------+--------+========+
+ //| 0xd9 |YYYYYYYY| data |
+ //+--------+--------+========+
+ //
+ //str 16 stores a byte array whose length is upto (2^16)-1 bytes:
+ //+--------+--------+--------+========+
+ //| 0xda |ZZZZZZZZ|ZZZZZZZZ| data |
+ //+--------+--------+--------+========+
+ //
+ //str 32 stores a byte array whose length is upto (2^32)-1 bytes:
+ //+--------+--------+--------+--------+--------+========+
+ //| 0xdb |AAAAAAAA|AAAAAAAA|AAAAAAAA|AAAAAAAA| data |
+ //+--------+--------+--------+--------+--------+========+
+ //
+ //where
+ //* XXXXX is a 5-bit unsigned integer which represents N
+ //* YYYYYYYY is a 8-bit unsigned integer which represents N
+ //* ZZZZZZZZ_ZZZZZZZZ is a 16-bit big-endian unsigned integer which represents N
+ //* AAAAAAAA_AAAAAAAA_AAAAAAAA_AAAAAAAA is a 32-bit big-endian unsigned integer which represents N
+ //* N is the length of data
+
+ byte[] rawBytes = BytesTools.GetUtf8Bytes(strVal);
+ byte[] lenBytes = null;
+ int len = rawBytes.Length;
+ byte b = 0;
+ if (len <= 31)
+ {
+ b = (byte)(0xA0 + (byte)len);
+ ms.WriteByte(b);
+ }
+ else if (len <= 255)
+ {
+ b = 0xD9;
+ ms.WriteByte(b);
+ b = (byte)len;
+ ms.WriteByte(b);
+ }
+ else if (len <= 65535)
+ {
+ b = 0xDA;
+ ms.WriteByte(b);
+
+ lenBytes = BytesTools.SwapBytes(BitConverter.GetBytes((Int16)len));
+ ms.Write(lenBytes, 0, lenBytes.Length);
+ }
+ else
+ {
+ b = 0xDB;
+ ms.WriteByte(b);
+
+ lenBytes = BytesTools.SwapBytes(BitConverter.GetBytes((Int32)len));
+ ms.Write(lenBytes, 0, lenBytes.Length);
+ }
+ ms.Write(rawBytes, 0, rawBytes.Length);
+ }
+ public static void WriteBinary(Stream ms, byte[] rawBytes)
+ {
+
+ byte[] lenBytes = null;
+ int len = rawBytes.Length;
+ byte b = 0;
+ if (len <= 255)
+ {
+ b = 0xC4;
+ ms.WriteByte(b);
+ b = (byte)len;
+ ms.WriteByte(b);
+ }
+ else if (len <= 65535)
+ {
+ b = 0xC5;
+ ms.WriteByte(b);
+
+ lenBytes = BytesTools.SwapBytes(BitConverter.GetBytes((Int16)len));
+ ms.Write(lenBytes, 0, lenBytes.Length);
+ }
+ else
+ {
+ b = 0xC6;
+ ms.WriteByte(b);
+
+ lenBytes = BytesTools.SwapBytes(BitConverter.GetBytes((Int32)len));
+ ms.Write(lenBytes, 0, lenBytes.Length);
+ }
+ ms.Write(rawBytes, 0, rawBytes.Length);
+ }
+
+ public static void WriteFloat(Stream ms, Double fVal)
+ {
+ ms.WriteByte(0xCB);
+ ms.Write(BytesTools.SwapDouble(fVal), 0, 8);
+ }
+
+ public static void WriteSingle(Stream ms, Single fVal)
+ {
+ ms.WriteByte(0xCA);
+ ms.Write(BytesTools.SwapBytes(BitConverter.GetBytes(fVal)), 0, 4);
+ }
+
+ public static void WriteBoolean(Stream ms, Boolean bVal)
+ {
+ if (bVal)
+ {
+ ms.WriteByte(0xC3);
+ }
+ else
+ {
+ ms.WriteByte(0xC2);
+ }
+ }
+
+
+ public static void WriteUInt64(Stream ms, UInt64 iVal)
+ {
+ ms.WriteByte(0xCF);
+ byte[] dataBytes = BitConverter.GetBytes(iVal);
+ ms.Write(BytesTools.SwapBytes(dataBytes), 0, 8);
+ }
+
+ public static void WriteInteger(Stream ms, Int64 iVal)
+ {
+ if (iVal >= 0)
+ { // 正数
+ if (iVal <= 127)
+ {
+ ms.WriteByte((byte)iVal);
+ }
+ else if (iVal <= 255)
+ { //UInt8
+ ms.WriteByte(0xCC);
+ ms.WriteByte((byte)iVal);
+ }
+ else if (iVal <= (UInt32)0xFFFF)
+ { //UInt16
+ ms.WriteByte(0xCD);
+ ms.Write(BytesTools.SwapInt16((Int16)iVal), 0, 2);
+ }
+ else if (iVal <= (UInt32)0xFFFFFFFF)
+ { //UInt32
+ ms.WriteByte(0xCE);
+ ms.Write(BytesTools.SwapInt32((Int32)iVal), 0, 4);
+ }
+ else
+ { //Int64
+ ms.WriteByte(0xD3);
+ ms.Write(BytesTools.SwapInt64(iVal), 0, 8);
+ }
+ }
+ else
+ { // <0
+ if (iVal <= Int32.MinValue) //-2147483648 // 64 bit
+ {
+ ms.WriteByte(0xD3);
+ ms.Write(BytesTools.SwapInt64(iVal), 0, 8);
+ }
+ else if (iVal <= Int16.MinValue) // -32768 // 32 bit
+ {
+ ms.WriteByte(0xD2);
+ ms.Write(BytesTools.SwapInt32((Int32)iVal), 0, 4);
+ }
+ else if (iVal <= -128) // -32768 // 32 bit
+ {
+ ms.WriteByte(0xD1);
+ ms.Write(BytesTools.SwapInt16((Int16)iVal), 0, 2);
+ }
+ else if (iVal <= -32)
+ {
+ ms.WriteByte(0xD0);
+ ms.WriteByte((byte)iVal);
+ }
+ else
+ {
+ ms.WriteByte((byte)iVal);
+ }
+ } // end <0
+ }
+ }
+}
\ No newline at end of file
diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Program.cs b/AsyncRAT-C#/AsyncRAT-Sharp/Program.cs
new file mode 100644
index 0000000..c2d3c65
--- /dev/null
+++ b/AsyncRAT-C#/AsyncRAT-Sharp/Program.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace AsyncRAT_Sharp
+{
+ static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new Form1());
+ }
+ }
+}
diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Properties/AssemblyInfo.cs b/AsyncRAT-C#/AsyncRAT-Sharp/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..7c680d5
--- /dev/null
+++ b/AsyncRAT-C#/AsyncRAT-Sharp/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("AsyncRAT-Sharp")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("AsyncRAT-Sharp")]
+[assembly: AssemblyCopyright("Copyright © 2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("7767c300-5fd5-4a5d-9d4c-59559cce48a3")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Properties/Resources.Designer.cs b/AsyncRAT-C#/AsyncRAT-Sharp/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..b19d7da
--- /dev/null
+++ b/AsyncRAT-C#/AsyncRAT-Sharp/Properties/Resources.Designer.cs
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace AsyncRAT_Sharp.Properties
+{
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AsyncRAT_Sharp.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Properties/Resources.resx b/AsyncRAT-C#/AsyncRAT-Sharp/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/AsyncRAT-C#/AsyncRAT-Sharp/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Properties/Settings.Designer.cs b/AsyncRAT-C#/AsyncRAT-Sharp/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..f347e77
--- /dev/null
+++ b/AsyncRAT-C#/AsyncRAT-Sharp/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace AsyncRAT_Sharp.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Properties/Settings.settings b/AsyncRAT-C#/AsyncRAT-Sharp/Properties/Settings.settings
new file mode 100644
index 0000000..3964565
--- /dev/null
+++ b/AsyncRAT-C#/AsyncRAT-Sharp/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Clients.cs b/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Clients.cs
new file mode 100644
index 0000000..8b14bd5
--- /dev/null
+++ b/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Clients.cs
@@ -0,0 +1,138 @@
+using System;
+using System.Text;
+using System.IO;
+using System.Net.Sockets;
+using System.Windows.Forms;
+using AsyncRAT_Sharp.Handle_Packet;
+using Microsoft.VisualBasic;
+using System.Diagnostics;
+
+namespace AsyncRAT_Sharp.Sockets
+{
+ class Clients
+ {
+ public Socket client;
+ public byte[] Buffer;
+ public long Buffersize;
+ public bool BufferRecevied;
+ public MemoryStream MS;
+ public ListViewItem LV;
+ public bool isClientConnected;
+
+ public void InitializeClient(Socket CLIENT)
+ {
+ client = CLIENT;
+ client.ReceiveBufferSize = 50 * 1024;
+ client.SendBufferSize = 50 * 1024;
+ client.ReceiveTimeout = -1;
+ client.SendTimeout = -1;
+ Buffer = new byte[1];
+ Buffersize = 0;
+ BufferRecevied = false;
+ isClientConnected = true;
+ MS = new MemoryStream();
+ LV = null;
+ client.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None, ReadClientData, null);
+
+ }
+
+ public async void ReadClientData(IAsyncResult ar)
+ {
+
+ try
+ {
+ int Recevied = client.EndReceive(ar);
+
+ if (Recevied > 0)
+ {
+
+ if (BufferRecevied == false)
+ {
+ if (Buffer[0] == 0)
+ {
+ Buffersize = Convert.ToInt64(Encoding.UTF8.GetString(MS.ToArray()));
+ MS = new MemoryStream();
+ if (Buffersize > 0)
+ {
+ Buffer = new byte[Buffersize - 1];
+ BufferRecevied = true;
+ }
+ }
+ else
+ {
+
+ await MS.WriteAsync(Buffer, 0, Buffer.Length);
+ }
+ }
+ else
+ {
+ await MS.WriteAsync(Buffer, 0, Recevied);
+ if (MS.Length == Buffersize)
+ {
+ HandlePacket.Read(this, MS.ToArray());
+ MS = new MemoryStream();
+ Buffer = new byte[1];
+ Buffersize = 0;
+ BufferRecevied = false;
+ }
+ }
+ }
+ client.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None, ReadClientData, null);
+ }
+ catch
+ {
+ Disconnected();
+ }
+
+ }
+
+ delegate void _isDisconnected();
+ public void Disconnected()
+ {
+ if (HandlePacket.Form.listView1.InvokeRequired)
+ HandlePacket.Form.listView1.Invoke(new _isDisconnected(Disconnected));
+ else
+ {
+ LV.Remove();
+ }
+ }
+ public async void BeginSend(byte[] Msgs)
+ {
+ if (isClientConnected || client.Connected)
+ {
+ try
+ {
+
+ using (MemoryStream MS = new MemoryStream())
+ {
+ byte[] buffer = Msgs;
+ byte[] buffersize = Encoding.UTF8.GetBytes(buffer.Length.ToString() + Strings.ChrW(0));
+ await MS.WriteAsync(buffersize, 0, buffersize.Length);
+ await MS.WriteAsync(buffer, 0, buffer.Length);
+
+ client.Poll(-1, SelectMode.SelectWrite);
+ client.BeginSend(MS.ToArray(), 0, Convert.ToInt32(MS.Length), SocketFlags.None, new AsyncCallback(EndSend), null);
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("BeginSend " + ex.Message);
+ Disconnected();
+ }
+ }
+ }
+
+ public void EndSend(IAsyncResult ar)
+ {
+ try
+ {
+ client.EndSend(ar);
+ }
+ 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
new file mode 100644
index 0000000..4778319
--- /dev/null
+++ b/AsyncRAT-C#/AsyncRAT-Sharp/Socket/Listener.cs
@@ -0,0 +1,31 @@
+using System.Threading.Tasks;
+using System.Net;
+using System.Net.Sockets;
+
+namespace AsyncRAT_Sharp.Sockets
+{
+ class Listener
+ {
+ public TcpListener listener;
+
+ public async void Connect(int port)
+ {
+ listener = new TcpListener(IPAddress.Any, port);
+ listener.Server.ReceiveBufferSize = 50 * 1024;
+ listener.Server.SendBufferSize = 50 * 1024;
+ listener.Server.ReceiveTimeout = -1;
+ listener.Server.SendTimeout = -1;
+ listener.Start();
+
+ while (true)
+ {
+ await Task.Delay(1);
+ if (listener.Pending())
+ {
+ Clients CL = new Clients();
+ CL.InitializeClient(listener.AcceptSocket());
+ }
+ }
+ }
+ }
+}
diff --git a/AsyncRAT-C#/Client/Client.csproj b/AsyncRAT-C#/Client/Client.csproj
new file mode 100644
index 0000000..c0e4d83
--- /dev/null
+++ b/AsyncRAT-C#/Client/Client.csproj
@@ -0,0 +1,54 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {C3C49F45-2589-4E04-9C50-71B6035C14AE}
+ Exe
+ Client
+ Client
+ v4.0
+ 512
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AsyncRAT-C#/Client/MessagePack/BytesTools.cs b/AsyncRAT-C#/Client/MessagePack/BytesTools.cs
new file mode 100644
index 0000000..8ca0275
--- /dev/null
+++ b/AsyncRAT-C#/Client/MessagePack/BytesTools.cs
@@ -0,0 +1,102 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AsyncRAT_Sharp.MessagePack
+{
+ public class BytesTools
+ {
+ static UTF8Encoding utf8Encode = new UTF8Encoding();
+
+ public static byte[] GetUtf8Bytes(String s)
+ {
+
+ return utf8Encode.GetBytes(s);
+ }
+
+ public static String GetString(byte[] utf8Bytes)
+ {
+ return utf8Encode.GetString(utf8Bytes);
+ }
+
+ public static String BytesAsString(byte[] bytes)
+ {
+ StringBuilder sb = new StringBuilder();
+ foreach (byte b in bytes)
+ {
+ sb.Append(String.Format("{0:D3} ", b));
+ }
+ return sb.ToString();
+ }
+
+
+ public static String BytesAsHexString(byte[] bytes)
+ {
+ StringBuilder sb = new StringBuilder();
+ foreach (byte b in bytes)
+ {
+ sb.Append(String.Format("{0:X2} ", b));
+ }
+ return sb.ToString();
+ }
+
+ ///
+ /// 交换byte数组数据
+ /// 可用于高低数据交换
+ ///
+ /// 要交换的byte数组
+ /// 返回交换后的数据
+ public static byte[] SwapBytes(byte[] v)
+ {
+ byte[] r = new byte[v.Length];
+ int j = v.Length - 1;
+ for (int i = 0; i < r.Length; i++)
+ {
+ r[i] = v[j];
+ j--;
+ }
+ return r;
+ }
+
+ public static byte[] SwapInt64(Int64 v)
+ {
+ //byte[] r = new byte[8];
+ //r[7] = (byte)v;
+ //r[6] = (byte)(v >> 8);
+ //r[5] = (byte)(v >> 16);
+ //r[4] = (byte)(v >> 24);
+ //r[3] = (byte)(v >> 32);
+ //r[2] = (byte)(v >> 40);
+ //r[1] = (byte)(v >> 48);
+ //r[0] = (byte)(v >> 56);
+ return SwapBytes(BitConverter.GetBytes(v));
+ }
+
+ public static byte[] SwapInt32(Int32 v)
+ {
+ byte[] r = new byte[4];
+ r[3] = (byte)v;
+ r[2] = (byte)(v >> 8);
+ r[1] = (byte)(v >> 16);
+ r[0] = (byte)(v >> 24);
+ return r;
+ }
+
+
+ public static byte[] SwapInt16(Int16 v)
+ {
+ byte[] r = new byte[2];
+ r[1] = (byte)v;
+ r[0] = (byte)(v >> 8);
+ return r;
+ }
+
+ public static byte[] SwapDouble(Double v)
+ {
+ return SwapBytes(BitConverter.GetBytes(v));
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/AsyncRAT-C#/Client/MessagePack/MsgPack.cs b/AsyncRAT-C#/Client/MessagePack/MsgPack.cs
new file mode 100644
index 0000000..c86a3ac
--- /dev/null
+++ b/AsyncRAT-C#/Client/MessagePack/MsgPack.cs
@@ -0,0 +1,930 @@
+/*
+ * 添加DecodeFormFile函数
+ * 2015-07-14 16:31:32
+ *
+ * 修复ForcePathObject查找不到子对象的bug,感谢(Putree 274638001)反馈
+ * 2015-07-14 16:32:13
+ *
+ * 修复整数值为127时解码出来为0的情况,感谢(Putree 274638001)反馈
+ * 2015-07-14 15:28:45
+ */
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+
+namespace AsyncRAT_Sharp.MessagePack
+{
+ public class MsgPackEnum : IEnumerator
+ {
+ List children;
+ int position = -1;
+
+ public MsgPackEnum(List obj)
+ {
+ children = obj;
+ }
+ object IEnumerator.Current
+ {
+ get { return children[position]; }
+ }
+
+ bool IEnumerator.MoveNext()
+ {
+ position++;
+ return (position < children.Count);
+ }
+
+ void IEnumerator.Reset()
+ {
+ position = -1;
+ }
+
+ }
+
+ public class MsgPackArray
+ {
+ List children;
+ MsgPack owner;
+
+ public MsgPackArray(MsgPack msgpackObj, List listObj)
+ {
+ owner = msgpackObj;
+ children = listObj;
+ }
+
+ public MsgPack Add()
+ {
+ return owner.AddArrayChild();
+ }
+
+ public MsgPack Add(String value)
+ {
+ MsgPack obj = owner.AddArrayChild();
+ obj.AsString = value;
+ return obj;
+ }
+
+ public MsgPack Add(Int64 value)
+ {
+ MsgPack obj = owner.AddArrayChild();
+ obj.SetAsInteger(value);
+ return obj;
+ }
+
+ public MsgPack Add(Double value)
+ {
+ MsgPack obj = owner.AddArrayChild();
+ obj.SetAsFloat(value);
+ return obj;
+ }
+
+ public MsgPack this[int index]
+ {
+ get { return children[index]; }
+ }
+
+ public int Length
+ {
+ get { return children.Count; }
+ }
+ }
+
+ public class MsgPack : IEnumerable
+ {
+ string name;
+ string lowerName;
+ object innerValue;
+ MsgPackType valueType;
+ MsgPack parent;
+ List children = new List();
+ MsgPackArray refAsArray = null;
+
+ private void SetName(string value)
+ {
+ this.name = value;
+ this.lowerName = name.ToLower();
+ }
+
+ private void Clear()
+ {
+ for (int i = 0; i < children.Count; i++)
+ {
+ ((MsgPack)children[i]).Clear();
+ }
+ children.Clear();
+ }
+
+ private MsgPack InnerAdd()
+ {
+ MsgPack r = new MsgPack();
+ r.parent = this;
+ this.children.Add(r);
+ return r;
+ }
+
+ private int IndexOf(string name)
+ {
+ int i = -1;
+ int r = -1;
+
+ string tmp = name.ToLower();
+ foreach (MsgPack item in children)
+ {
+ i++;
+ if (tmp.Equals(item.lowerName))
+ {
+ r = i;
+ break;
+ }
+ }
+ return r;
+ }
+
+ public MsgPack FindObject(string name)
+ {
+ int i = IndexOf(name);
+ if (i == -1)
+ {
+ return null;
+ }
+ else
+ {
+ return this.children[i];
+ }
+ }
+
+
+ private MsgPack InnerAddMapChild()
+ {
+ if (valueType != MsgPackType.Map)
+ {
+ Clear();
+ this.valueType = MsgPackType.Map;
+ }
+ return InnerAdd();
+ }
+
+ private MsgPack InnerAddArrayChild()
+ {
+ if (valueType != MsgPackType.Array)
+ {
+ Clear();
+ this.valueType = MsgPackType.Array;
+ }
+ return InnerAdd();
+ }
+
+ public MsgPack AddArrayChild()
+ {
+ return InnerAddArrayChild();
+ }
+
+ private void WriteMap(Stream ms)
+ {
+ byte b;
+ byte[] lenBytes;
+ int len = children.Count;
+ if (len <= 15)
+ {
+ b = (byte)(0x80 + (byte)len);
+ ms.WriteByte(b);
+ }
+ else if (len <= 65535)
+ {
+ b = 0xDE;
+ ms.WriteByte(b);
+
+ lenBytes = BytesTools.SwapBytes(BitConverter.GetBytes((Int16)len));
+ ms.Write(lenBytes, 0, lenBytes.Length);
+ }
+ else
+ {
+ b = 0xDF;
+ ms.WriteByte(b);
+ lenBytes = BytesTools.SwapBytes(BitConverter.GetBytes((Int32)len));
+ ms.Write(lenBytes, 0, lenBytes.Length);
+ }
+
+ for (int i = 0; i < len; i++)
+ {
+ WriteTools.WriteString(ms, children[i].name);
+ children[i].Encode2Stream(ms);
+ }
+ }
+
+ private void WirteArray(Stream ms)
+ {
+ byte b;
+ byte[] lenBytes;
+ int len = children.Count;
+ if (len <= 15)
+ {
+ b = (byte)(0x90 + (byte)len);
+ ms.WriteByte(b);
+ }
+ else if (len <= 65535)
+ {
+ b = 0xDC;
+ ms.WriteByte(b);
+
+ lenBytes = BytesTools.SwapBytes(BitConverter.GetBytes((Int16)len));
+ ms.Write(lenBytes, 0, lenBytes.Length);
+ }
+ else
+ {
+ b = 0xDD;
+ ms.WriteByte(b);
+ lenBytes = BytesTools.SwapBytes(BitConverter.GetBytes((Int32)len));
+ ms.Write(lenBytes, 0, lenBytes.Length);
+ }
+
+
+ for (int i = 0; i < len; i++)
+ {
+ ((MsgPack)children[i]).Encode2Stream(ms);
+ }
+ }
+
+ public void SetAsInteger(Int64 value)
+ {
+ this.innerValue = value;
+ this.valueType = MsgPackType.Integer;
+ }
+
+ public void SetAsUInt64(UInt64 value)
+ {
+ this.innerValue = value;
+ this.valueType = MsgPackType.UInt64;
+ }
+
+ public UInt64 GetAsUInt64()
+ {
+ switch (this.valueType)
+ {
+ case MsgPackType.Integer:
+ return Convert.ToUInt64((Int64)this.innerValue);
+ case MsgPackType.UInt64:
+ return (UInt64)this.innerValue;
+ case MsgPackType.String:
+ return UInt64.Parse(this.innerValue.ToString().Trim());
+ case MsgPackType.Float:
+ return Convert.ToUInt64((Double)this.innerValue);
+ case MsgPackType.Single:
+ return Convert.ToUInt64((Single)this.innerValue);
+ case MsgPackType.DateTime:
+ return Convert.ToUInt64((DateTime)this.innerValue);
+ default:
+ return 0;
+ }
+
+ }
+
+ public Int64 GetAsInteger()
+ {
+ switch (this.valueType)
+ {
+ case MsgPackType.Integer:
+ return (Int64)this.innerValue;
+ case MsgPackType.UInt64:
+ return Convert.ToInt64((Int64)this.innerValue);
+ case MsgPackType.String:
+ return Int64.Parse(this.innerValue.ToString().Trim());
+ case MsgPackType.Float:
+ return Convert.ToInt64((Double)this.innerValue);
+ case MsgPackType.Single:
+ return Convert.ToInt64((Single)this.innerValue);
+ case MsgPackType.DateTime:
+ return Convert.ToInt64((DateTime)this.innerValue);
+ default:
+ return 0;
+ }
+ }
+
+ public Double GetAsFloat()
+ {
+ switch (this.valueType)
+ {
+ case MsgPackType.Integer:
+ return Convert.ToDouble((Int64)this.innerValue);
+ case MsgPackType.String:
+ return Double.Parse((String)this.innerValue);
+ case MsgPackType.Float:
+ return (Double)this.innerValue;
+ case MsgPackType.Single:
+ return (Single)this.innerValue;
+ case MsgPackType.DateTime:
+ return Convert.ToInt64((DateTime)this.innerValue);
+ default:
+ return 0;
+ }
+ }
+
+
+ public void SetAsBytes(byte[] value)
+ {
+ this.innerValue = value;
+ this.valueType = MsgPackType.Binary;
+ }
+
+ public byte[] GetAsBytes()
+ {
+ switch (this.valueType)
+ {
+ case MsgPackType.Integer:
+ return BitConverter.GetBytes((Int64)this.innerValue);
+ case MsgPackType.String:
+ return BytesTools.GetUtf8Bytes(this.innerValue.ToString());
+ case MsgPackType.Float:
+ return BitConverter.GetBytes((Double)this.innerValue);
+ case MsgPackType.Single:
+ return BitConverter.GetBytes((Single)this.innerValue);
+ case MsgPackType.DateTime:
+ long dateval = ((DateTime)this.innerValue).ToBinary();
+ return BitConverter.GetBytes(dateval);
+ case MsgPackType.Binary:
+ return (byte[])this.innerValue;
+ default:
+ return new byte[] { };
+ }
+ }
+
+ public void Add(string key, String value)
+ {
+ MsgPack tmp = InnerAddArrayChild();
+ tmp.name = key;
+ tmp.SetAsString(value);
+ }
+
+ public void Add(string key, int value)
+ {
+ MsgPack tmp = InnerAddArrayChild();
+ tmp.name = key;
+ tmp.SetAsInteger(value);
+ }
+
+ public bool LoadFileAsBytes(string fileName)
+ {
+ if (File.Exists(fileName))
+ {
+ byte[] value = null;
+ FileStream fs = new FileStream(fileName, FileMode.Open);
+ value = new byte[fs.Length];
+ fs.Read(value, 0, (int)fs.Length);
+ fs.Close();
+ SetAsBytes(value);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+
+ }
+
+ public bool SaveBytesToFile(string fileName)
+ {
+ if (this.innerValue != null)
+ {
+ FileStream fs = new FileStream(fileName, FileMode.Append);
+ fs.Write(((byte[])this.innerValue), 0, ((byte[])this.innerValue).Length);
+ fs.Close();
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public MsgPack ForcePathObject(string path)
+ {
+ MsgPack tmpParent, tmpObject;
+ tmpParent = this;
+ string[] pathList = path.Trim().Split(new Char[] { '.', '/', '\\' });
+ string tmp = null;
+ if (pathList.Length == 0)
+ {
+ return null;
+ }
+ else if (pathList.Length > 1)
+ {
+ for (int i = 0; i < pathList.Length - 1; i++)
+ {
+ tmp = pathList[i];
+ tmpObject = tmpParent.FindObject(tmp);
+ if (tmpObject == null)
+ {
+ tmpParent = tmpParent.InnerAddMapChild();
+ tmpParent.SetName(tmp);
+ }
+ else
+ {
+ tmpParent = tmpObject;
+ }
+ }
+ }
+ tmp = pathList[pathList.Length - 1];
+ int j = tmpParent.IndexOf(tmp);
+ if (j > -1)
+ {
+ return tmpParent.children[j];
+ }
+ else
+ {
+ tmpParent = tmpParent.InnerAddMapChild();
+ tmpParent.SetName(tmp);
+ return tmpParent;
+ }
+ }
+
+ public void SetAsNull()
+ {
+ Clear();
+ this.innerValue = null;
+ this.valueType = MsgPackType.Null;
+ }
+
+ public void SetAsString(String value)
+ {
+ this.innerValue = value;
+ this.valueType = MsgPackType.String;
+ }
+
+ public String GetAsString()
+ {
+ if (this.innerValue == null)
+ {
+ return "";
+ }
+ else
+ {
+ return this.innerValue.ToString();
+ }
+
+ }
+
+ public void SetAsBoolean(Boolean bVal)
+ {
+ this.valueType = MsgPackType.Boolean;
+ this.innerValue = bVal;
+ }
+
+ public void SetAsSingle(Single fVal)
+ {
+ this.valueType = MsgPackType.Single;
+ this.innerValue = fVal;
+ }
+
+ public void SetAsFloat(Double fVal)
+ {
+ this.valueType = MsgPackType.Float;
+ this.innerValue = fVal;
+ }
+
+
+
+ public void DecodeFromBytes(byte[] bytes)
+ {
+ MemoryStream ms = new MemoryStream();
+ ms.Write(bytes, 0, bytes.Length);
+ ms.Position = 0;
+ DecodeFromStream(ms);
+ }
+
+ public void DecodeFromFile(string fileName)
+ {
+ FileStream fs = new FileStream(fileName, FileMode.Open);
+ DecodeFromStream(fs);
+ fs.Dispose();
+ }
+
+
+
+ public void DecodeFromStream(Stream ms)
+ {
+ byte lvByte = (byte)ms.ReadByte();
+ byte[] rawByte = null;
+ MsgPack msgPack = null;
+ int len = 0;
+ int i = 0;
+
+ if (lvByte <= 0x7F)
+ { //positive fixint 0xxxxxxx 0x00 - 0x7f
+ SetAsInteger(lvByte);
+ }
+ else if ((lvByte >= 0x80) && (lvByte <= 0x8F))
+ {
+ //fixmap 1000xxxx 0x80 - 0x8f
+ this.Clear();
+ this.valueType = MsgPackType.Map;
+ len = lvByte - 0x80;
+ for (i = 0; i < len; i++)
+ {
+ msgPack = InnerAdd();
+ msgPack.SetName(ReadTools.ReadString(ms));
+ msgPack.DecodeFromStream(ms);
+ }
+ }
+ else if ((lvByte >= 0x90) && (lvByte <= 0x9F)) //fixarray 1001xxxx 0x90 - 0x9f
+ {
+ //fixmap 1000xxxx 0x80 - 0x8f
+ this.Clear();
+ this.valueType = MsgPackType.Array;
+ len = lvByte - 0x90;
+ for (i = 0; i < len; i++)
+ {
+ msgPack = InnerAdd();
+ msgPack.DecodeFromStream(ms);
+ }
+ }
+ else if ((lvByte >= 0xA0) && (lvByte <= 0xBF)) // fixstr 101xxxxx 0xa0 - 0xbf
+ {
+ len = lvByte - 0xA0;
+ SetAsString(ReadTools.ReadString(ms, len));
+ }
+ else if ((lvByte >= 0xE0) && (lvByte <= 0xFF))
+ { /// -1..-32
+ // negative fixnum stores 5-bit negative integer
+ // +--------+
+ // |111YYYYY|
+ // +--------+
+ SetAsInteger((sbyte)lvByte);
+ }
+ else if (lvByte == 0xC0)
+ {
+ SetAsNull();
+ }
+ else if (lvByte == 0xC1)
+ {
+ throw new Exception("(never used) type $c1");
+ }
+ else if (lvByte == 0xC2)
+ {
+ SetAsBoolean(false);
+ }
+ else if (lvByte == 0xC3)
+ {
+ SetAsBoolean(true);
+ }
+ else if (lvByte == 0xC4)
+ { // max 255
+ len = ms.ReadByte();
+ rawByte = new byte[len];
+ ms.Read(rawByte, 0, len);
+ SetAsBytes(rawByte);
+ }
+ else if (lvByte == 0xC5)
+ { // max 65535
+ rawByte = new byte[2];
+ ms.Read(rawByte, 0, 2);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ len = BitConverter.ToInt16(rawByte, 0);
+
+ // read binary
+ rawByte = new byte[len];
+ ms.Read(rawByte, 0, len);
+ SetAsBytes(rawByte);
+ }
+ else if (lvByte == 0xC6)
+ { // binary max: 2^32-1
+ rawByte = new byte[4];
+ ms.Read(rawByte, 0, 4);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ len = BitConverter.ToInt32(rawByte, 0);
+
+ // read binary
+ rawByte = new byte[len];
+ ms.Read(rawByte, 0, len);
+ SetAsBytes(rawByte);
+ }
+ else if ((lvByte == 0xC7) || (lvByte == 0xC8) || (lvByte == 0xC9))
+ {
+ throw new Exception("(ext8,ext16,ex32) type $c7,$c8,$c9");
+ }
+ else if (lvByte == 0xCA)
+ { // float 32
+ rawByte = new byte[4];
+ ms.Read(rawByte, 0, 4);
+ rawByte = BytesTools.SwapBytes(rawByte);
+
+ SetAsSingle(BitConverter.ToSingle(rawByte, 0));
+ }
+ else if (lvByte == 0xCB)
+ { // float 64
+ rawByte = new byte[8];
+ ms.Read(rawByte, 0, 8);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ SetAsFloat(BitConverter.ToDouble(rawByte, 0));
+ }
+ else if (lvByte == 0xCC)
+ { // uint8
+ // uint 8 stores a 8-bit unsigned integer
+ // +--------+--------+
+ // | 0xcc |ZZZZZZZZ|
+ // +--------+--------+
+ lvByte = (byte)ms.ReadByte();
+ SetAsInteger(lvByte);
+ }
+ else if (lvByte == 0xCD)
+ { // uint16
+ // uint 16 stores a 16-bit big-endian unsigned integer
+ // +--------+--------+--------+
+ // | 0xcd |ZZZZZZZZ|ZZZZZZZZ|
+ // +--------+--------+--------+
+ rawByte = new byte[2];
+ ms.Read(rawByte, 0, 2);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ SetAsInteger(BitConverter.ToUInt16(rawByte, 0));
+ }
+ else if (lvByte == 0xCE)
+ {
+ // uint 32 stores a 32-bit big-endian unsigned integer
+ // +--------+--------+--------+--------+--------+
+ // | 0xce |ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ
+ // +--------+--------+--------+--------+--------+
+ rawByte = new byte[4];
+ ms.Read(rawByte, 0, 4);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ SetAsInteger(BitConverter.ToUInt32(rawByte, 0));
+ }
+ else if (lvByte == 0xCF)
+ {
+ // uint 64 stores a 64-bit big-endian unsigned integer
+ // +--------+--------+--------+--------+--------+--------+--------+--------+--------+
+ // | 0xcf |ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|
+ // +--------+--------+--------+--------+--------+--------+--------+--------+--------+
+ rawByte = new byte[8];
+ ms.Read(rawByte, 0, 8);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ SetAsUInt64(BitConverter.ToUInt64(rawByte, 0));
+ }
+ else if (lvByte == 0xDC)
+ {
+ // +--------+--------+--------+~~~~~~~~~~~~~~~~~+
+ // | 0xdc |YYYYYYYY|YYYYYYYY| N objects |
+ // +--------+--------+--------+~~~~~~~~~~~~~~~~~+
+ rawByte = new byte[2];
+ ms.Read(rawByte, 0, 2);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ len = BitConverter.ToInt16(rawByte, 0);
+
+ this.Clear();
+ this.valueType = MsgPackType.Array;
+ for (i = 0; i < len; i++)
+ {
+ msgPack = InnerAdd();
+ msgPack.DecodeFromStream(ms);
+ }
+ }
+ else if (lvByte == 0xDD)
+ {
+ // +--------+--------+--------+--------+--------+~~~~~~~~~~~~~~~~~+
+ // | 0xdd |ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ| N objects |
+ // +--------+--------+--------+--------+--------+~~~~~~~~~~~~~~~~~+
+ rawByte = new byte[4];
+ ms.Read(rawByte, 0, 4);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ len = BitConverter.ToInt16(rawByte, 0);
+
+ this.Clear();
+ this.valueType = MsgPackType.Array;
+ for (i = 0; i < len; i++)
+ {
+ msgPack = InnerAdd();
+ msgPack.DecodeFromStream(ms);
+ }
+ }
+ else if (lvByte == 0xD9)
+ {
+ // str 8 stores a byte array whose length is upto (2^8)-1 bytes:
+ // +--------+--------+========+
+ // | 0xd9 |YYYYYYYY| data |
+ // +--------+--------+========+
+ SetAsString(ReadTools.ReadString(lvByte, ms));
+ }
+ else if (lvByte == 0xDE)
+ {
+ // +--------+--------+--------+~~~~~~~~~~~~~~~~~+
+ // | 0xde |YYYYYYYY|YYYYYYYY| N*2 objects |
+ // +--------+--------+--------+~~~~~~~~~~~~~~~~~+
+ rawByte = new byte[2];
+ ms.Read(rawByte, 0, 2);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ len = BitConverter.ToInt16(rawByte, 0);
+
+ this.Clear();
+ this.valueType = MsgPackType.Map;
+ for (i = 0; i < len; i++)
+ {
+ msgPack = InnerAdd();
+ msgPack.SetName(ReadTools.ReadString(ms));
+ msgPack.DecodeFromStream(ms);
+ }
+ }
+ else if (lvByte == 0xDE)
+ {
+ // +--------+--------+--------+~~~~~~~~~~~~~~~~~+
+ // | 0xde |YYYYYYYY|YYYYYYYY| N*2 objects |
+ // +--------+--------+--------+~~~~~~~~~~~~~~~~~+
+ rawByte = new byte[2];
+ ms.Read(rawByte, 0, 2);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ len = BitConverter.ToInt16(rawByte, 0);
+
+ this.Clear();
+ this.valueType = MsgPackType.Map;
+ for (i = 0; i < len; i++)
+ {
+ msgPack = InnerAdd();
+ msgPack.SetName(ReadTools.ReadString(ms));
+ msgPack.DecodeFromStream(ms);
+ }
+ }
+ else if (lvByte == 0xDF)
+ {
+ // +--------+--------+--------+--------+--------+~~~~~~~~~~~~~~~~~+
+ // | 0xdf |ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ| N*2 objects |
+ // +--------+--------+--------+--------+--------+~~~~~~~~~~~~~~~~~+
+ rawByte = new byte[4];
+ ms.Read(rawByte, 0, 4);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ len = BitConverter.ToInt32(rawByte, 0);
+
+ this.Clear();
+ this.valueType = MsgPackType.Map;
+ for (i = 0; i < len; i++)
+ {
+ msgPack = InnerAdd();
+ msgPack.SetName(ReadTools.ReadString(ms));
+ msgPack.DecodeFromStream(ms);
+ }
+ }
+ else if (lvByte == 0xDA)
+ {
+ // str 16 stores a byte array whose length is upto (2^16)-1 bytes:
+ // +--------+--------+--------+========+
+ // | 0xda |ZZZZZZZZ|ZZZZZZZZ| data |
+ // +--------+--------+--------+========+
+ SetAsString(ReadTools.ReadString(lvByte, ms));
+ }
+ else if (lvByte == 0xDB)
+ {
+ // str 32 stores a byte array whose length is upto (2^32)-1 bytes:
+ // +--------+--------+--------+--------+--------+========+
+ // | 0xdb |AAAAAAAA|AAAAAAAA|AAAAAAAA|AAAAAAAA| data |
+ // +--------+--------+--------+--------+--------+========+
+ SetAsString(ReadTools.ReadString(lvByte, ms));
+ }
+ else if (lvByte == 0xD0)
+ {
+ // int 8 stores a 8-bit signed integer
+ // +--------+--------+
+ // | 0xd0 |ZZZZZZZZ|
+ // +--------+--------+
+ SetAsInteger((sbyte)ms.ReadByte());
+ }
+ else if (lvByte == 0xD1)
+ {
+ // int 16 stores a 16-bit big-endian signed integer
+ // +--------+--------+--------+
+ // | 0xd1 |ZZZZZZZZ|ZZZZZZZZ|
+ // +--------+--------+--------+
+ rawByte = new byte[2];
+ ms.Read(rawByte, 0, 2);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ SetAsInteger(BitConverter.ToInt16(rawByte, 0));
+ }
+ else if (lvByte == 0xD2)
+ {
+ // int 32 stores a 32-bit big-endian signed integer
+ // +--------+--------+--------+--------+--------+
+ // | 0xd2 |ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|
+ // +--------+--------+--------+--------+--------+
+ rawByte = new byte[4];
+ ms.Read(rawByte, 0, 4);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ SetAsInteger(BitConverter.ToInt32(rawByte, 0));
+ }
+ else if (lvByte == 0xD3)
+ {
+ // int 64 stores a 64-bit big-endian signed integer
+ // +--------+--------+--------+--------+--------+--------+--------+--------+--------+
+ // | 0xd3 |ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|ZZZZZZZZ|
+ // +--------+--------+--------+--------+--------+--------+--------+--------+--------+
+ rawByte = new byte[8];
+ ms.Read(rawByte, 0, 8);
+ rawByte = BytesTools.SwapBytes(rawByte);
+ SetAsInteger(BitConverter.ToInt64(rawByte, 0));
+ }
+ }
+
+ public byte[] Encode2Bytes()
+ {
+ MemoryStream ms = new MemoryStream();
+ Encode2Stream(ms);
+ byte[] r = new byte[ms.Length];
+ ms.Position = 0;
+ ms.Read(r, 0, (int)ms.Length);
+ return r;
+ }
+
+ public void Encode2Stream(Stream ms)
+ {
+ switch (this.valueType)
+ {
+ case MsgPackType.Unknown:
+ case MsgPackType.Null:
+ WriteTools.WriteNull(ms);
+ break;
+ case MsgPackType.String:
+ WriteTools.WriteString(ms, (String)this.innerValue);
+ break;
+ case MsgPackType.Integer:
+ WriteTools.WriteInteger(ms, (Int64)this.innerValue);
+ break;
+ case MsgPackType.UInt64:
+ WriteTools.WriteUInt64(ms, (UInt64)this.innerValue);
+ break;
+ case MsgPackType.Boolean:
+ WriteTools.WriteBoolean(ms, (Boolean)this.innerValue);
+ break;
+ case MsgPackType.Float:
+ WriteTools.WriteFloat(ms, (Double)this.innerValue);
+ break;
+ case MsgPackType.Single:
+ WriteTools.WriteFloat(ms, (Single)this.innerValue);
+ break;
+ case MsgPackType.DateTime:
+ WriteTools.WriteInteger(ms, GetAsInteger());
+ break;
+ case MsgPackType.Binary:
+ WriteTools.WriteBinary(ms, (byte[])this.innerValue);
+ break;
+ case MsgPackType.Map:
+ WriteMap(ms);
+ break;
+ case MsgPackType.Array:
+ WirteArray(ms);
+ break;
+ default:
+ WriteTools.WriteNull(ms);
+ break;
+ }
+ }
+
+ public String AsString
+ {
+ get
+ {
+ return GetAsString();
+ }
+ set
+ {
+ SetAsString(value);
+ }
+ }
+
+ public Int64 AsInteger
+ {
+ get { return GetAsInteger(); }
+ set { SetAsInteger((Int64)value); }
+ }
+
+ public Double AsFloat
+ {
+ get { return GetAsFloat(); }
+ set { SetAsFloat(value); }
+ }
+ public MsgPackArray AsArray
+ {
+ get
+ {
+ lock (this)
+ {
+ if (refAsArray == null)
+ {
+ refAsArray = new MsgPackArray(this, children);
+ }
+ }
+ return refAsArray;
+ }
+ }
+
+
+ public MsgPackType ValueType
+ {
+ get { return valueType; }
+ }
+
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return new MsgPackEnum(children);
+ }
+ }
+}
\ No newline at end of file
diff --git a/AsyncRAT-C#/Client/MessagePack/MsgPackType.cs b/AsyncRAT-C#/Client/MessagePack/MsgPackType.cs
new file mode 100644
index 0000000..8a47d25
--- /dev/null
+++ b/AsyncRAT-C#/Client/MessagePack/MsgPackType.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AsyncRAT_Sharp.MessagePack
+{
+ public enum MsgPackType
+ {
+ Unknown = 0,
+ Null = 1,
+ Map = 2,
+ Array = 3,
+ String = 4,
+ Integer = 5,
+ UInt64 = 6,
+ Boolean = 7,
+ Float = 8,
+ Single = 9,
+ DateTime = 10,
+ Binary = 11
+ }
+}
\ No newline at end of file
diff --git a/AsyncRAT-C#/Client/MessagePack/ReadTools.cs b/AsyncRAT-C#/Client/MessagePack/ReadTools.cs
new file mode 100644
index 0000000..522ea3f
--- /dev/null
+++ b/AsyncRAT-C#/Client/MessagePack/ReadTools.cs
@@ -0,0 +1,84 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AsyncRAT_Sharp.MessagePack
+{
+ class ReadTools
+ {
+ public static String ReadString(Stream ms, int len)
+ {
+ byte[] rawBytes = new byte[len];
+ ms.Read(rawBytes, 0, len);
+ return BytesTools.GetString(rawBytes);
+ }
+
+ public static String ReadString(Stream ms)
+ {
+ byte strFlag = (byte)ms.ReadByte();
+ return ReadString(strFlag, ms);
+ }
+
+ public static String ReadString(byte strFlag, Stream ms)
+ {
+ //
+ //fixstr stores a byte array whose length is upto 31 bytes:
+ //+--------+========+
+ //|101XXXXX| data |
+ //+--------+========+
+ //
+ //str 8 stores a byte array whose length is upto (2^8)-1 bytes:
+ //+--------+--------+========+
+ //| 0xd9 |YYYYYYYY| data |
+ //+--------+--------+========+
+ //
+ //str 16 stores a byte array whose length is upto (2^16)-1 bytes:
+ //+--------+--------+--------+========+
+ //| 0xda |ZZZZZZZZ|ZZZZZZZZ| data |
+ //+--------+--------+--------+========+
+ //
+ //str 32 stores a byte array whose length is upto (2^32)-1 bytes:
+ //+--------+--------+--------+--------+--------+========+
+ //| 0xdb |AAAAAAAA|AAAAAAAA|AAAAAAAA|AAAAAAAA| data |
+ //+--------+--------+--------+--------+--------+========+
+ //
+ //where
+ //* XXXXX is a 5-bit unsigned integer which represents N
+ //* YYYYYYYY is a 8-bit unsigned integer which represents N
+ //* ZZZZZZZZ_ZZZZZZZZ is a 16-bit big-endian unsigned integer which represents N
+ //* AAAAAAAA_AAAAAAAA_AAAAAAAA_AAAAAAAA is a 32-bit big-endian unsigned integer which represents N
+ //* N is the length of data
+
+ byte[] rawBytes = null;
+ int len = 0;
+ if ((strFlag >= 0xA0) && (strFlag <= 0xBF))
+ {
+ len = strFlag - 0xA0;
+ }
+ else if (strFlag == 0xD9)
+ {
+ len = ms.ReadByte();
+ }
+ else if (strFlag == 0xDA)
+ {
+ rawBytes = new byte[2];
+ ms.Read(rawBytes, 0, 2);
+ rawBytes = BytesTools.SwapBytes(rawBytes);
+ len = BitConverter.ToInt16(rawBytes, 0);
+ }
+ else if (strFlag == 0xDB)
+ {
+ rawBytes = new byte[4];
+ ms.Read(rawBytes, 0, 4);
+ rawBytes = BytesTools.SwapBytes(rawBytes);
+ len = BitConverter.ToInt32(rawBytes, 0);
+ }
+ rawBytes = new byte[len];
+ ms.Read(rawBytes, 0, len);
+ return BytesTools.GetString(rawBytes);
+ }
+ }
+}
\ No newline at end of file
diff --git a/AsyncRAT-C#/Client/MessagePack/WriteTools.cs b/AsyncRAT-C#/Client/MessagePack/WriteTools.cs
new file mode 100644
index 0000000..19414a3
--- /dev/null
+++ b/AsyncRAT-C#/Client/MessagePack/WriteTools.cs
@@ -0,0 +1,203 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AsyncRAT_Sharp.MessagePack
+{
+ class WriteTools
+ {
+ public static void WriteNull(Stream ms)
+ {
+ ms.WriteByte(0xC0);
+ }
+
+ public static void WriteString(Stream ms, String strVal)
+ {
+ //
+ //fixstr stores a byte array whose length is upto 31 bytes:
+ //+--------+========+
+ //|101XXXXX| data |
+ //+--------+========+
+ //
+ //str 8 stores a byte array whose length is upto (2^8)-1 bytes:
+ //+--------+--------+========+
+ //| 0xd9 |YYYYYYYY| data |
+ //+--------+--------+========+
+ //
+ //str 16 stores a byte array whose length is upto (2^16)-1 bytes:
+ //+--------+--------+--------+========+
+ //| 0xda |ZZZZZZZZ|ZZZZZZZZ| data |
+ //+--------+--------+--------+========+
+ //
+ //str 32 stores a byte array whose length is upto (2^32)-1 bytes:
+ //+--------+--------+--------+--------+--------+========+
+ //| 0xdb |AAAAAAAA|AAAAAAAA|AAAAAAAA|AAAAAAAA| data |
+ //+--------+--------+--------+--------+--------+========+
+ //
+ //where
+ //* XXXXX is a 5-bit unsigned integer which represents N
+ //* YYYYYYYY is a 8-bit unsigned integer which represents N
+ //* ZZZZZZZZ_ZZZZZZZZ is a 16-bit big-endian unsigned integer which represents N
+ //* AAAAAAAA_AAAAAAAA_AAAAAAAA_AAAAAAAA is a 32-bit big-endian unsigned integer which represents N
+ //* N is the length of data
+
+ byte[] rawBytes = BytesTools.GetUtf8Bytes(strVal);
+ byte[] lenBytes = null;
+ int len = rawBytes.Length;
+ byte b = 0;
+ if (len <= 31)
+ {
+ b = (byte)(0xA0 + (byte)len);
+ ms.WriteByte(b);
+ }
+ else if (len <= 255)
+ {
+ b = 0xD9;
+ ms.WriteByte(b);
+ b = (byte)len;
+ ms.WriteByte(b);
+ }
+ else if (len <= 65535)
+ {
+ b = 0xDA;
+ ms.WriteByte(b);
+
+ lenBytes = BytesTools.SwapBytes(BitConverter.GetBytes((Int16)len));
+ ms.Write(lenBytes, 0, lenBytes.Length);
+ }
+ else
+ {
+ b = 0xDB;
+ ms.WriteByte(b);
+
+ lenBytes = BytesTools.SwapBytes(BitConverter.GetBytes((Int32)len));
+ ms.Write(lenBytes, 0, lenBytes.Length);
+ }
+ ms.Write(rawBytes, 0, rawBytes.Length);
+ }
+ public static void WriteBinary(Stream ms, byte[] rawBytes)
+ {
+
+ byte[] lenBytes = null;
+ int len = rawBytes.Length;
+ byte b = 0;
+ if (len <= 255)
+ {
+ b = 0xC4;
+ ms.WriteByte(b);
+ b = (byte)len;
+ ms.WriteByte(b);
+ }
+ else if (len <= 65535)
+ {
+ b = 0xC5;
+ ms.WriteByte(b);
+
+ lenBytes = BytesTools.SwapBytes(BitConverter.GetBytes((Int16)len));
+ ms.Write(lenBytes, 0, lenBytes.Length);
+ }
+ else
+ {
+ b = 0xC6;
+ ms.WriteByte(b);
+
+ lenBytes = BytesTools.SwapBytes(BitConverter.GetBytes((Int32)len));
+ ms.Write(lenBytes, 0, lenBytes.Length);
+ }
+ ms.Write(rawBytes, 0, rawBytes.Length);
+ }
+
+ public static void WriteFloat(Stream ms, Double fVal)
+ {
+ ms.WriteByte(0xCB);
+ ms.Write(BytesTools.SwapDouble(fVal), 0, 8);
+ }
+
+ public static void WriteSingle(Stream ms, Single fVal)
+ {
+ ms.WriteByte(0xCA);
+ ms.Write(BytesTools.SwapBytes(BitConverter.GetBytes(fVal)), 0, 4);
+ }
+
+ public static void WriteBoolean(Stream ms, Boolean bVal)
+ {
+ if (bVal)
+ {
+ ms.WriteByte(0xC3);
+ }
+ else
+ {
+ ms.WriteByte(0xC2);
+ }
+ }
+
+
+ public static void WriteUInt64(Stream ms, UInt64 iVal)
+ {
+ ms.WriteByte(0xCF);
+ byte[] dataBytes = BitConverter.GetBytes(iVal);
+ ms.Write(BytesTools.SwapBytes(dataBytes), 0, 8);
+ }
+
+ public static void WriteInteger(Stream ms, Int64 iVal)
+ {
+ if (iVal >= 0)
+ { // 正数
+ if (iVal <= 127)
+ {
+ ms.WriteByte((byte)iVal);
+ }
+ else if (iVal <= 255)
+ { //UInt8
+ ms.WriteByte(0xCC);
+ ms.WriteByte((byte)iVal);
+ }
+ else if (iVal <= (UInt32)0xFFFF)
+ { //UInt16
+ ms.WriteByte(0xCD);
+ ms.Write(BytesTools.SwapInt16((Int16)iVal), 0, 2);
+ }
+ else if (iVal <= (UInt32)0xFFFFFFFF)
+ { //UInt32
+ ms.WriteByte(0xCE);
+ ms.Write(BytesTools.SwapInt32((Int32)iVal), 0, 4);
+ }
+ else
+ { //Int64
+ ms.WriteByte(0xD3);
+ ms.Write(BytesTools.SwapInt64(iVal), 0, 8);
+ }
+ }
+ else
+ { // <0
+ if (iVal <= Int32.MinValue) //-2147483648 // 64 bit
+ {
+ ms.WriteByte(0xD3);
+ ms.Write(BytesTools.SwapInt64(iVal), 0, 8);
+ }
+ else if (iVal <= Int16.MinValue) // -32768 // 32 bit
+ {
+ ms.WriteByte(0xD2);
+ ms.Write(BytesTools.SwapInt32((Int32)iVal), 0, 4);
+ }
+ else if (iVal <= -128) // -32768 // 32 bit
+ {
+ ms.WriteByte(0xD1);
+ ms.Write(BytesTools.SwapInt16((Int16)iVal), 0, 2);
+ }
+ else if (iVal <= -32)
+ {
+ ms.WriteByte(0xD0);
+ ms.WriteByte((byte)iVal);
+ }
+ else
+ {
+ ms.WriteByte((byte)iVal);
+ }
+ } // end <0
+ }
+ }
+}
\ No newline at end of file
diff --git a/AsyncRAT-C#/Client/Program.cs b/AsyncRAT-C#/Client/Program.cs
new file mode 100644
index 0000000..a1305af
--- /dev/null
+++ b/AsyncRAT-C#/Client/Program.cs
@@ -0,0 +1,163 @@
+using AsyncRAT_Sharp.MessagePack;
+using Microsoft.VisualBasic;
+using Microsoft.VisualBasic.Devices;
+using System;
+using System.IO;
+using System.Net.Sockets;
+using System.Text;
+using System.Threading;
+
+namespace Client
+{
+ class Program
+ {
+ public static Socket client;
+ public static byte[] Buffer;
+ public static long Buffersize;
+ public static bool BufferRecevied;
+ public static MemoryStream MS;
+
+ static void Main(string[] args)
+ {
+ InitializeClient();
+ while (true)
+ {
+ Thread.Sleep(1000);
+ }
+ }
+
+ public static void InitializeClient()
+ {
+ try
+ {
+ client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+ client.ReceiveBufferSize = 50 * 1024;
+ client.SendBufferSize = 50 * 1024;
+ client.ReceiveTimeout = -1;
+ client.SendTimeout = -1;
+ client.Connect("127.0.0.1", 8080);
+ Console.WriteLine("Connected!");
+ Buffer = new byte[1];
+ Buffersize = 0;
+ BufferRecevied = false;
+ MS = new MemoryStream();
+ BeginSend(SendInfo());
+ client.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None, ReadClientData, null);
+ }
+ catch
+ {
+ Thread.Sleep(2500);
+ InitializeClient();
+ }
+ }
+
+ public static byte[] SendInfo()
+ {
+ MsgPack msgpack = new MsgPack();
+ msgpack.ForcePathObject("Packet").AsString = "ClientInfo";
+ msgpack.ForcePathObject("User").AsString = Environment.UserName.ToString();
+ msgpack.ForcePathObject("OS").AsString = new ComputerInfo().OSFullName.ToString();
+ return msgpack.Encode2Bytes();
+
+ }
+
+ public static void ReadClientData(IAsyncResult ar)
+ {
+
+ try
+ {
+ int Recevied = client.EndReceive(ar);
+
+ if (Recevied > 0)
+ {
+
+ if (BufferRecevied == false)
+ {
+ if (Buffer[0] == 0)
+ {
+ Buffersize = Convert.ToInt64(Encoding.UTF8.GetString(MS.ToArray()));
+ MS = new MemoryStream();
+ if (Buffersize > 0)
+ {
+ Buffer = new byte[Buffersize - 1];
+ BufferRecevied = true;
+ }
+ }
+ else
+ {
+
+ MS.Write(Buffer, 0, Buffer.Length);
+ }
+ }
+ else
+ {
+ MS.Write(Buffer, 0, Recevied);
+ if (MS.Length == Buffersize)
+ {
+ Read(MS.ToArray());
+ MS = new MemoryStream();
+ Buffer = new byte[1];
+ Buffersize = 0;
+ BufferRecevied = false;
+ }
+ }
+ }
+ client.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None, ReadClientData, null);
+ }
+ catch
+ {
+ client.Close();
+ client.Dispose();
+ InitializeClient();
+ }
+ }
+
+ public static void Read(byte[] Data)
+ {
+ MsgPack unpack_msgpack = new MsgPack();
+ unpack_msgpack.DecodeFromBytes(Data);
+ Console.WriteLine("I recevied a packet from server: " + unpack_msgpack.ForcePathObject("Packet").AsString);
+ switch (unpack_msgpack.ForcePathObject("Packet").AsString)
+ {
+ case "MessageBox":
+ {
+ Console.WriteLine(unpack_msgpack.ForcePathObject("Message").AsString);
+ }
+ break;
+ }
+
+ }
+
+ public static void BeginSend(byte[] Msgs)
+ {
+ try
+ {
+
+ using (MemoryStream MS = new MemoryStream())
+ {
+ byte[] buffer = Msgs;
+ byte[] buffersize = Encoding.UTF8.GetBytes(buffer.Length.ToString() + Strings.ChrW(0));
+ MS.Write(buffersize, 0, buffersize.Length);
+ MS.Write(buffer, 0, buffer.Length);
+
+ client.Poll(-1, SelectMode.SelectWrite);
+ client.BeginSend(MS.ToArray(), 0, Convert.ToInt32(MS.Length), SocketFlags.None, new AsyncCallback(EndSend), null);
+ }
+ }
+ catch
+ {
+ }
+ }
+
+ public static void EndSend(IAsyncResult ar)
+ {
+ try
+ {
+ client.EndSend(ar);
+ }
+ catch
+ {
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/AsyncRAT-C#/Client/Properties/AssemblyInfo.cs b/AsyncRAT-C#/Client/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..3bcb36a
--- /dev/null
+++ b/AsyncRAT-C#/Client/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Client")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Client")]
+[assembly: AssemblyCopyright("Copyright © 2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("c3c49f45-2589-4e04-9c50-71b6035c14ae")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/README.md b/README.md
index 4014e31..87d0ff0 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,42 @@
-# AsyncRAT-C-Sharp
+
+
+
+# AsyncRAT
+
+***Remote Administration Tool For Windows***
+ ```
+AsyncRAT project is all about learning tcp socket.
+If you found a bug or a better way to code the socket please contact me.
+ ```
+
+
+---
+
+
+## Author
+
+* **NYAN CAT**
+
+
+---
+
+
+
+## Disclaimer
+
+I, the creator, am not responsible for any actions, and or damages, caused by this software.
+
+You bear the full responsibility of your actions and acknowledge that this software was created for educational purposes only.
+
+This software's main purpose is NOT to be used maliciously, or on any system that you do not own, or have the right to use.
+
+By using this software, you automatically agree to the above.
+
+
+---
+
+
+## License
+[](/LICENSE)
+
+This project is licensed under the MIT License - see the [LICENSE](/LICENSE) file for details
\ No newline at end of file