├── src ├── Jlion.Process.Client │ ├── packages.config │ ├── Properties │ │ ├── Settings.settings │ │ ├── Settings.Designer.cs │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ └── Resources.resx │ ├── App.xaml.cs │ ├── App.xaml │ ├── MainWindow.xaml.cs │ ├── MainWindow.xaml │ ├── Jlion.Process.Client.sln │ ├── InjectService.cs │ ├── Jlion.Process.Client.csproj │ └── FastWin32.xml ├── Jlion.Process.Target.Client │ ├── Properties │ │ ├── Settings.settings │ │ ├── Settings.Designer.cs │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ └── Resources.resx │ ├── App.xaml.cs │ ├── Model │ │ ├── ProcessRequest.cs │ │ └── ProcessResponse.cs │ ├── App.xaml │ ├── Service │ │ └── ProcessService.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ └── Jlion.Process.Target.Client.csproj └── Jlion.Process.HookCore │ ├── packages.config │ ├── Model │ ├── ProcessRequest.cs │ └── ProcessResponse.cs │ ├── HookService.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── HookService │ └── ProcessHookService.cs │ ├── Jlion.Process.HookCore.csproj │ ├── DotNetDetour.xml │ └── TextHelper.cs ├── README.md ├── Jlion.Process.Client.sln ├── .gitattributes └── .gitignore /src/Jlion.Process.Client/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Jlion.Process.Client/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Jlion.Process.Target.Client/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Jlion.Process.HookCore/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/Jlion.Process.Client/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Windows; 7 | 8 | namespace Jlion.Process.Client 9 | { 10 | /// 11 | /// App.xaml 的交互逻辑 12 | /// 13 | public partial class App : Application 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Jlion.Process.HookCore/Model/ProcessRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Jlion.Process.HookCore.Model 7 | { 8 | public class ProcessRequest 9 | { 10 | /// 11 | /// 版本信息 12 | /// 13 | public string Version { set; get; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Jlion.Process.Target.Client/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Windows; 7 | 8 | namespace Jlion.Process.Target.Client 9 | { 10 | /// 11 | /// App.xaml 的交互逻辑 12 | /// 13 | public partial class App : Application 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Jlion.Process.Target.Client/Model/ProcessRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Jlion.Process.Target.Client.Model 7 | { 8 | public class ProcessRequest 9 | { 10 | /// 11 | /// 版本信息 12 | /// 13 | public string Version { set; get; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # processClientDemo 2 | 跨进程改写目标方法(注入dll 到第三方运行的程序进行第三方程序方法拦截改写) 3 | 4 | ### Hook 5 | 通过开源框架DotNetDotour 进行第三方方法Hook 重新第三方方法,前提是需要知道第三方程序中有那些方法(有些没加壳的比较好办,加壳的就得想办法反编译脱壳了) 6 | DotNetDotour 开源框架我fork 的地址:https://github.com/a312586670/DotNetDetour 我针对开源框架做了降级处理,支持.net framework 4 版本,开源作者里面的支持4.5+ 7 | 故我fork 了一份(项目环境需要) 8 | 9 | ### FastWin32 10 | 通过 FastWin32 把重新的Hook dll 模块动态注入到第三方运行的程序中,并且执行Hook初始化操作,这样即可覆盖掉原有的第三方程序指定的方法,做自己的业务 11 | -------------------------------------------------------------------------------- /src/Jlion.Process.Client/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/Jlion.Process.Target.Client/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/Jlion.Process.HookCore/Model/ProcessResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Jlion.Process.HookCore.Model 7 | { 8 | public class ProcessResponse 9 | { 10 | /// 11 | /// 客户端名称 12 | /// 13 | public string Name { set; get; } 14 | 15 | /// 16 | /// 版本信息 17 | /// 18 | public string Version { set; get; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Jlion.Process.Target.Client/Model/ProcessResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Jlion.Process.Target.Client.Model 7 | { 8 | public class ProcessResponse 9 | { 10 | /// 11 | /// 客户端名称 12 | /// 13 | public string Name { set; get; } 14 | 15 | /// 16 | /// 版本信息 17 | /// 18 | public string Version { set; get; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Jlion.Process.Target.Client/Service/ProcessService.cs: -------------------------------------------------------------------------------- 1 | using Jlion.Process.Target.Client.Model; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Jlion.Process.Target.Client 8 | { 9 | public class ProcessService 10 | { 11 | public string GetProcessInfo() 12 | { 13 | return "这是TargetClient 客户端(第三方程序)"; 14 | } 15 | 16 | 17 | public ProcessResponse GetProcessInfo(ProcessRequest request) 18 | { 19 | return new ProcessResponse() 20 | { 21 | Name = "这是TargetClient 客户端(第三方程序)", 22 | Version = request.Version 23 | }; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Jlion.Process.HookCore/HookService.cs: -------------------------------------------------------------------------------- 1 | using DotNetDetour; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Jlion.Process.HookCore 8 | { 9 | public class HookService 10 | { 11 | /// 12 | /// Hook 初始化 13 | /// 14 | /// 15 | /// 16 | public static int Start(string msg) 17 | { 18 | try 19 | { 20 | TextHelper.LogInfo("开始"+msg); 21 | MethodHook.Install(); 22 | } 23 | catch 24 | { 25 | return -1; 26 | } 27 | return 1; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Jlion.Process.Client/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Data; 8 | using System.Windows.Documents; 9 | using System.Windows.Input; 10 | using System.Windows.Media; 11 | using System.Windows.Media.Imaging; 12 | using System.Windows.Navigation; 13 | using System.Windows.Shapes; 14 | 15 | namespace Jlion.Process.Client 16 | { 17 | /// 18 | /// MainWindow.xaml 的交互逻辑 19 | /// 20 | public partial class MainWindow : Window 21 | { 22 | public MainWindow() 23 | { 24 | InitializeComponent(); 25 | } 26 | 27 | private void btnInject_Click(object sender, RoutedEventArgs e) 28 | { 29 | InjectService.pid = Convert.ToUInt32(txbPid.Text.Trim()); 30 | InjectService.Start(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Jlion.Process.Client/MainWindow.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 |