├── NetCoreBuilder ├── Mono.Cecil.dll ├── Confuser.Core.dll ├── App.config ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── Program.cs ├── TypeCheck.cs ├── NetCoreBuilder.csproj ├── Forms │ ├── mainWindow.resx │ ├── mainWindow.cs │ └── mainWindow.Designer.cs └── CecilHeper.cs ├── README.md ├── NetCoreServer ├── App.config ├── Properties │ └── AssemblyInfo.cs ├── NetCoreServer.csproj └── Program.cs ├── NetCoreServer_GUI ├── App.config ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── Funcions │ ├── ExecuteAction.cs │ └── RemoteFunction.cs ├── Program.cs ├── Forms │ ├── formShowString.cs │ ├── formShowString.Designer.cs │ ├── formTestCall.cs │ ├── formTestCall.Designer.cs │ ├── formTestCall.resx │ ├── formShowString.resx │ ├── mainWindow.resx │ ├── mainWindow.cs │ └── mainWindow.Designer.cs ├── Controls │ └── RemoteFunctionListViewItem.cs └── NetCoreServer_GUI.csproj ├── Example ├── NetCore_TExample │ ├── App.config │ ├── Program.cs │ ├── ClassTester.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── NetCore_TExample.csproj └── NetCore_TExampleVB │ ├── App.config │ ├── My Project │ ├── Settings.settings │ ├── Application.Designer.vb │ ├── Application.myapp │ ├── AssemblyInfo.vb │ ├── Resources.Designer.vb │ ├── Settings.Designer.vb │ └── Resources.resx │ ├── Module1.vb │ └── NetCore_TExampleVB.vbproj ├── NetCore ├── Networking │ ├── NetworkHeaders.cs │ └── Hashing.cs ├── Attributes.cs ├── Properties │ └── AssemblyInfo.cs ├── NetCore.csproj └── NetCore.cs ├── .gitattributes ├── NetCore.sln └── .gitignore /NetCoreBuilder/Mono.Cecil.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XenocodeRCE/NetCore/master/NetCoreBuilder/Mono.Cecil.dll -------------------------------------------------------------------------------- /NetCoreBuilder/Confuser.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XenocodeRCE/NetCore/master/NetCoreBuilder/Confuser.Core.dll -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NetCore 2 | より安全なNetCore 3 | 4 | もともとBahNahNahから : https://github.com/BahNahNah/NetCore 5 | 6 | # 私は何をするつもり何 7 | 8 | - 安全な暗号化を追加します。 9 | - 「NetSeal」の実装を追加します。 10 | 11 | 12 | -------------------------------------------------------------------------------- /NetCoreBuilder/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /NetCoreServer/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /NetCoreServer_GUI/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Example/NetCore_TExample/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Example/NetCore_TExampleVB/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /NetCore/Networking/NetworkHeaders.cs: -------------------------------------------------------------------------------- 1 | namespace NetCore.Networking 2 | { 3 | public enum NetworkHeaders : byte 4 | { 5 | Handshake, 6 | AcceptHandshake, 7 | DenyHandShake, 8 | RemoteCall 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /NetCoreBuilder/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /NetCoreServer_GUI/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /NetCoreServer_GUI/Funcions/ExecuteAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace NetCoreServer_GUI.Funcions 8 | { 9 | public enum ExecuteAction 10 | { 11 | Normal, 12 | Disabled 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Example/NetCore_TExampleVB/My Project/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/NetCore_TExampleVB/My Project/Application.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.42000 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | -------------------------------------------------------------------------------- /Example/NetCore_TExampleVB/My Project/Application.myapp: -------------------------------------------------------------------------------- 1 | 2 | 3 | false 4 | false 5 | 0 6 | true 7 | 0 8 | 2 9 | true 10 | 11 | -------------------------------------------------------------------------------- /NetCore/Attributes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace NetCore 4 | { 5 | [AttributeUsage(System.AttributeTargets.Method)] 6 | public class RemoteCallAttribute : Attribute 7 | { 8 | } 9 | 10 | [AttributeUsage(System.AttributeTargets.Method)] 11 | public class RemoteMoveAttribute : Attribute 12 | { 13 | } 14 | 15 | [AttributeUsage(System.AttributeTargets.Method)] 16 | public class RemoteCopyAttribute : Attribute 17 | { 18 | } 19 | 20 | [AttributeUsage(System.AttributeTargets.Class)] 21 | public class ClearFieldsAttribute : Attribute 22 | { 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /Example/NetCore_TExample/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NetCore; 3 | 4 | namespace NetCore_TExample 5 | { 6 | class Program 7 | { 8 | static int Kek = 10; 9 | static void Main(string[] args) 10 | { 11 | if(!NetCoreClient.Connect("127.0.0.1", 3345)) 12 | { 13 | Console.WriteLine("Failed to connect to NetCore server."); 14 | Console.ReadLine(); 15 | return; 16 | } 17 | Console.WriteLine("Hidden value: {0}", ClassTester.ReturnSqlCommand()); 18 | 19 | Console.ReadLine(); 20 | } 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Example/NetCore_TExampleVB/Module1.vb: -------------------------------------------------------------------------------- 1 | Imports System.Data.SqlClient 2 | Imports System.Windows.Forms 3 | Imports NetCore 4 | 5 | Module Module1 6 | 7 | Sub Main() 8 | If Not NetCoreClient.Connect("127.0.0.1", 3345) Then 9 | Console.WriteLine("Failed to connect") 10 | Console.ReadLine() 11 | Return 12 | End If 13 | 14 | Dim dt = returnFun() 15 | Console.WriteLine(dt.TableName) 16 | Console.ReadLine() 17 | End Sub 18 | 19 | 20 | Function returnFun() As DataTable 21 | Return New DataTable("Test1") 22 | End Function 23 | 24 | End Module 25 | -------------------------------------------------------------------------------- /NetCoreBuilder/Program.cs: -------------------------------------------------------------------------------- 1 | using NetCoreBuilder.Forms; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using System.Windows.Forms; 7 | 8 | namespace NetCoreBuilder 9 | { 10 | static class Program 11 | { 12 | /// 13 | /// The main entry point for the application. 14 | /// 15 | [STAThread] 16 | static void Main() 17 | { 18 | Application.EnableVisualStyles(); 19 | Application.SetCompatibleTextRenderingDefault(false); 20 | Application.Run(new mainWindow()); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /NetCoreServer_GUI/Program.cs: -------------------------------------------------------------------------------- 1 | using NetCoreServer_GUI.Forms; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using System.Windows.Forms; 7 | 8 | namespace NetCoreServer_GUI 9 | { 10 | static class Program 11 | { 12 | /// 13 | /// The main entry point for the application. 14 | /// 15 | [STAThread] 16 | static void Main() 17 | { 18 | Application.EnableVisualStyles(); 19 | Application.SetCompatibleTextRenderingDefault(false); 20 | Application.Run(new mainWindow()); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /NetCoreServer_GUI/Forms/formShowString.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace NetCoreServer_GUI.Forms 12 | { 13 | public partial class formShowString : Form 14 | { 15 | public formShowString(string title, object value) 16 | { 17 | InitializeComponent(); 18 | this.Text = title; 19 | rtbData.Text = value.ToString(); 20 | } 21 | 22 | private void formShowString_Load(object sender, EventArgs e) 23 | { 24 | 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /NetCore/Networking/Hashing.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Security.Cryptography; 5 | using System.Text; 6 | 7 | namespace NetCore.Networking 8 | { 9 | public class Hashing 10 | { 11 | public static string SHA(string input) 12 | { 13 | using (SHA256 sha = new SHA256CryptoServiceProvider()) 14 | { 15 | byte[] bPl = Encoding.UTF8.GetBytes(input); 16 | byte[] hash = sha.ComputeHash(bPl); 17 | StringBuilder sb = new StringBuilder(hash.Length * 2); 18 | foreach(byte b in hash) 19 | { 20 | sb.Append(b.ToString("X2")); 21 | } 22 | return sb.ToString(); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /NetCoreServer_GUI/Controls/RemoteFunctionListViewItem.cs: -------------------------------------------------------------------------------- 1 | using NetCoreServer_GUI.Funcions; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Forms; 8 | 9 | namespace NetCoreServer_GUI.Controls 10 | { 11 | public class RemoteFunctionListViewItem : ListViewItem 12 | { 13 | public RemoteFunction Function { get; private set; } 14 | public RemoteFunctionListViewItem(RemoteFunction function) : base(function.Hash) 15 | { 16 | Function = function; 17 | SubItems.Add(function.FullName); 18 | SubItems.Add(function.File); 19 | SubItems.Add(function.ExecuteAction.ToString()); 20 | SubItems.Add(function.ExecuteCount.ToString()); 21 | function.ListViewItem = this; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Example/NetCore_TExample/ClassTester.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | using NetCore; 3 | using System.Windows.Forms; 4 | using System.Data; 5 | using System.Data.SqlClient; 6 | using System; 7 | 8 | namespace NetCore_TExample 9 | { 10 | public class ClassTester 11 | { 12 | static string HiddenField = "Nice meme."; 13 | 14 | [RemoteCall] 15 | public static string ReturnSqlCommand() 16 | { 17 | SqlCommand command = new SqlCommand(); 18 | return check2(command); 19 | } 20 | 21 | [RemoteMove] 22 | public static string check2(SqlCommand sq) 23 | { 24 | SqlDataReader reader = null; 25 | return "Strange."; 26 | } 27 | 28 | [RemoteCall] 29 | public static string ThrowError() 30 | { 31 | throw new Exception("This is an exception being thrown"); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /NetCoreBuilder/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace NetCoreBuilder.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /NetCoreServer_GUI/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace NetCoreServer_GUI.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Example/NetCore_TExampleVB/My Project/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System 2 | Imports System.Reflection 3 | Imports System.Runtime.InteropServices 4 | 5 | ' General Information about an assembly is controlled through the following 6 | ' set of attributes. Change these attribute values to modify the information 7 | ' associated with an assembly. 8 | 9 | ' Review the values of the assembly attributes 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM 21 | 22 | 23 | ' Version information for an assembly consists of the following four values: 24 | ' 25 | ' Major Version 26 | ' Minor Version 27 | ' Build Number 28 | ' Revision 29 | ' 30 | ' You can specify all the values or you can default the Build and Revision Numbers 31 | ' by using the '*' as shown below: 32 | ' 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /NetCore/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("NetCore")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("NetCore")] 13 | [assembly: AssemblyCopyright("Copyright © BahNahNah 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("6c622e5f-02ad-4666-acab-86ec4a92516a")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.4")] 36 | [assembly: AssemblyFileVersion("1.0.0.4")] 37 | -------------------------------------------------------------------------------- /NetCoreServer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("NetCoreServer")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("NetCoreServer")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("c144265f-038a-4fde-8524-8438fd5106a6")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.4")] 36 | [assembly: AssemblyFileVersion("1.0.0.4")] 37 | -------------------------------------------------------------------------------- /NetCoreBuilder/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("NetCoreBuilder")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("NetCoreBuilder")] 13 | [assembly: AssemblyCopyright("Copyright © BahNahNah 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("6897bac7-2c19-43d4-8239-4041ae61dfb0")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.4")] 36 | [assembly: AssemblyFileVersion("1.0.0.4")] 37 | -------------------------------------------------------------------------------- /NetCoreServer_GUI/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("NetCoreServer_GUI")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("NetCoreServer_GUI")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("1d7a6d6e-d94d-4585-8f7a-e104434d1a80")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Example/NetCore_TExample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("NetCore_TExample")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("NetCore_TExample")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f07e12a2-05e6-411f-ac82-bcf10ff591c7")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /NetCoreBuilder/TypeCheck.cs: -------------------------------------------------------------------------------- 1 | using Mono.Cecil; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace NetCoreBuilder 9 | { 10 | public class TypeCheck 11 | { 12 | public static bool KeepMethod(TypeDefinition type, MethodDefinition method, out TransportAction visibility) 13 | { 14 | bool hasAttribute = false; 15 | TransportAction vis = TransportAction.Public; 16 | 17 | 18 | if (method.Name == ".cctor") 19 | { 20 | hasAttribute = true; 21 | vis = TransportAction.Copy; 22 | 23 | foreach (var i in type.CustomAttributes) 24 | { 25 | if (i.AttributeType.FullName == "NetCore.ClearFieldsAttribute") 26 | { 27 | vis = TransportAction.MoveClear; 28 | break; 29 | } 30 | } 31 | 32 | } 33 | else 34 | { 35 | foreach (var i in method.CustomAttributes) 36 | { 37 | if (i.AttributeType.FullName == "NetCore.RemoteCallAttribute") 38 | { 39 | hasAttribute = true; 40 | break; 41 | } 42 | if (i.AttributeType.FullName == "NetCore.RemoteMoveAttribute") 43 | { 44 | hasAttribute = true; 45 | vis = TransportAction.Move; 46 | break; 47 | } 48 | if (i.AttributeType.FullName == "NetCore.RemoteCopyAttribute") 49 | { 50 | hasAttribute = true; 51 | vis = TransportAction.Copy; 52 | break; 53 | } 54 | } 55 | } 56 | visibility = vis; 57 | return hasAttribute; 58 | 59 | } 60 | } 61 | 62 | public enum TransportAction 63 | { 64 | Public, 65 | Copy, 66 | Move, 67 | MoveClear 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /NetCoreServer_GUI/Forms/formShowString.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace NetCoreServer_GUI.Forms 2 | { 3 | partial class formShowString 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.rtbData = new System.Windows.Forms.RichTextBox(); 32 | this.SuspendLayout(); 33 | // 34 | // rtbData 35 | // 36 | this.rtbData.Dock = System.Windows.Forms.DockStyle.Fill; 37 | this.rtbData.Location = new System.Drawing.Point(0, 0); 38 | this.rtbData.Name = "rtbData"; 39 | this.rtbData.ReadOnly = true; 40 | this.rtbData.Size = new System.Drawing.Size(503, 220); 41 | this.rtbData.TabIndex = 0; 42 | this.rtbData.Text = ""; 43 | // 44 | // formShowString 45 | // 46 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 47 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 48 | this.ClientSize = new System.Drawing.Size(503, 220); 49 | this.Controls.Add(this.rtbData); 50 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; 51 | this.Name = "formShowString"; 52 | this.Text = "--"; 53 | this.Load += new System.EventHandler(this.formShowString_Load); 54 | this.ResumeLayout(false); 55 | 56 | } 57 | 58 | #endregion 59 | 60 | private System.Windows.Forms.RichTextBox rtbData; 61 | } 62 | } -------------------------------------------------------------------------------- /NetCoreServer_GUI/Funcions/RemoteFunction.cs: -------------------------------------------------------------------------------- 1 | using NetCore.Networking; 2 | using NetCoreServer_GUI.Controls; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Linq; 7 | using System.Reflection; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | 12 | namespace NetCoreServer_GUI.Funcions 13 | { 14 | public class RemoteFunction : IDisposable 15 | { 16 | public RemoteFunctionListViewItem ListViewItem { get; set; } 17 | public MethodInfo Method { get; private set; } 18 | public ExecuteAction ExecuteAction 19 | { 20 | get { return _ExecuteAction; } 21 | set 22 | { 23 | _ExecuteAction = value; 24 | UpdateListView(); 25 | } 26 | } 27 | public string FullName { get; private set; } 28 | public string Hash { get; private set; } 29 | public string File { get; private set; } 30 | public long ExecuteCount 31 | { 32 | get { return _ExecuteCount; } 33 | set 34 | { 35 | _ExecuteCount = value; 36 | UpdateListView(); 37 | } 38 | } 39 | private Type ParentType; 40 | private Assembly loadedAssembly; 41 | private ExecuteAction _ExecuteAction; 42 | private long _ExecuteCount; 43 | private Control _invoke; 44 | 45 | public RemoteFunction(Assembly asm, Type t, MethodInfo mi, Control invokeItem) 46 | { 47 | _invoke = invokeItem; 48 | loadedAssembly = asm; 49 | ParentType = t; 50 | Method = mi; 51 | 52 | File = Path.GetFileName(loadedAssembly.Location); 53 | 54 | ExecuteAction = ExecuteAction.Normal; 55 | FullName = string.Format("{0}.{1}", ParentType.FullName, Method.Name); 56 | Hash = Hashing.SHA(FullName); 57 | } 58 | 59 | public object Execute(object[] args) 60 | { 61 | if (ExecuteAction == ExecuteAction.Disabled) 62 | return null; 63 | ExecuteCount++; 64 | return Method.Invoke(null, args); 65 | } 66 | 67 | 68 | private void UpdateListView() 69 | { 70 | if (ListViewItem == null) 71 | return; 72 | _invoke.Invoke(new MethodInvoker(() => 73 | { 74 | ListViewItem.SubItems[3].Text = _ExecuteAction.ToString(); 75 | ListViewItem.SubItems[4].Text = _ExecuteCount.ToString(); 76 | })); 77 | } 78 | 79 | public void Dispose() 80 | { 81 | 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /NetCore/NetCore.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {6C622E5F-02AD-4666-ACAB-86EC4A92516A} 8 | Library 9 | Properties 10 | NetCore 11 | NetCore 12 | v3.5 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 57 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /NetCore/NetCore.cs: -------------------------------------------------------------------------------- 1 | using NetCore.Networking; 2 | using System; 3 | 4 | namespace NetCore 5 | { 6 | public static class NetCoreClient 7 | { 8 | private static eSock.Client _client = null; 9 | 10 | public static bool Connect(string ip, int port) 11 | { 12 | _client = new eSock.Client(); 13 | if (!_client.Connect(ip, port)) 14 | return false; 15 | 16 | try 17 | { 18 | object[] data = _client.Send((byte)NetworkHeaders.Handshake); 19 | if ((NetworkHeaders)data[0] != NetworkHeaders.AcceptHandshake) 20 | return false; 21 | string encryptionKey = (string)data[1]; 22 | 23 | _client.Encryption.EncryptionKey = encryptionKey; 24 | _client.Encryption.Enabled = true; 25 | return true; 26 | } 27 | catch 28 | { 29 | return false; 30 | } 31 | } 32 | public static bool ConnectWithProxy(string proxyIP, int proxyPort, string targetIp, int targetPort, string username="", string password="") 33 | { 34 | _client = new eSock.Client(); 35 | if (!_client.ConnectProxy(proxyIP, proxyPort, targetIp, targetPort, username, password)) 36 | return false; 37 | try 38 | { 39 | object[] data = _client.Send((byte)NetworkHeaders.Handshake); 40 | if ((NetworkHeaders)data[0] != NetworkHeaders.AcceptHandshake) 41 | return false; 42 | string encryptionKey = (string)data[1]; 43 | 44 | _client.Encryption.EncryptionKey = encryptionKey; 45 | _client.Encryption.Enabled = true; 46 | return true; 47 | } 48 | catch 49 | { 50 | return false; 51 | } 52 | } 53 | 54 | public static object CreateRemoteCall(string function, object[] args) 55 | { 56 | if (_client == null) 57 | { 58 | Console.WriteLine("[NetCore] Attempted RemoteCall with null client"); 59 | return null; 60 | } 61 | 62 | if (!_client.Connected) 63 | { 64 | Console.WriteLine("[NetCore] Attempted RemoteCall without connection"); 65 | return null; 66 | } 67 | 68 | try 69 | { 70 | object[] derp = _client.Send((byte)NetworkHeaders.RemoteCall, function, args); 71 | return derp[0]; 72 | } 73 | catch (Exception ex) 74 | { 75 | Console.WriteLine(ex.ToString()); 76 | } 77 | 78 | return null; 79 | } 80 | } 81 | } -------------------------------------------------------------------------------- /NetCoreServer_GUI/Forms/formTestCall.cs: -------------------------------------------------------------------------------- 1 | using NetCoreServer_GUI.Funcions; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Data; 6 | using System.Diagnostics; 7 | using System.Drawing; 8 | using System.Linq; 9 | using System.Reflection; 10 | using System.Text; 11 | using System.Threading.Tasks; 12 | using System.Windows.Forms; 13 | 14 | namespace NetCoreServer_GUI.Forms 15 | { 16 | public partial class formTestCall : Form 17 | { 18 | public formTestCall(RemoteFunction[] functions) 19 | { 20 | InitializeComponent(); 21 | 22 | Stopwatch execTimer = new Stopwatch(); 23 | foreach(RemoteFunction f in functions) 24 | { 25 | ListViewItem i = new ListViewItem(f.Hash); 26 | try 27 | { 28 | ParameterInfo[] paramInfo = f.Method.GetParameters(); 29 | List paramiters = new List(); 30 | 31 | foreach(ParameterInfo p in paramInfo) 32 | { 33 | paramiters.Add(p.DefaultValue); 34 | } 35 | 36 | execTimer.Start(); 37 | object result = f.Method.Invoke(null, paramiters.ToArray()); 38 | execTimer.Stop(); 39 | 40 | i.SubItems.Add("False"); 41 | i.SubItems.Add(result == null ? "Null" : result.ToString()); 42 | i.SubItems.Add(result.GetType().ToString()); 43 | } 44 | catch(Exception ex) 45 | { 46 | Exception innerEx = ex.InnerException; 47 | execTimer.Stop(); 48 | i.SubItems.Add("True"); 49 | i.SubItems.Add(innerEx.Message); 50 | i.SubItems.Add(innerEx.GetType().ToString()); 51 | i.Tag = innerEx; 52 | } 53 | finally 54 | { 55 | i.SubItems.Add(execTimer.ElapsedMilliseconds.ToString()); 56 | execTimer.Reset(); 57 | lvTestResults.Items.Add(i); 58 | } 59 | } 60 | } 61 | 62 | private void formTestCall_Load(object sender, EventArgs e) 63 | { 64 | 65 | } 66 | 67 | private void lvTestResults_MouseDoubleClick(object sender, MouseEventArgs e) 68 | { 69 | if (lvTestResults.SelectedItems.Count < 1) 70 | return; 71 | ListViewItem i = lvTestResults.SelectedItems[0]; 72 | if (i.Tag is Exception) 73 | { 74 | using (formShowString exShow = new formShowString("Exception", i.Tag)) 75 | { 76 | exShow.ShowDialog(); 77 | } 78 | } 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /NetCoreServer/NetCoreServer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {C144265F-038A-4FDE-8524-8438FD5106A6} 8 | Exe 9 | Properties 10 | NetCoreServer 11 | NetCoreServer 12 | v4.5.2 13 | 512 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | ..\NetCore\bin\Debug\NetCore.dll 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 63 | -------------------------------------------------------------------------------- /Example/NetCore_TExampleVB/My Project/Resources.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.42000 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | 15 | Namespace My.Resources 16 | 17 | 'This class was auto-generated by the StronglyTypedResourceBuilder 18 | 'class via a tool like ResGen or Visual Studio. 19 | 'To add or remove a member, edit your .ResX file then rerun ResGen 20 | 'with the /str option, or rebuild your VS project. 21 | ''' 22 | ''' A strongly-typed resource class, for looking up localized strings, etc. 23 | ''' 24 | _ 28 | Friend Module Resources 29 | 30 | Private resourceMan As Global.System.Resources.ResourceManager 31 | 32 | Private resourceCulture As Global.System.Globalization.CultureInfo 33 | 34 | ''' 35 | ''' Returns the cached ResourceManager instance used by this class. 36 | ''' 37 | _ 38 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager 39 | Get 40 | If Object.ReferenceEquals(resourceMan, Nothing) Then 41 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("NetCore_TExampleVB.Resources", GetType(Resources).Assembly) 42 | resourceMan = temp 43 | End If 44 | Return resourceMan 45 | End Get 46 | End Property 47 | 48 | ''' 49 | ''' Overrides the current thread's CurrentUICulture property for all 50 | ''' resource lookups using this strongly typed resource class. 51 | ''' 52 | _ 53 | Friend Property Culture() As Global.System.Globalization.CultureInfo 54 | Get 55 | Return resourceCulture 56 | End Get 57 | Set(ByVal value As Global.System.Globalization.CultureInfo) 58 | resourceCulture = value 59 | End Set 60 | End Property 61 | End Module 62 | End Namespace 63 | -------------------------------------------------------------------------------- /NetCoreBuilder/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace NetCoreBuilder.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NetCoreBuilder.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /NetCoreServer_GUI/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace NetCoreServer_GUI.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NetCoreServer_GUI.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Example/NetCore_TExample/NetCore_TExample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {F07E12A2-05E6-411F-AC82-BCF10FF591C7} 8 | Exe 9 | Properties 10 | NetCore_TExample 11 | NetCore_TExample 12 | v4.5.2 13 | 512 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | False 38 | ..\..\NetCore\bin\Debug\NetCore.dll 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 66 | -------------------------------------------------------------------------------- /Example/NetCore_TExampleVB/My Project/Settings.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.42000 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | 15 | Namespace My 16 | 17 | _ 20 | Partial Friend NotInheritable Class MySettings 21 | Inherits Global.System.Configuration.ApplicationSettingsBase 22 | 23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) 24 | 25 | #Region "My.Settings Auto-Save Functionality" 26 | #If _MyType = "WindowsForms" Then 27 | Private Shared addedHandler As Boolean 28 | 29 | Private Shared addedHandlerLockObject As New Object 30 | 31 | _ 32 | Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) 33 | If My.Application.SaveMySettingsOnExit Then 34 | My.Settings.Save() 35 | End If 36 | End Sub 37 | #End If 38 | #End Region 39 | 40 | Public Shared ReadOnly Property [Default]() As MySettings 41 | Get 42 | 43 | #If _MyType = "WindowsForms" Then 44 | If Not addedHandler Then 45 | SyncLock addedHandlerLockObject 46 | If Not addedHandler Then 47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings 48 | addedHandler = True 49 | End If 50 | End SyncLock 51 | End If 52 | #End If 53 | Return defaultInstance 54 | End Get 55 | End Property 56 | End Class 57 | End Namespace 58 | 59 | Namespace My 60 | 61 | _ 64 | Friend Module MySettingsProperty 65 | 66 | _ 67 | Friend ReadOnly Property Settings() As Global.NetCore_TExampleVB.My.MySettings 68 | Get 69 | Return Global.NetCore_TExampleVB.My.MySettings.Default 70 | End Get 71 | End Property 72 | End Module 73 | End Namespace 74 | -------------------------------------------------------------------------------- /NetCore.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetCore", "NetCore\NetCore.csproj", "{6C622E5F-02AD-4666-ACAB-86EC4A92516A}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Example", "Example", "{7E4139BD-0983-4D47-A456-FFE585056E51}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetCoreBuilder", "NetCoreBuilder\NetCoreBuilder.csproj", "{6897BAC7-2C19-43D4-8239-4041AE61DFB0}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetCore_TExample", "Example\NetCore_TExample\NetCore_TExample.csproj", "{F07E12A2-05E6-411F-AC82-BCF10FF591C7}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetCoreServer", "NetCoreServer\NetCoreServer.csproj", "{C144265F-038A-4FDE-8524-8438FD5106A6}" 15 | EndProject 16 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "NetCore_TExampleVB", "Example\NetCore_TExampleVB\NetCore_TExampleVB.vbproj", "{49A344FF-B8E5-437A-88EA-4A5B4C1D3EC6}" 17 | EndProject 18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetCoreServer_GUI", "NetCoreServer_GUI\NetCoreServer_GUI.csproj", "{1D7A6D6E-D94D-4585-8F7A-E104434D1A80}" 19 | EndProject 20 | Global 21 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 22 | Debug|Any CPU = Debug|Any CPU 23 | Release|Any CPU = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 26 | {6C622E5F-02AD-4666-ACAB-86EC4A92516A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {6C622E5F-02AD-4666-ACAB-86EC4A92516A}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {6C622E5F-02AD-4666-ACAB-86EC4A92516A}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {6C622E5F-02AD-4666-ACAB-86EC4A92516A}.Release|Any CPU.Build.0 = Release|Any CPU 30 | {6897BAC7-2C19-43D4-8239-4041AE61DFB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 31 | {6897BAC7-2C19-43D4-8239-4041AE61DFB0}.Debug|Any CPU.Build.0 = Debug|Any CPU 32 | {6897BAC7-2C19-43D4-8239-4041AE61DFB0}.Release|Any CPU.ActiveCfg = Release|Any CPU 33 | {6897BAC7-2C19-43D4-8239-4041AE61DFB0}.Release|Any CPU.Build.0 = Release|Any CPU 34 | {F07E12A2-05E6-411F-AC82-BCF10FF591C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 35 | {F07E12A2-05E6-411F-AC82-BCF10FF591C7}.Debug|Any CPU.Build.0 = Debug|Any CPU 36 | {F07E12A2-05E6-411F-AC82-BCF10FF591C7}.Release|Any CPU.ActiveCfg = Release|Any CPU 37 | {F07E12A2-05E6-411F-AC82-BCF10FF591C7}.Release|Any CPU.Build.0 = Release|Any CPU 38 | {C144265F-038A-4FDE-8524-8438FD5106A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 39 | {C144265F-038A-4FDE-8524-8438FD5106A6}.Debug|Any CPU.Build.0 = Debug|Any CPU 40 | {C144265F-038A-4FDE-8524-8438FD5106A6}.Release|Any CPU.ActiveCfg = Release|Any CPU 41 | {C144265F-038A-4FDE-8524-8438FD5106A6}.Release|Any CPU.Build.0 = Release|Any CPU 42 | {49A344FF-B8E5-437A-88EA-4A5B4C1D3EC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 43 | {49A344FF-B8E5-437A-88EA-4A5B4C1D3EC6}.Debug|Any CPU.Build.0 = Debug|Any CPU 44 | {49A344FF-B8E5-437A-88EA-4A5B4C1D3EC6}.Release|Any CPU.ActiveCfg = Release|Any CPU 45 | {49A344FF-B8E5-437A-88EA-4A5B4C1D3EC6}.Release|Any CPU.Build.0 = Release|Any CPU 46 | {1D7A6D6E-D94D-4585-8F7A-E104434D1A80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 47 | {1D7A6D6E-D94D-4585-8F7A-E104434D1A80}.Debug|Any CPU.Build.0 = Debug|Any CPU 48 | {1D7A6D6E-D94D-4585-8F7A-E104434D1A80}.Release|Any CPU.ActiveCfg = Release|Any CPU 49 | {1D7A6D6E-D94D-4585-8F7A-E104434D1A80}.Release|Any CPU.Build.0 = Release|Any CPU 50 | EndGlobalSection 51 | GlobalSection(SolutionProperties) = preSolution 52 | HideSolutionNode = FALSE 53 | EndGlobalSection 54 | GlobalSection(NestedProjects) = preSolution 55 | {F07E12A2-05E6-411F-AC82-BCF10FF591C7} = {7E4139BD-0983-4D47-A456-FFE585056E51} 56 | {49A344FF-B8E5-437A-88EA-4A5B4C1D3EC6} = {7E4139BD-0983-4D47-A456-FFE585056E51} 57 | EndGlobalSection 58 | EndGlobal 59 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | # DNX 42 | project.lock.json 43 | artifacts/ 44 | 45 | *_i.c 46 | *_p.c 47 | *_i.h 48 | *.ilk 49 | *.meta 50 | *.obj 51 | *.pch 52 | *.pdb 53 | *.pgc 54 | *.pgd 55 | *.rsp 56 | *.sbr 57 | *.tlb 58 | *.tli 59 | *.tlh 60 | *.tmp 61 | *.tmp_proj 62 | *.log 63 | *.vspscc 64 | *.vssscc 65 | .builds 66 | *.pidb 67 | *.svclog 68 | *.scc 69 | 70 | # Chutzpah Test files 71 | _Chutzpah* 72 | 73 | # Visual C++ cache files 74 | ipch/ 75 | *.aps 76 | *.ncb 77 | *.opensdf 78 | *.sdf 79 | *.cachefile 80 | 81 | # Visual Studio profiler 82 | *.psess 83 | *.vsp 84 | *.vspx 85 | 86 | # TFS 2012 Local Workspace 87 | $tf/ 88 | 89 | # Guidance Automation Toolkit 90 | *.gpState 91 | 92 | # ReSharper is a .NET coding add-in 93 | _ReSharper*/ 94 | *.[Rr]e[Ss]harper 95 | *.DotSettings.user 96 | 97 | # JustCode is a .NET coding add-in 98 | .JustCode 99 | 100 | # TeamCity is a build add-in 101 | _TeamCity* 102 | 103 | # DotCover is a Code Coverage Tool 104 | *.dotCover 105 | 106 | # NCrunch 107 | _NCrunch_* 108 | .*crunch*.local.xml 109 | 110 | # MightyMoose 111 | *.mm.* 112 | AutoTest.Net/ 113 | 114 | # Web workbench (sass) 115 | .sass-cache/ 116 | 117 | # Installshield output folder 118 | [Ee]xpress/ 119 | 120 | # DocProject is a documentation generator add-in 121 | DocProject/buildhelp/ 122 | DocProject/Help/*.HxT 123 | DocProject/Help/*.HxC 124 | DocProject/Help/*.hhc 125 | DocProject/Help/*.hhk 126 | DocProject/Help/*.hhp 127 | DocProject/Help/Html2 128 | DocProject/Help/html 129 | 130 | # Click-Once directory 131 | publish/ 132 | 133 | # Publish Web Output 134 | *.[Pp]ublish.xml 135 | *.azurePubxml 136 | ## TODO: Comment the next line if you want to checkin your 137 | ## web deploy settings but do note that will include unencrypted 138 | ## passwords 139 | #*.pubxml 140 | 141 | *.publishproj 142 | 143 | # NuGet Packages 144 | *.nupkg 145 | # The packages folder can be ignored because of Package Restore 146 | **/packages/* 147 | # except build/, which is used as an MSBuild target. 148 | !**/packages/build/ 149 | # Uncomment if necessary however generally it will be regenerated when needed 150 | #!**/packages/repositories.config 151 | 152 | # Windows Azure Build Output 153 | csx/ 154 | *.build.csdef 155 | 156 | # Windows Store app package directory 157 | AppPackages/ 158 | 159 | # Visual Studio cache files 160 | # files ending in .cache can be ignored 161 | *.[Cc]ache 162 | # but keep track of directories ending in .cache 163 | !*.[Cc]ache/ 164 | 165 | # Others 166 | ClientBin/ 167 | [Ss]tyle[Cc]op.* 168 | ~$* 169 | *~ 170 | *.dbmdl 171 | *.dbproj.schemaview 172 | *.pfx 173 | *.publishsettings 174 | node_modules/ 175 | orleans.codegen.cs 176 | 177 | # RIA/Silverlight projects 178 | Generated_Code/ 179 | 180 | # Backup & report files from converting an old project file 181 | # to a newer Visual Studio version. Backup files are not needed, 182 | # because we have git ;-) 183 | _UpgradeReport_Files/ 184 | Backup*/ 185 | UpgradeLog*.XML 186 | UpgradeLog*.htm 187 | 188 | # SQL Server files 189 | *.mdf 190 | *.ldf 191 | 192 | # Business Intelligence projects 193 | *.rdl.data 194 | *.bim.layout 195 | *.bim_*.settings 196 | 197 | # Microsoft Fakes 198 | FakesAssemblies/ 199 | 200 | # Node.js Tools for Visual Studio 201 | .ntvs_analysis.dat 202 | 203 | # Visual Studio 6 build log 204 | *.plg 205 | 206 | # Visual Studio 6 workspace options file 207 | *.opt 208 | 209 | # LightSwitch generated files 210 | GeneratedArtifacts/ 211 | _Pvt_Extensions/ 212 | ModelManifest.xml 213 | -------------------------------------------------------------------------------- /NetCoreBuilder/NetCoreBuilder.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {6897BAC7-2C19-43D4-8239-4041AE61DFB0} 8 | WinExe 9 | Properties 10 | NetCoreBuilder 11 | NetCoreBuilder 12 | v4.5.2 13 | 512 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | False 38 | .\Mono.Cecil.dll 39 | 40 | 41 | False 42 | ..\NetCore\bin\Debug\NetCore.dll 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | Form 60 | 61 | 62 | mainWindow.cs 63 | 64 | 65 | 66 | 67 | 68 | mainWindow.cs 69 | 70 | 71 | ResXFileCodeGenerator 72 | Resources.Designer.cs 73 | Designer 74 | 75 | 76 | True 77 | Resources.resx 78 | 79 | 80 | SettingsSingleFileGenerator 81 | Settings.Designer.cs 82 | 83 | 84 | True 85 | Settings.settings 86 | True 87 | 88 | 89 | 90 | 91 | 92 | 93 | 100 | -------------------------------------------------------------------------------- /NetCoreServer_GUI/Forms/formTestCall.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace NetCoreServer_GUI.Forms 2 | { 3 | partial class formTestCall 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.lvTestResults = new System.Windows.Forms.ListView(); 32 | this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 33 | this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 34 | this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 35 | this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 36 | this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 37 | this.SuspendLayout(); 38 | // 39 | // lvTestResults 40 | // 41 | this.lvTestResults.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 42 | this.columnHeader1, 43 | this.columnHeader2, 44 | this.columnHeader3, 45 | this.columnHeader4, 46 | this.columnHeader5}); 47 | this.lvTestResults.Dock = System.Windows.Forms.DockStyle.Fill; 48 | this.lvTestResults.FullRowSelect = true; 49 | this.lvTestResults.GridLines = true; 50 | this.lvTestResults.Location = new System.Drawing.Point(0, 0); 51 | this.lvTestResults.MultiSelect = false; 52 | this.lvTestResults.Name = "lvTestResults"; 53 | this.lvTestResults.Size = new System.Drawing.Size(550, 254); 54 | this.lvTestResults.TabIndex = 0; 55 | this.lvTestResults.UseCompatibleStateImageBehavior = false; 56 | this.lvTestResults.View = System.Windows.Forms.View.Details; 57 | this.lvTestResults.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.lvTestResults_MouseDoubleClick); 58 | // 59 | // columnHeader1 60 | // 61 | this.columnHeader1.Text = "Function Hash"; 62 | this.columnHeader1.Width = 149; 63 | // 64 | // columnHeader2 65 | // 66 | this.columnHeader2.Text = "Exception Thrown"; 67 | this.columnHeader2.Width = 103; 68 | // 69 | // columnHeader3 70 | // 71 | this.columnHeader3.Text = "Result"; 72 | this.columnHeader3.Width = 97; 73 | // 74 | // columnHeader4 75 | // 76 | this.columnHeader4.Text = "Result Type"; 77 | this.columnHeader4.Width = 99; 78 | // 79 | // columnHeader5 80 | // 81 | this.columnHeader5.Text = "Execution Time (MS)"; 82 | this.columnHeader5.Width = 93; 83 | // 84 | // formTestCall 85 | // 86 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 87 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 88 | this.ClientSize = new System.Drawing.Size(550, 254); 89 | this.Controls.Add(this.lvTestResults); 90 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; 91 | this.Name = "formTestCall"; 92 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 93 | this.Text = "Test Call"; 94 | this.Load += new System.EventHandler(this.formTestCall_Load); 95 | this.ResumeLayout(false); 96 | 97 | } 98 | 99 | #endregion 100 | 101 | private System.Windows.Forms.ListView lvTestResults; 102 | private System.Windows.Forms.ColumnHeader columnHeader1; 103 | private System.Windows.Forms.ColumnHeader columnHeader2; 104 | private System.Windows.Forms.ColumnHeader columnHeader3; 105 | private System.Windows.Forms.ColumnHeader columnHeader4; 106 | private System.Windows.Forms.ColumnHeader columnHeader5; 107 | } 108 | } -------------------------------------------------------------------------------- /NetCoreServer_GUI/NetCoreServer_GUI.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {1D7A6D6E-D94D-4585-8F7A-E104434D1A80} 8 | WinExe 9 | Properties 10 | NetCoreServer_GUI 11 | NetCoreServer_GUI 12 | v4.5.2 13 | 512 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | ..\NetCore\bin\Debug\NetCore.dll 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | Form 55 | 56 | 57 | formShowString.cs 58 | 59 | 60 | Form 61 | 62 | 63 | formTestCall.cs 64 | 65 | 66 | Form 67 | 68 | 69 | mainWindow.cs 70 | 71 | 72 | 73 | 74 | 75 | 76 | formShowString.cs 77 | 78 | 79 | formTestCall.cs 80 | 81 | 82 | mainWindow.cs 83 | 84 | 85 | ResXFileCodeGenerator 86 | Resources.Designer.cs 87 | Designer 88 | 89 | 90 | True 91 | Resources.resx 92 | 93 | 94 | SettingsSingleFileGenerator 95 | Settings.Designer.cs 96 | 97 | 98 | True 99 | Settings.settings 100 | True 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 115 | -------------------------------------------------------------------------------- /Example/NetCore_TExampleVB/NetCore_TExampleVB.vbproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {49A344FF-B8E5-437A-88EA-4A5B4C1D3EC6} 8 | Exe 9 | NetCore_TExampleVB.Module1 10 | NetCore_TExampleVB 11 | NetCore_TExampleVB 12 | 512 13 | Console 14 | v4.5.2 15 | true 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | true 22 | true 23 | bin\Debug\ 24 | NetCore_TExampleVB.xml 25 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 26 | false 27 | 28 | 29 | AnyCPU 30 | pdbonly 31 | false 32 | true 33 | true 34 | bin\Release\ 35 | NetCore_TExampleVB.xml 36 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 37 | 38 | 39 | On 40 | 41 | 42 | Text 43 | 44 | 45 | Off 46 | 47 | 48 | On 49 | 50 | 51 | 52 | ..\..\NetCore\bin\Debug\NetCore.dll 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | True 80 | Application.myapp 81 | 82 | 83 | True 84 | True 85 | Resources.resx 86 | 87 | 88 | True 89 | Settings.settings 90 | True 91 | 92 | 93 | 94 | 95 | VbMyResourcesResXFileCodeGenerator 96 | Resources.Designer.vb 97 | My.Resources 98 | Designer 99 | 100 | 101 | 102 | 103 | MyApplicationCodeGenerator 104 | Application.Designer.vb 105 | 106 | 107 | SettingsSingleFileGenerator 108 | My 109 | Settings.Designer.vb 110 | 111 | 112 | 113 | 114 | 121 | -------------------------------------------------------------------------------- /NetCoreBuilder/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /NetCoreServer_GUI/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Example/NetCore_TExampleVB/My Project/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /NetCoreBuilder/Forms/mainWindow.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /NetCoreServer_GUI/Forms/formTestCall.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /NetCoreServer_GUI/Forms/formShowString.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /NetCoreServer_GUI/Forms/mainWindow.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | -------------------------------------------------------------------------------- /NetCoreServer_GUI/Forms/mainWindow.cs: -------------------------------------------------------------------------------- 1 | using NetCore; 2 | using NetCore.Networking; 3 | using NetCoreServer_GUI.Controls; 4 | using NetCoreServer_GUI.Funcions; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.ComponentModel; 8 | using System.Data; 9 | using System.Drawing; 10 | using System.IO; 11 | using System.Linq; 12 | using System.Reflection; 13 | using System.Text; 14 | using System.Threading.Tasks; 15 | using System.Windows.Forms; 16 | 17 | namespace NetCoreServer_GUI.Forms 18 | { 19 | public partial class mainWindow : Form 20 | { 21 | Dictionary LoadedFunctions = new Dictionary(); 22 | eSock.Server _server; 23 | public mainWindow() 24 | { 25 | InitializeComponent(); 26 | } 27 | 28 | private void mainWindow_Load(object sender, EventArgs e) 29 | { 30 | this.Text += string.Format(" {0}", Application.ProductVersion); 31 | LoadModules(); 32 | } 33 | 34 | 35 | private void LoadModules() 36 | { 37 | DirectoryInfo di = new DirectoryInfo("Modules"); 38 | if (!di.Exists) 39 | di.Create(); 40 | foreach (FileInfo fi in di.GetFiles("*.ncm")) 41 | { 42 | try 43 | { 44 | Assembly asm = Assembly.LoadFile(fi.FullName); 45 | foreach (Type t in asm.GetTypes()) 46 | { 47 | 48 | foreach (MethodInfo mi in t.GetMethods()) 49 | { 50 | if (!Attribute.IsDefined(mi, typeof(RemoteCallAttribute))) 51 | continue; 52 | RemoteFunction function = new RemoteFunction(asm, t, mi, lvFunctions); 53 | if (LoadedFunctions.ContainsKey(function.Hash)) 54 | { 55 | function.Dispose(); 56 | } 57 | else 58 | { 59 | LoadedFunctions.Add(function.Hash, function); 60 | lvFunctions.Items.Add(new RemoteFunctionListViewItem(function)); 61 | } 62 | } 63 | } 64 | } 65 | catch (Exception ex) 66 | { 67 | LogError(ex); 68 | } 69 | } 70 | } 71 | 72 | private void LogError(Exception ex) 73 | { 74 | if (lvFunctions.InvokeRequired) 75 | { 76 | lvFunctions.Invoke(new MethodInvoker(() => 77 | { 78 | lvFunctions.Items.Add(new ListViewItem(ex.Message)); 79 | })); 80 | 81 | } 82 | else 83 | { 84 | lvFunctions.Items.Add(new ListViewItem(ex.Message)); 85 | } 86 | } 87 | 88 | private void btnStart_Click(object sender, EventArgs e) 89 | { 90 | _server = new eSock.Server(); 91 | 92 | _server.OnDataRetrieved += _server_OnDataRetrieved; 93 | 94 | if (!_server.Start((int)nudPort.Value)) 95 | { 96 | MessageBox.Show("Failed to start."); 97 | return; 98 | } 99 | 100 | btnStart.Enabled = false; 101 | nudPort.Enabled = false; 102 | } 103 | 104 | private void _server_OnDataRetrieved(eSock.Server sender, eSock.Server.eSockClient client, object[] data) 105 | { 106 | try 107 | { 108 | NetworkHeaders header = (NetworkHeaders)data[0]; 109 | 110 | if (header == NetworkHeaders.Handshake) 111 | { 112 | string key = Guid.NewGuid().ToString(); 113 | client.Send((byte)NetworkHeaders.AcceptHandshake, key); 114 | client.Encryption.EncryptionKey = key; 115 | client.Encryption.Enabled = true; 116 | return; 117 | } 118 | 119 | if (header == NetworkHeaders.RemoteCall) 120 | { 121 | string functionHash = (string)data[1]; 122 | 123 | if (!LoadedFunctions.ContainsKey(functionHash)) 124 | { 125 | Console.WriteLine("Invalid call ({0})", functionHash); 126 | client.Send(null); 127 | return; 128 | } 129 | 130 | object[] args = (object[])data[2]; 131 | 132 | RemoteFunction function = LoadedFunctions[functionHash]; 133 | client.Send(function.Execute(args)); 134 | Console.WriteLine("Function Call ({0}) Value={1}", function, functionHash); 135 | } 136 | } 137 | catch (Exception ex) 138 | { 139 | client.Send(null); 140 | LogError(ex); 141 | } 142 | } 143 | 144 | private void enableToolStripMenuItem_Click(object sender, EventArgs e) 145 | { 146 | foreach(RemoteFunctionListViewItem i in lvFunctions.Items) 147 | { 148 | i.Function.ExecuteAction = ExecuteAction.Normal; 149 | } 150 | } 151 | 152 | private void disableToolStripMenuItem_Click(object sender, EventArgs e) 153 | { 154 | foreach (RemoteFunctionListViewItem i in lvFunctions.Items) 155 | { 156 | i.Function.ExecuteAction = ExecuteAction.Disabled; 157 | } 158 | } 159 | 160 | private void testCallToolStripMenuItem_Click(object sender, EventArgs e) 161 | { 162 | if (lvFunctions.Items.Count < 1) 163 | return; 164 | List functions = new List(); 165 | foreach (RemoteFunctionListViewItem i in lvFunctions.Items) 166 | { 167 | functions.Add(i.Function); 168 | } 169 | 170 | using (formTestCall testCall = new formTestCall(functions.ToArray())) 171 | { 172 | testCall.ShowDialog(); 173 | } 174 | } 175 | } 176 | } 177 | -------------------------------------------------------------------------------- /NetCoreBuilder/Forms/mainWindow.cs: -------------------------------------------------------------------------------- 1 | using Mono.Cecil; 2 | using Mono.Cecil.Cil; 3 | using NetCore.Networking; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Windows.Forms; 9 | 10 | namespace NetCoreBuilder.Forms 11 | { 12 | public partial class mainWindow : Form 13 | { 14 | HashSet ScannedTypes = new HashSet(); 15 | 16 | AssemblyDefinition newModule = null; 17 | AssemblyDefinition loadedModule = null; 18 | 19 | TypeReference objectReference = null; 20 | TypeReference objectReferenceNew = null; 21 | MethodReference CreateRemoteCallRef; 22 | public mainWindow() 23 | { 24 | InitializeComponent(); 25 | } 26 | 27 | private void btnBuild_Click(object sender, EventArgs e) 28 | { 29 | if(!File.Exists(tbFilePath.Text) || string.IsNullOrWhiteSpace(tbOutoutAssem.Text) || string.IsNullOrWhiteSpace(tbOutoutMod.Text)) 30 | { 31 | MessageBox.Show("Invalid FIle."); 32 | return; 33 | } 34 | loadedModule = AssemblyDefinition.ReadAssembly(tbFilePath.Text); 35 | 36 | AssemblyDefinition netCodeAsm = AssemblyDefinition.ReadAssembly("NetCore.dll"); 37 | TypeDefinition netCoreType = netCodeAsm.MainModule.GetType("NetCore.NetCoreClient"); 38 | 39 | newModule = GenerateStockType(tbOutoutAssem.Text, loadedModule); 40 | 41 | objectReference = loadedModule.MainModule.Import((typeof(object))); 42 | objectReferenceNew = newModule.MainModule.Import((typeof(object))); 43 | 44 | CreateRemoteCallRef = loadedModule.MainModule.Import(netCoreType.Methods.FirstOrDefault(x => x.Name == "CreateRemoteCall")); 45 | 46 | foreach (ModuleDefinition md in loadedModule.Modules) 47 | { 48 | foreach (TypeDefinition td in md.GetTypes()) 49 | { 50 | DealWithType(td); 51 | } 52 | } 53 | 54 | try 55 | { 56 | newModule.Write(tbOutoutMod.Text); 57 | loadedModule.Write(tbOutoutAssem.Text); 58 | MessageBox.Show("Done."); 59 | 60 | } 61 | catch(Exception ex) 62 | { 63 | MessageBox.Show("Failed. \n" + ex.Message); 64 | } 65 | } 66 | 67 | void DealWithType(TypeDefinition type) 68 | { 69 | 70 | 71 | TypeAttributes att = type.Attributes; 72 | if (att.HasFlag(TypeAttributes.NotPublic)) 73 | att &= ~TypeAttributes.NotPublic; 74 | 75 | att |= TypeAttributes.Public; 76 | 77 | TypeDefinition nTypeDef = CecilHelper.Inject(newModule.MainModule, type); 78 | 79 | if (type.CustomAttributes.Where(x => x.AttributeType.FullName == "System.CodeDom.Compiler.GeneratedCodeAttribute").Count() != 0)//type.Namespace.EndsWith(".My") 80 | { 81 | // newModule.MainModule.Types.Add(.DeclaringType); 82 | newModule.MainModule.Import(type); 83 | return; 84 | } 85 | 86 | bool add = false; 87 | List RemoveMethods = new List(); 88 | 89 | 90 | foreach (MethodDefinition method in type.Methods) 91 | { 92 | 93 | 94 | if (!method.HasBody) 95 | continue; 96 | if (!method.IsStatic) 97 | continue; 98 | 99 | TransportAction visibility = TransportAction.Public; 100 | 101 | if (!TypeCheck.KeepMethod(type, method, out visibility)) 102 | continue; 103 | 104 | if(!method.IsStatic) 105 | { 106 | MessageBox.Show("RemoteCall must be only used on static methods.\n: " + method.FullName); 107 | throw new Exception("Not static"); 108 | } 109 | 110 | add = true; 111 | 112 | if(visibility == TransportAction.Move) 113 | { 114 | RemoveMethods.Add(method); 115 | continue; 116 | } 117 | 118 | if (visibility == TransportAction.Copy) 119 | continue; 120 | 121 | method.Body.Instructions.Clear(); 122 | 123 | ILProcessor ilp = method.Body.GetILProcessor(); 124 | 125 | if (visibility == TransportAction.MoveClear) 126 | { 127 | ilp.Append(Instruction.Create(OpCodes.Ret)); 128 | continue; 129 | } 130 | 131 | 132 | 133 | ilp.Append(Instruction.Create(OpCodes.Ldstr, Hashing.SHA(string.Format("{0}.{1}", type.FullName, method.Name)))); 134 | 135 | if (method.Parameters.Count == 0) 136 | { 137 | ilp.Append(Instruction.Create(OpCodes.Ldc_I4_0)); 138 | ilp.Append(Instruction.Create(OpCodes.Newarr, objectReference)); 139 | } 140 | else 141 | { 142 | ilp.Append(Instruction.Create(OpCodes.Ldc_I4, method.Parameters.Count)); 143 | ilp.Append(Instruction.Create(OpCodes.Newarr, objectReference)); 144 | 145 | for (int i = 0; i < method.Parameters.Count; i++) 146 | { 147 | ilp.Append(Instruction.Create(OpCodes.Dup)); 148 | ilp.Append(Instruction.Create(OpCodes.Ldc_I4, i)); 149 | ilp.Append(Instruction.Create(OpCodes.Ldarg, method.Parameters[i])); 150 | ilp.Append(Instruction.Create(OpCodes.Box, method.Parameters[i].ParameterType)); 151 | ilp.Append(Instruction.Create(OpCodes.Stelem_Ref)); 152 | } 153 | } 154 | ilp.Append(Instruction.Create(OpCodes.Call, CreateRemoteCallRef)); 155 | ilp.Append(Instruction.Create(OpCodes.Unbox_Any, method.ReturnType)); 156 | ilp.Append(Instruction.Create(OpCodes.Ret)); 157 | } 158 | 159 | foreach (MethodDefinition md in RemoveMethods) 160 | type.Methods.Remove(md); 161 | 162 | if (add) 163 | { 164 | newModule.MainModule.Types.Add(nTypeDef); 165 | } 166 | } 167 | 168 | AssemblyDefinition GenerateStockType(string path, AssemblyDefinition assem) 169 | { 170 | AssemblyDefinition newModule = AssemblyDefinition.CreateAssembly(assem.Name, assem.MainModule.Name, ModuleKind.Dll); 171 | // foreach (var asm in assem.MainModule.AssemblyReferences) 172 | // newModule.MainModule.AssemblyReferences.Add(asm); 173 | return newModule; 174 | } 175 | 176 | private void btnBrowse_Click(object sender, EventArgs e) 177 | { 178 | using (OpenFileDialog ofd = new OpenFileDialog()) 179 | { 180 | ofd.Filter = "Exe File|*.exe"; 181 | if(ofd.ShowDialog() == DialogResult.OK) 182 | { 183 | tbFilePath.Text = ofd.FileName; 184 | } 185 | } 186 | 187 | } 188 | 189 | private void button1_Click(object sender, EventArgs e) 190 | { 191 | using (SaveFileDialog sfd = new SaveFileDialog()) 192 | { 193 | sfd.Filter = "Exe File|*.exe"; 194 | if(sfd.ShowDialog() == DialogResult.OK) 195 | { 196 | tbOutoutAssem.Text = sfd.FileName; 197 | } 198 | } 199 | } 200 | 201 | private void button2_Click(object sender, EventArgs e) 202 | { 203 | using (SaveFileDialog sfd = new SaveFileDialog()) 204 | { 205 | sfd.Filter = "NetCore Module|*.ncm"; 206 | if (sfd.ShowDialog() == DialogResult.OK) 207 | { 208 | tbOutoutMod.Text = sfd.FileName; 209 | } 210 | } 211 | } 212 | 213 | private void mainWindow_Load(object sender, EventArgs e) 214 | { 215 | this.Text += string.Format(" {0}", Application.ProductVersion); 216 | } 217 | } 218 | } 219 | -------------------------------------------------------------------------------- /NetCoreBuilder/Forms/mainWindow.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace NetCoreBuilder.Forms 2 | { 3 | partial class mainWindow 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.tbFilePath = new System.Windows.Forms.TextBox(); 32 | this.btnBrowse = new System.Windows.Forms.Button(); 33 | this.btnBuild = new System.Windows.Forms.Button(); 34 | this.label1 = new System.Windows.Forms.Label(); 35 | this.label2 = new System.Windows.Forms.Label(); 36 | this.button1 = new System.Windows.Forms.Button(); 37 | this.tbOutoutAssem = new System.Windows.Forms.TextBox(); 38 | this.label3 = new System.Windows.Forms.Label(); 39 | this.tbOutoutMod = new System.Windows.Forms.TextBox(); 40 | this.button2 = new System.Windows.Forms.Button(); 41 | this.SuspendLayout(); 42 | // 43 | // tbFilePath 44 | // 45 | this.tbFilePath.Location = new System.Drawing.Point(12, 27); 46 | this.tbFilePath.Name = "tbFilePath"; 47 | this.tbFilePath.Size = new System.Drawing.Size(266, 20); 48 | this.tbFilePath.TabIndex = 0; 49 | // 50 | // btnBrowse 51 | // 52 | this.btnBrowse.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 53 | this.btnBrowse.Location = new System.Drawing.Point(284, 24); 54 | this.btnBrowse.Name = "btnBrowse"; 55 | this.btnBrowse.Size = new System.Drawing.Size(38, 23); 56 | this.btnBrowse.TabIndex = 1; 57 | this.btnBrowse.Text = "..."; 58 | this.btnBrowse.UseVisualStyleBackColor = true; 59 | this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click); 60 | // 61 | // btnBuild 62 | // 63 | this.btnBuild.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 64 | this.btnBuild.Location = new System.Drawing.Point(113, 139); 65 | this.btnBuild.Name = "btnBuild"; 66 | this.btnBuild.Size = new System.Drawing.Size(87, 23); 67 | this.btnBuild.TabIndex = 2; 68 | this.btnBuild.Text = "Build"; 69 | this.btnBuild.UseVisualStyleBackColor = true; 70 | this.btnBuild.Click += new System.EventHandler(this.btnBuild_Click); 71 | // 72 | // label1 73 | // 74 | this.label1.AutoSize = true; 75 | this.label1.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 76 | this.label1.Location = new System.Drawing.Point(12, 11); 77 | this.label1.Name = "label1"; 78 | this.label1.Size = new System.Drawing.Size(91, 13); 79 | this.label1.TabIndex = 3; 80 | this.label1.Text = "Target Assembly:"; 81 | // 82 | // label2 83 | // 84 | this.label2.AutoSize = true; 85 | this.label2.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 86 | this.label2.Location = new System.Drawing.Point(15, 48); 87 | this.label2.Name = "label2"; 88 | this.label2.Size = new System.Drawing.Size(98, 13); 89 | this.label2.TabIndex = 6; 90 | this.label2.Text = "Output Assembly:"; 91 | // 92 | // button1 93 | // 94 | this.button1.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 95 | this.button1.Location = new System.Drawing.Point(284, 62); 96 | this.button1.Name = "button1"; 97 | this.button1.Size = new System.Drawing.Size(38, 23); 98 | this.button1.TabIndex = 5; 99 | this.button1.Text = "..."; 100 | this.button1.UseVisualStyleBackColor = true; 101 | this.button1.Click += new System.EventHandler(this.button1_Click); 102 | // 103 | // tbOutoutAssem 104 | // 105 | this.tbOutoutAssem.Location = new System.Drawing.Point(15, 64); 106 | this.tbOutoutAssem.Name = "tbOutoutAssem"; 107 | this.tbOutoutAssem.Size = new System.Drawing.Size(266, 20); 108 | this.tbOutoutAssem.TabIndex = 4; 109 | // 110 | // label3 111 | // 112 | this.label3.AutoSize = true; 113 | this.label3.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 114 | this.label3.Location = new System.Drawing.Point(15, 88); 115 | this.label3.Name = "label3"; 116 | this.label3.Size = new System.Drawing.Size(91, 13); 117 | this.label3.TabIndex = 8; 118 | this.label3.Text = "Output Module:"; 119 | // 120 | // tbOutoutMod 121 | // 122 | this.tbOutoutMod.Location = new System.Drawing.Point(15, 104); 123 | this.tbOutoutMod.Name = "tbOutoutMod"; 124 | this.tbOutoutMod.Size = new System.Drawing.Size(266, 20); 125 | this.tbOutoutMod.TabIndex = 7; 126 | // 127 | // button2 128 | // 129 | this.button2.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 130 | this.button2.Location = new System.Drawing.Point(284, 102); 131 | this.button2.Name = "button2"; 132 | this.button2.Size = new System.Drawing.Size(38, 23); 133 | this.button2.TabIndex = 9; 134 | this.button2.Text = "..."; 135 | this.button2.UseVisualStyleBackColor = true; 136 | this.button2.Click += new System.EventHandler(this.button2_Click); 137 | // 138 | // mainWindow 139 | // 140 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 141 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 142 | this.ClientSize = new System.Drawing.Size(328, 174); 143 | this.Controls.Add(this.button2); 144 | this.Controls.Add(this.label3); 145 | this.Controls.Add(this.tbOutoutMod); 146 | this.Controls.Add(this.label2); 147 | this.Controls.Add(this.button1); 148 | this.Controls.Add(this.tbOutoutAssem); 149 | this.Controls.Add(this.label1); 150 | this.Controls.Add(this.btnBuild); 151 | this.Controls.Add(this.btnBrowse); 152 | this.Controls.Add(this.tbFilePath); 153 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 154 | this.Name = "mainWindow"; 155 | this.Text = "NetCore Builder"; 156 | this.Load += new System.EventHandler(this.mainWindow_Load); 157 | this.ResumeLayout(false); 158 | this.PerformLayout(); 159 | 160 | } 161 | 162 | #endregion 163 | 164 | private System.Windows.Forms.TextBox tbFilePath; 165 | private System.Windows.Forms.Button btnBrowse; 166 | private System.Windows.Forms.Button btnBuild; 167 | private System.Windows.Forms.Label label1; 168 | private System.Windows.Forms.Label label2; 169 | private System.Windows.Forms.Button button1; 170 | private System.Windows.Forms.TextBox tbOutoutAssem; 171 | private System.Windows.Forms.Label label3; 172 | private System.Windows.Forms.TextBox tbOutoutMod; 173 | private System.Windows.Forms.Button button2; 174 | } 175 | } -------------------------------------------------------------------------------- /NetCoreServer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Reflection; 5 | using NetCore.Networking; 6 | using System.Text; 7 | using NetCore; 8 | using System.Diagnostics; 9 | 10 | namespace NetCoreServer 11 | { 12 | class Program 13 | { 14 | static Dictionary LoadedFunctions = new Dictionary(); 15 | static eSock.Server _server; 16 | static void Main(string[] args) 17 | { 18 | DirectoryInfo di = new DirectoryInfo("Modules"); 19 | if (!di.Exists) 20 | di.Create(); 21 | Console.Title = string.Format("NetCore Server v{0}", Assembly.GetExecutingAssembly().GetName().Version); 22 | Console.ForegroundColor = ConsoleColor.Green; 23 | Console.WriteLine("NetCore Server - BahNahNah"); 24 | Console.WriteLine(); 25 | Console.ForegroundColor = ConsoleColor.DarkMagenta; 26 | 27 | foreach (FileInfo fi in di.GetFiles("*.ncm")) 28 | { 29 | try 30 | { 31 | Assembly asm = Assembly.LoadFile(fi.FullName); 32 | foreach (Type t in asm.GetTypes()) 33 | { 34 | 35 | foreach (MethodInfo mi in t.GetMethods()) 36 | { 37 | if (!Attribute.IsDefined(mi, typeof(RemoteCallAttribute))) 38 | continue; 39 | string name = string.Format("{0}.{1}", t.FullName, mi.Name); 40 | string hash = Hashing.SHA(name); 41 | if (LoadedFunctions.ContainsKey(hash)) 42 | { 43 | Console.WriteLine("Duplicate name: {0}", name); 44 | } 45 | else 46 | { 47 | LoadedFunctions.Add(hash, mi); 48 | Console.WriteLine("Loaded {0}", name); 49 | } 50 | } 51 | } 52 | } 53 | catch (ReflectionTypeLoadException ex) 54 | { 55 | Console.WriteLine("Error: {0}", ex.Message); 56 | StringBuilder sb = new StringBuilder(); 57 | foreach (Exception exSub in ex.LoaderExceptions) 58 | { 59 | sb.AppendLine(exSub.Message); 60 | FileNotFoundException exFileNotFound = exSub as FileNotFoundException; 61 | if (exFileNotFound != null) 62 | { 63 | if (!string.IsNullOrEmpty(exFileNotFound.FusionLog)) 64 | { 65 | sb.AppendLine("Fusion Log:"); 66 | sb.AppendLine(exFileNotFound.FusionLog); 67 | } 68 | } 69 | sb.AppendLine(); 70 | } 71 | string errorMessage = sb.ToString(); 72 | Console.ForegroundColor = ConsoleColor.Red; 73 | Console.Write(errorMessage); 74 | Console.ForegroundColor = ConsoleColor.Magenta; 75 | } 76 | catch(Exception ex) 77 | { 78 | Console.WriteLine("Error: {0}", ex.Message); 79 | } 80 | } 81 | 82 | Console.ForegroundColor = ConsoleColor.DarkYellow; 83 | Console.WriteLine("Loaded {0} remote functions.", LoadedFunctions.Count); 84 | Console.WriteLine(); 85 | 86 | int port = 0; 87 | Console.ResetColor(); 88 | Console.Write("Listening port (default 3345): "); 89 | 90 | 91 | if (!int.TryParse(Console.ReadLine(), out port)) 92 | port = 3345; 93 | 94 | Console.ForegroundColor = ConsoleColor.Blue; 95 | Console.WriteLine("Starting on port {0}...", port); 96 | _server = new eSock.Server(); 97 | 98 | _server.OnDataRetrieved += _server_OnDataRetrieved; 99 | 100 | if (!_server.Start(port)) 101 | { 102 | Console.ForegroundColor = ConsoleColor.Red; 103 | Console.WriteLine("Failed to start on port {0}, press enter to exit.", port); 104 | Console.ReadLine(); 105 | return; 106 | } 107 | 108 | Console.ForegroundColor = ConsoleColor.DarkMagenta; 109 | Console.WriteLine("Server started!"); 110 | Console.WriteLine(); 111 | Console.ResetColor(); 112 | 113 | AcceptCommands(); 114 | 115 | } 116 | 117 | private static void _server_OnDataRetrieved(eSock.Server sender, eSock.Server.eSockClient client, object[] data) 118 | { 119 | try 120 | { 121 | NetworkHeaders header = (NetworkHeaders)data[0]; 122 | 123 | if (header == NetworkHeaders.Handshake) 124 | { 125 | string key = Guid.NewGuid().ToString(); 126 | client.Send((byte)NetworkHeaders.AcceptHandshake, key); 127 | client.Encryption.EncryptionKey = key; 128 | client.Encryption.Enabled = true; 129 | return; 130 | } 131 | 132 | if (header == NetworkHeaders.RemoteCall) 133 | { 134 | string function = (string)data[1]; 135 | 136 | if (!LoadedFunctions.ContainsKey(function)) 137 | { 138 | Console.WriteLine("Invalid call ({0})", function); 139 | client.Send(null); 140 | return; 141 | } 142 | 143 | object[] args = (object[])data[2]; 144 | 145 | object result = LoadedFunctions[function].Invoke(null, args); 146 | client.Send(result); 147 | Console.WriteLine("Function Call ({0}) Value={1}", function, result); 148 | } 149 | } 150 | catch (Exception ex) 151 | { 152 | try 153 | { 154 | client.Send(null); 155 | } 156 | catch { } 157 | Console.ForegroundColor = ConsoleColor.Red; 158 | Console.WriteLine("Error: {0}", ex.Message); 159 | Console.ResetColor(); 160 | } 161 | } 162 | 163 | static void AcceptCommands() 164 | { 165 | while(true) 166 | { 167 | try 168 | { 169 | Console.Write(": "); 170 | string fullCmd = Console.ReadLine(); 171 | string[] cmdParams = new string[0]; 172 | if(fullCmd.Contains(" ")) 173 | cmdParams = fullCmd.Split(' '); 174 | switch((cmdParams.Length > 0 ? cmdParams[0] : fullCmd).ToLower()) 175 | { 176 | case "testcall": 177 | MethodInfo f = null; 178 | if (!LoadedFunctions.ContainsKey(cmdParams[1])) 179 | { 180 | f = LoadedFunctions[Hashing.SHA(cmdParams[1])]; 181 | } 182 | else 183 | { 184 | f = LoadedFunctions[cmdParams[1]]; 185 | } 186 | Stopwatch execTimer = new Stopwatch(); 187 | try 188 | { 189 | ParameterInfo[] paramInfo = f.GetParameters(); 190 | List paramiters = new List(); 191 | 192 | foreach (ParameterInfo p in paramInfo) 193 | { 194 | paramiters.Add(p.DefaultValue); 195 | } 196 | 197 | execTimer.Start(); 198 | object result = f.Invoke(null, paramiters.ToArray()); 199 | execTimer.Stop(); 200 | 201 | Console.WriteLine("Execute success."); 202 | Console.WriteLine("Returned: {0}", result); 203 | Console.WriteLine("Return Type: {0}", result.GetType()); 204 | } 205 | catch(Exception ex) 206 | { 207 | Console.WriteLine("Execute Failed."); 208 | if(ex.InnerException != null) 209 | Console.WriteLine("Exception Message: {0}", ex.InnerException.Message); 210 | else 211 | Console.WriteLine("Invoke Exception: {0}", ex.Message); 212 | Console.WriteLine("Return Type: {0}", ex.GetType()); 213 | execTimer.Stop(); 214 | } 215 | finally 216 | { 217 | Console.WriteLine("Execution Time: {0}ms", execTimer.ElapsedMilliseconds); 218 | execTimer.Reset(); 219 | Console.WriteLine(); 220 | } 221 | 222 | break; 223 | } 224 | } 225 | catch 226 | { 227 | Console.WriteLine("Invalid Command."); 228 | } 229 | } 230 | } 231 | } 232 | } -------------------------------------------------------------------------------- /NetCoreServer_GUI/Forms/mainWindow.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace NetCoreServer_GUI.Forms 2 | { 3 | partial class mainWindow 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.tabControl1 = new System.Windows.Forms.TabControl(); 33 | this.tabPage1 = new System.Windows.Forms.TabPage(); 34 | this.btnStart = new System.Windows.Forms.Button(); 35 | this.label1 = new System.Windows.Forms.Label(); 36 | this.nudPort = new System.Windows.Forms.NumericUpDown(); 37 | this.tabPage2 = new System.Windows.Forms.TabPage(); 38 | this.lvFunctions = new System.Windows.Forms.ListView(); 39 | this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 40 | this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 41 | this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 42 | this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 43 | this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 44 | this.cmFunctions = new System.Windows.Forms.ContextMenuStrip(this.components); 45 | this.accessToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 46 | this.enableToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 47 | this.disableToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 48 | this.tabPage3 = new System.Windows.Forms.TabPage(); 49 | this.lvExceptions = new System.Windows.Forms.ListView(); 50 | this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 51 | this.testCallToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 52 | this.tabControl1.SuspendLayout(); 53 | this.tabPage1.SuspendLayout(); 54 | ((System.ComponentModel.ISupportInitialize)(this.nudPort)).BeginInit(); 55 | this.tabPage2.SuspendLayout(); 56 | this.cmFunctions.SuspendLayout(); 57 | this.tabPage3.SuspendLayout(); 58 | this.SuspendLayout(); 59 | // 60 | // tabControl1 61 | // 62 | this.tabControl1.Controls.Add(this.tabPage1); 63 | this.tabControl1.Controls.Add(this.tabPage2); 64 | this.tabControl1.Controls.Add(this.tabPage3); 65 | this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; 66 | this.tabControl1.Location = new System.Drawing.Point(0, 0); 67 | this.tabControl1.Name = "tabControl1"; 68 | this.tabControl1.SelectedIndex = 0; 69 | this.tabControl1.Size = new System.Drawing.Size(488, 283); 70 | this.tabControl1.TabIndex = 0; 71 | // 72 | // tabPage1 73 | // 74 | this.tabPage1.Controls.Add(this.btnStart); 75 | this.tabPage1.Controls.Add(this.label1); 76 | this.tabPage1.Controls.Add(this.nudPort); 77 | this.tabPage1.Location = new System.Drawing.Point(4, 22); 78 | this.tabPage1.Name = "tabPage1"; 79 | this.tabPage1.Padding = new System.Windows.Forms.Padding(3); 80 | this.tabPage1.Size = new System.Drawing.Size(426, 235); 81 | this.tabPage1.TabIndex = 0; 82 | this.tabPage1.Text = "Connection"; 83 | this.tabPage1.UseVisualStyleBackColor = true; 84 | // 85 | // btnStart 86 | // 87 | this.btnStart.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 88 | | System.Windows.Forms.AnchorStyles.Right))); 89 | this.btnStart.Location = new System.Drawing.Point(11, 32); 90 | this.btnStart.Name = "btnStart"; 91 | this.btnStart.Size = new System.Drawing.Size(407, 23); 92 | this.btnStart.TabIndex = 2; 93 | this.btnStart.Text = "Start NetCore Server"; 94 | this.btnStart.UseVisualStyleBackColor = true; 95 | this.btnStart.Click += new System.EventHandler(this.btnStart_Click); 96 | // 97 | // label1 98 | // 99 | this.label1.AutoSize = true; 100 | this.label1.Location = new System.Drawing.Point(8, 8); 101 | this.label1.Name = "label1"; 102 | this.label1.Size = new System.Drawing.Size(29, 13); 103 | this.label1.TabIndex = 1; 104 | this.label1.Text = "Port:"; 105 | // 106 | // nudPort 107 | // 108 | this.nudPort.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 109 | | System.Windows.Forms.AnchorStyles.Right))); 110 | this.nudPort.Location = new System.Drawing.Point(43, 6); 111 | this.nudPort.Maximum = new decimal(new int[] { 112 | 999999, 113 | 0, 114 | 0, 115 | 0}); 116 | this.nudPort.Minimum = new decimal(new int[] { 117 | 1, 118 | 0, 119 | 0, 120 | 0}); 121 | this.nudPort.Name = "nudPort"; 122 | this.nudPort.Size = new System.Drawing.Size(375, 20); 123 | this.nudPort.TabIndex = 0; 124 | this.nudPort.Value = new decimal(new int[] { 125 | 3345, 126 | 0, 127 | 0, 128 | 0}); 129 | // 130 | // tabPage2 131 | // 132 | this.tabPage2.Controls.Add(this.lvFunctions); 133 | this.tabPage2.Location = new System.Drawing.Point(4, 22); 134 | this.tabPage2.Name = "tabPage2"; 135 | this.tabPage2.Padding = new System.Windows.Forms.Padding(3); 136 | this.tabPage2.Size = new System.Drawing.Size(480, 257); 137 | this.tabPage2.TabIndex = 1; 138 | this.tabPage2.Text = "Remote Functions"; 139 | this.tabPage2.UseVisualStyleBackColor = true; 140 | // 141 | // lvFunctions 142 | // 143 | this.lvFunctions.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 144 | this.columnHeader1, 145 | this.columnHeader2, 146 | this.columnHeader3, 147 | this.columnHeader4, 148 | this.columnHeader6}); 149 | this.lvFunctions.ContextMenuStrip = this.cmFunctions; 150 | this.lvFunctions.Dock = System.Windows.Forms.DockStyle.Fill; 151 | this.lvFunctions.FullRowSelect = true; 152 | this.lvFunctions.GridLines = true; 153 | this.lvFunctions.Location = new System.Drawing.Point(3, 3); 154 | this.lvFunctions.Name = "lvFunctions"; 155 | this.lvFunctions.Size = new System.Drawing.Size(474, 251); 156 | this.lvFunctions.TabIndex = 0; 157 | this.lvFunctions.UseCompatibleStateImageBehavior = false; 158 | this.lvFunctions.View = System.Windows.Forms.View.Details; 159 | // 160 | // columnHeader1 161 | // 162 | this.columnHeader1.Text = "Hash"; 163 | this.columnHeader1.Width = 110; 164 | // 165 | // columnHeader2 166 | // 167 | this.columnHeader2.Text = "Full Name"; 168 | this.columnHeader2.Width = 119; 169 | // 170 | // columnHeader3 171 | // 172 | this.columnHeader3.Text = "File"; 173 | this.columnHeader3.Width = 73; 174 | // 175 | // columnHeader4 176 | // 177 | this.columnHeader4.Text = "Action"; 178 | this.columnHeader4.Width = 80; 179 | // 180 | // columnHeader6 181 | // 182 | this.columnHeader6.Text = "Calls"; 183 | this.columnHeader6.Width = 53; 184 | // 185 | // cmFunctions 186 | // 187 | this.cmFunctions.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 188 | this.accessToolStripMenuItem, 189 | this.testCallToolStripMenuItem}); 190 | this.cmFunctions.Name = "cmFunctions"; 191 | this.cmFunctions.Size = new System.Drawing.Size(117, 48); 192 | // 193 | // accessToolStripMenuItem 194 | // 195 | this.accessToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { 196 | this.enableToolStripMenuItem, 197 | this.disableToolStripMenuItem}); 198 | this.accessToolStripMenuItem.Name = "accessToolStripMenuItem"; 199 | this.accessToolStripMenuItem.Size = new System.Drawing.Size(152, 22); 200 | this.accessToolStripMenuItem.Text = "Access"; 201 | // 202 | // enableToolStripMenuItem 203 | // 204 | this.enableToolStripMenuItem.Name = "enableToolStripMenuItem"; 205 | this.enableToolStripMenuItem.Size = new System.Drawing.Size(152, 22); 206 | this.enableToolStripMenuItem.Text = "Enable"; 207 | this.enableToolStripMenuItem.Click += new System.EventHandler(this.enableToolStripMenuItem_Click); 208 | // 209 | // disableToolStripMenuItem 210 | // 211 | this.disableToolStripMenuItem.Name = "disableToolStripMenuItem"; 212 | this.disableToolStripMenuItem.Size = new System.Drawing.Size(152, 22); 213 | this.disableToolStripMenuItem.Text = "Disable"; 214 | this.disableToolStripMenuItem.Click += new System.EventHandler(this.disableToolStripMenuItem_Click); 215 | // 216 | // tabPage3 217 | // 218 | this.tabPage3.Controls.Add(this.lvExceptions); 219 | this.tabPage3.Location = new System.Drawing.Point(4, 22); 220 | this.tabPage3.Name = "tabPage3"; 221 | this.tabPage3.Size = new System.Drawing.Size(426, 235); 222 | this.tabPage3.TabIndex = 2; 223 | this.tabPage3.Text = "Exceptions"; 224 | this.tabPage3.UseVisualStyleBackColor = true; 225 | // 226 | // lvExceptions 227 | // 228 | this.lvExceptions.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 229 | this.columnHeader5}); 230 | this.lvExceptions.Dock = System.Windows.Forms.DockStyle.Fill; 231 | this.lvExceptions.Location = new System.Drawing.Point(0, 0); 232 | this.lvExceptions.Name = "lvExceptions"; 233 | this.lvExceptions.Size = new System.Drawing.Size(426, 235); 234 | this.lvExceptions.TabIndex = 0; 235 | this.lvExceptions.UseCompatibleStateImageBehavior = false; 236 | this.lvExceptions.View = System.Windows.Forms.View.Details; 237 | // 238 | // columnHeader5 239 | // 240 | this.columnHeader5.Text = "Message"; 241 | this.columnHeader5.Width = 400; 242 | // 243 | // testCallToolStripMenuItem 244 | // 245 | this.testCallToolStripMenuItem.Name = "testCallToolStripMenuItem"; 246 | this.testCallToolStripMenuItem.Size = new System.Drawing.Size(152, 22); 247 | this.testCallToolStripMenuItem.Text = "Test call"; 248 | this.testCallToolStripMenuItem.Click += new System.EventHandler(this.testCallToolStripMenuItem_Click); 249 | // 250 | // mainWindow 251 | // 252 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 253 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 254 | this.ClientSize = new System.Drawing.Size(488, 283); 255 | this.Controls.Add(this.tabControl1); 256 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; 257 | this.MinimumSize = new System.Drawing.Size(450, 300); 258 | this.Name = "mainWindow"; 259 | this.Text = "NetCore Server"; 260 | this.Load += new System.EventHandler(this.mainWindow_Load); 261 | this.tabControl1.ResumeLayout(false); 262 | this.tabPage1.ResumeLayout(false); 263 | this.tabPage1.PerformLayout(); 264 | ((System.ComponentModel.ISupportInitialize)(this.nudPort)).EndInit(); 265 | this.tabPage2.ResumeLayout(false); 266 | this.cmFunctions.ResumeLayout(false); 267 | this.tabPage3.ResumeLayout(false); 268 | this.ResumeLayout(false); 269 | 270 | } 271 | 272 | #endregion 273 | 274 | private System.Windows.Forms.TabControl tabControl1; 275 | private System.Windows.Forms.TabPage tabPage1; 276 | private System.Windows.Forms.TabPage tabPage2; 277 | private System.Windows.Forms.Label label1; 278 | private System.Windows.Forms.NumericUpDown nudPort; 279 | private System.Windows.Forms.ListView lvFunctions; 280 | private System.Windows.Forms.ColumnHeader columnHeader1; 281 | private System.Windows.Forms.ColumnHeader columnHeader2; 282 | private System.Windows.Forms.ColumnHeader columnHeader3; 283 | private System.Windows.Forms.ColumnHeader columnHeader4; 284 | private System.Windows.Forms.TabPage tabPage3; 285 | private System.Windows.Forms.ListView lvExceptions; 286 | private System.Windows.Forms.ColumnHeader columnHeader5; 287 | private System.Windows.Forms.Button btnStart; 288 | private System.Windows.Forms.ColumnHeader columnHeader6; 289 | private System.Windows.Forms.ContextMenuStrip cmFunctions; 290 | private System.Windows.Forms.ToolStripMenuItem accessToolStripMenuItem; 291 | private System.Windows.Forms.ToolStripMenuItem enableToolStripMenuItem; 292 | private System.Windows.Forms.ToolStripMenuItem disableToolStripMenuItem; 293 | private System.Windows.Forms.ToolStripMenuItem testCallToolStripMenuItem; 294 | } 295 | } -------------------------------------------------------------------------------- /NetCoreBuilder/CecilHeper.cs: -------------------------------------------------------------------------------- 1 | 2 | using Mono.Cecil; 3 | using Mono.Cecil.Cil; 4 | using NetCoreBuilder; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Runtime.CompilerServices; 8 | using System.Text; 9 | 10 | 11 | 12 | public static class CecilHelper 13 | { 14 | private static TypeDefinition _Inject(ModuleDefinition mod, TypeDefinition type, Dictionary mems) 15 | { 16 | TypeAttributes att = type.Attributes; 17 | if (att.HasFlag(TypeAttributes.NotPublic)) 18 | att &= ~TypeAttributes.NotPublic; 19 | 20 | att |= TypeAttributes.Public; 21 | TypeDefinition definition = new TypeDefinition(type.Namespace, type.Name, att) 22 | { 23 | ClassSize = type.ClassSize, 24 | PackingSize = type.PackingSize 25 | }; 26 | if (type.BaseType != null) 27 | { 28 | definition.BaseType = mod.Import(type.BaseType); 29 | } 30 | mems.Add(type.MetadataToken, definition); 31 | foreach (TypeDefinition definition2 in type.NestedTypes) 32 | { 33 | TypeDefinition item = _Inject(mod, definition2, mems); 34 | definition.NestedTypes.Add(item); 35 | } 36 | foreach (FieldDefinition definition4 in type.Fields) 37 | { 38 | if (!definition4.IsLiteral) 39 | { 40 | FieldDefinition definition5 = new FieldDefinition(definition4.Name, definition4.Attributes, mod.TypeSystem.Void); 41 | mems.Add(definition4.MetadataToken, definition5); 42 | definition.Fields.Add(definition5); 43 | } 44 | } 45 | foreach (MethodDefinition definition6 in type.Methods) 46 | { 47 | TransportAction visible = TransportAction.Public; 48 | if (!TypeCheck.KeepMethod(type, definition6, out visible)) 49 | continue; 50 | 51 | MethodAttributes methodAtt = definition6.Attributes; 52 | 53 | if (visible == TransportAction.Public) 54 | { 55 | if (methodAtt.HasFlag(MethodAttributes.Private)) 56 | methodAtt &= ~MethodAttributes.Private; 57 | 58 | if (visible == TransportAction.Public) 59 | methodAtt |= MethodAttributes.Public; 60 | } 61 | 62 | MethodDefinition definition7 = new MethodDefinition(definition6.Name, methodAtt, definition6.ReturnType); 63 | mems.Add(definition6.MetadataToken, definition7); 64 | definition.Methods.Add(definition7); 65 | } 66 | return definition; 67 | } 68 | 69 | private static FieldReference ImportField(FieldReference fldRef, ModuleDefinition mod, Dictionary mems) 70 | { 71 | if ((mems != null) && mems.ContainsKey(fldRef.MetadataToken)) 72 | { 73 | return (mems[fldRef.MetadataToken] as FieldReference); 74 | } 75 | if (fldRef.DeclaringType.Scope.Name != "Confuser.Core.Injections.dll") 76 | { 77 | return mod.Import(fldRef); 78 | } 79 | return fldRef; 80 | } 81 | 82 | private static MethodReference ImportMethod(MethodReference mtdRef, ModuleDefinition mod, MethodReference context, Dictionary mems) 83 | { 84 | MethodReference reference = mtdRef; 85 | if (mtdRef is GenericInstanceMethod) 86 | { 87 | GenericInstanceMethod method = mtdRef as GenericInstanceMethod; 88 | reference = new GenericInstanceMethod(ImportMethod(method.ElementMethod, mod, context, mems)); 89 | foreach (TypeReference reference2 in method.GenericArguments) 90 | { 91 | (reference as GenericInstanceMethod).GenericArguments.Add(ImportType(reference2, mod, context, mems)); 92 | } 93 | reference.ReturnType = ImportType(reference.ReturnType, mod, reference, mems); 94 | foreach (ParameterDefinition definition in reference.Parameters) 95 | { 96 | definition.ParameterType = ImportType(definition.ParameterType, mod, reference, mems); 97 | } 98 | } 99 | else if ((mems != null) && mems.ContainsKey(mtdRef.MetadataToken)) 100 | { 101 | reference = mems[mtdRef.MetadataToken] as MethodReference; 102 | } 103 | else if (mtdRef.DeclaringType.Scope.Name != "Confuser.Core.Injections.dll") 104 | { 105 | reference = mod.Import(reference); 106 | reference.ReturnType = ImportType(reference.ReturnType, mod, reference, mems); 107 | foreach (ParameterDefinition definition2 in reference.Parameters) 108 | { 109 | definition2.ParameterType = ImportType(definition2.ParameterType, mod, reference, mems); 110 | } 111 | } 112 | if (!(mtdRef is MethodDefinition) && !(mtdRef is MethodSpecification)) 113 | { 114 | reference.DeclaringType = ImportType(mtdRef.DeclaringType, mod, context, mems); 115 | } 116 | return reference; 117 | } 118 | 119 | private static TypeReference ImportType(TypeReference typeRef, ModuleDefinition mod, MethodReference context, Dictionary mems) 120 | { 121 | TypeReference reference = typeRef; 122 | if (typeRef is TypeSpecification) 123 | { 124 | if (typeRef is ArrayType) 125 | { 126 | ArrayType type = typeRef as ArrayType; 127 | reference = new ArrayType(ImportType(type.ElementType, mod, context, mems)); 128 | (reference as ArrayType).Dimensions.Clear(); 129 | foreach (ArrayDimension dimension in type.Dimensions) 130 | { 131 | (reference as ArrayType).Dimensions.Add(dimension); 132 | } 133 | return reference; 134 | } 135 | if (typeRef is GenericInstanceType) 136 | { 137 | GenericInstanceType type2 = typeRef as GenericInstanceType; 138 | reference = new GenericInstanceType(ImportType(type2.ElementType, mod, context, mems)); 139 | foreach (TypeReference reference2 in type2.GenericArguments) 140 | { 141 | (reference as GenericInstanceType).GenericArguments.Add(ImportType(reference2, mod, context, mems)); 142 | } 143 | return reference; 144 | } 145 | if (typeRef is OptionalModifierType) 146 | { 147 | return new OptionalModifierType(ImportType((typeRef as OptionalModifierType).ModifierType, mod, context, mems), ImportType((typeRef as TypeSpecification).ElementType, mod, context, mems)); 148 | } 149 | if (typeRef is RequiredModifierType) 150 | { 151 | return new RequiredModifierType(ImportType((typeRef as RequiredModifierType).ModifierType, mod, context, mems), ImportType((typeRef as TypeSpecification).ElementType, mod, context, mems)); 152 | } 153 | if (typeRef is ByReferenceType) 154 | { 155 | return new ByReferenceType(ImportType((typeRef as TypeSpecification).ElementType, mod, context, mems)); 156 | } 157 | if (typeRef is PointerType) 158 | { 159 | return new PointerType(ImportType((typeRef as TypeSpecification).ElementType, mod, context, mems)); 160 | } 161 | if (typeRef is PinnedType) 162 | { 163 | return new PinnedType(ImportType((typeRef as TypeSpecification).ElementType, mod, context, mems)); 164 | } 165 | if (!(typeRef is SentinelType)) 166 | { 167 | throw new NotSupportedException(); 168 | } 169 | return new SentinelType(ImportType((typeRef as TypeSpecification).ElementType, mod, context, mems)); 170 | } 171 | if (typeRef is GenericParameter) 172 | { 173 | if (((context != null) && !((typeRef as GenericParameter).Owner is TypeReference)) && ((typeRef as GenericParameter).Position < context.GenericParameters.Count)) 174 | { 175 | return context.GenericParameters[(typeRef as GenericParameter).Position]; 176 | } 177 | return typeRef; 178 | } 179 | if ((mems != null) && mems.ContainsKey(typeRef.MetadataToken)) 180 | { 181 | return (mems[typeRef.MetadataToken] as TypeReference); 182 | } 183 | if (!(reference is TypeDefinition) && (typeRef.Scope.Name != "Confuser.Core.Injections.dll")) 184 | { 185 | reference = mod.Import(reference); 186 | } 187 | return reference; 188 | } 189 | 190 | public static TypeDefinition Inject(ModuleDefinition mod, TypeDefinition type) 191 | { 192 | //type.Module.FullLoad(); 193 | Dictionary mems = new Dictionary(); 194 | TypeDefinition definition = _Inject(mod, type, mems); 195 | PopulateDatas(mod, type, mems); 196 | return definition; 197 | } 198 | 199 | private static void PopulateDatas(ModuleDefinition mod, TypeDefinition type, Dictionary mems) 200 | { 201 | TypeDefinition definition = mems[type.MetadataToken] as TypeDefinition; 202 | if (type.BaseType != null) 203 | { 204 | definition.BaseType = ImportType(type.BaseType, mod, null, mems); 205 | } 206 | foreach (TypeDefinition definition2 in type.NestedTypes) 207 | { 208 | PopulateDatas(mod, definition2, mems); 209 | } 210 | foreach (FieldDefinition definition3 in type.Fields) 211 | { 212 | if (!definition3.IsLiteral) 213 | { 214 | (mems[definition3.MetadataToken] as FieldDefinition).FieldType = ImportType(definition3.FieldType, mod, null, mems); 215 | } 216 | } 217 | foreach (MethodDefinition definition4 in type.Methods) 218 | { 219 | TransportAction visible = TransportAction.Public; 220 | if (!TypeCheck.KeepMethod(type, definition4, out visible)) 221 | continue; 222 | 223 | MethodAttributes methodAtt = definition4.Attributes; 224 | 225 | if (visible == TransportAction.Public) 226 | { 227 | if (methodAtt.HasFlag(MethodAttributes.Private)) 228 | methodAtt &= ~MethodAttributes.Private; 229 | 230 | methodAtt |= MethodAttributes.Public; 231 | } 232 | 233 | definition4.Attributes = methodAtt; 234 | 235 | PopulateMethod(mod, definition4, mems[definition4.MetadataToken] as MethodDefinition, mems); 236 | } 237 | } 238 | 239 | public static void PopulateMethod(ModuleDefinition mod, MethodDefinition mtd, MethodDefinition newMtd, Dictionary mems) 240 | { 241 | //mtd.Module.FullLoad(); 242 | newMtd.Attributes = mtd.Attributes; 243 | newMtd.ImplAttributes = mtd.ImplAttributes; 244 | if (mtd.IsPInvokeImpl) 245 | { 246 | newMtd.PInvokeInfo = mtd.PInvokeInfo; 247 | bool flag = false; 248 | foreach (ModuleReference reference in mod.ModuleReferences) 249 | { 250 | if (reference.Name == newMtd.PInvokeInfo.Module.Name) 251 | { 252 | flag = true; 253 | newMtd.PInvokeInfo.Module = reference; 254 | break; 255 | } 256 | } 257 | if (!flag) 258 | { 259 | mod.ModuleReferences.Add(newMtd.PInvokeInfo.Module); 260 | } 261 | } 262 | if (mtd.HasCustomAttributes) 263 | { 264 | foreach (CustomAttribute attribute in mtd.CustomAttributes) 265 | { 266 | CustomAttribute item = new CustomAttribute(ImportMethod(attribute.Constructor, mod, newMtd, mems), attribute.GetBlob()); 267 | newMtd.CustomAttributes.Add(item); 268 | } 269 | } 270 | foreach (GenericParameter parameter in mtd.GenericParameters) 271 | { 272 | GenericParameter parameter2 = new GenericParameter(parameter.Name, newMtd); 273 | if (parameter.HasCustomAttributes) 274 | { 275 | foreach (CustomAttribute attribute3 in parameter.CustomAttributes) 276 | { 277 | CustomAttribute attribute4 = new CustomAttribute(mod.Import(attribute3.Constructor), attribute3.GetBlob()); 278 | parameter2.CustomAttributes.Add(attribute4); 279 | } 280 | } 281 | newMtd.GenericParameters.Add(parameter2); 282 | } 283 | newMtd.ReturnType = ImportType(mtd.ReturnType, mod, newMtd, mems); 284 | foreach (ParameterDefinition definition in mtd.Parameters) 285 | { 286 | ParameterDefinition definition2 = new ParameterDefinition(definition.Name, definition.Attributes, ImportType(definition.ParameterType, mod, newMtd, mems)); 287 | if (definition.HasCustomAttributes) 288 | { 289 | foreach (CustomAttribute attribute5 in definition.CustomAttributes) 290 | { 291 | CustomAttribute attribute6 = new CustomAttribute(ImportMethod(attribute5.Constructor, mod, newMtd, mems), attribute5.GetBlob()); 292 | definition2.CustomAttributes.Add(attribute6); 293 | } 294 | } 295 | newMtd.Parameters.Add(definition2); 296 | } 297 | if (mtd.HasBody) 298 | { 299 | MethodBody body = mtd.Body; 300 | MethodBody body2 = new MethodBody(newMtd) 301 | { 302 | MaxStackSize = body.MaxStackSize, 303 | InitLocals = body.InitLocals 304 | }; 305 | ILProcessor iLProcessor = body2.GetILProcessor(); 306 | foreach (VariableDefinition definition3 in body.Variables) 307 | { 308 | body2.Variables.Add(new VariableDefinition(definition3.Name, ImportType(definition3.VariableType, mod, newMtd, mems))); 309 | } 310 | foreach (Instruction instruction in body.Instructions) 311 | { 312 | switch (instruction.OpCode.OperandType) 313 | { 314 | case OperandType.InlineTok: 315 | { 316 | if (!(instruction.Operand is FieldReference)) 317 | { 318 | goto Label_04F6; 319 | } 320 | iLProcessor.Emit(instruction.OpCode, ImportField(instruction.Operand as FieldReference, mod, mems)); 321 | continue; 322 | } 323 | case OperandType.InlineType: 324 | { 325 | iLProcessor.Emit(instruction.OpCode, ImportType(instruction.Operand as TypeReference, mod, newMtd, mems)); 326 | continue; 327 | } 328 | case OperandType.InlineVar: 329 | case OperandType.ShortInlineVar: 330 | { 331 | int num2 = body.Variables.IndexOf(instruction.Operand as VariableDefinition); 332 | iLProcessor.Emit(instruction.OpCode, body2.Variables[num2]); 333 | continue; 334 | } 335 | case OperandType.InlineArg: 336 | case OperandType.ShortInlineArg: 337 | { 338 | if (instruction.Operand != body.ThisParameter) 339 | { 340 | break; 341 | } 342 | iLProcessor.Emit(instruction.OpCode, body2.ThisParameter); 343 | continue; 344 | } 345 | case OperandType.InlineMethod: 346 | { 347 | iLProcessor.Emit(instruction.OpCode, ImportMethod(instruction.Operand as MethodReference, mod, newMtd, mems)); 348 | continue; 349 | } 350 | case OperandType.InlineField: 351 | { 352 | iLProcessor.Emit(instruction.OpCode, ImportField(instruction.Operand as FieldReference, mod, mems)); 353 | continue; 354 | } 355 | default: 356 | goto Label_055A; 357 | } 358 | int index = mtd.Parameters.IndexOf(instruction.Operand as ParameterDefinition); 359 | iLProcessor.Emit(instruction.OpCode, newMtd.Parameters[index]); 360 | continue; 361 | Label_04F6: 362 | if (instruction.Operand is MethodReference) 363 | { 364 | iLProcessor.Emit(instruction.OpCode, ImportMethod(instruction.Operand as MethodReference, mod, newMtd, mems)); 365 | } 366 | else if (instruction.Operand is TypeReference) 367 | { 368 | iLProcessor.Emit(instruction.OpCode, ImportType(instruction.Operand as TypeReference, mod, newMtd, mems)); 369 | } 370 | continue; 371 | Label_055A: 372 | iLProcessor.Append(instruction); 373 | } 374 | for (int i = 0; i < body2.Instructions.Count; i++) 375 | { 376 | Instruction instruction2 = body2.Instructions[i]; 377 | Instruction instruction3 = body.Instructions[i]; 378 | if (instruction2.OpCode.OperandType == OperandType.InlineSwitch) 379 | { 380 | Instruction[] operand = (Instruction[])instruction3.Operand; 381 | Instruction[] instructionArray2 = new Instruction[operand.Length]; 382 | for (int j = 0; j < instructionArray2.Length; j++) 383 | { 384 | instructionArray2[j] = body2.Instructions[body.Instructions.IndexOf(operand[j])]; 385 | } 386 | instruction2.Operand = instructionArray2; 387 | } 388 | else if ((instruction2.OpCode.OperandType == OperandType.ShortInlineBrTarget) || (instruction2.OpCode.OperandType == OperandType.InlineBrTarget)) 389 | { 390 | instruction2.Operand = body2.Instructions[body.Instructions.IndexOf(instruction2.Operand as Instruction)]; 391 | } 392 | } 393 | foreach (ExceptionHandler handler in body.ExceptionHandlers) 394 | { 395 | ExceptionHandler handler2 = new ExceptionHandler(handler.HandlerType); 396 | if (body.Instructions.IndexOf(handler.TryStart) != -1) 397 | { 398 | handler2.TryStart = body2.Instructions[body.Instructions.IndexOf(handler.TryStart)]; 399 | } 400 | if (body.Instructions.IndexOf(handler.TryEnd) != -1) 401 | { 402 | handler2.TryEnd = body2.Instructions[body.Instructions.IndexOf(handler.TryEnd)]; 403 | } 404 | if (body.Instructions.IndexOf(handler.HandlerStart) != -1) 405 | { 406 | handler2.HandlerStart = body2.Instructions[body.Instructions.IndexOf(handler.HandlerStart)]; 407 | } 408 | if (body.Instructions.IndexOf(handler.HandlerEnd) != -1) 409 | { 410 | handler2.HandlerEnd = body2.Instructions[body.Instructions.IndexOf(handler.HandlerEnd)]; 411 | } 412 | switch (handler.HandlerType) 413 | { 414 | case ExceptionHandlerType.Catch: 415 | handler2.CatchType = ImportType(handler.CatchType, mod, newMtd, mems); 416 | break; 417 | 418 | case ExceptionHandlerType.Filter: 419 | handler2.FilterStart = body2.Instructions[body.Instructions.IndexOf(handler.FilterStart)]; 420 | break; 421 | } 422 | body2.ExceptionHandlers.Add(handler2); 423 | } 424 | newMtd.Body = body2; 425 | } 426 | } 427 | private static void RefreshType(ref int type, ref int fld, ref int mtd, TypeDefinition typeDef) 428 | { 429 | typeDef.MetadataToken = new MetadataToken(Mono.Cecil.TokenType.TypeDef, type); 430 | type++; 431 | foreach (FieldDefinition definition in typeDef.Fields) 432 | { 433 | definition.MetadataToken = new MetadataToken(Mono.Cecil.TokenType.Field, fld); 434 | fld++; 435 | } 436 | foreach (MethodDefinition definition2 in typeDef.Methods) 437 | { 438 | definition2.MetadataToken = new MetadataToken(Mono.Cecil.TokenType.Method, mtd); 439 | mtd++; 440 | } 441 | foreach (TypeDefinition definition3 in typeDef.NestedTypes) 442 | { 443 | RefreshType(ref type, ref fld, ref mtd, definition3); 444 | } 445 | } 446 | } --------------------------------------------------------------------------------