可以拦截C#DLL的神器,比如要给一个现成的系统加个日志啥的。
============================================
Project Description
CInject (or CodeInject) allows code injection into any managed assembly without disassembling and recompiling it. It eases the inevitable task of injecting any code in single or multiple methods in one or many assemblies to intercept code for almost any purpose.
When using CInject, you do not require any knowledge of the target application. You can create your own injectors very easily and inject them in any target assembly/executable. An example is provided with this application. If you have an existing code which has no logging or no diagnostics, inject it with CInject and execute it as usual to generate log files. Helps you analyze any code and ease your reverse engineering exercise.
Provides runtime intelligence such as
- Values of arguments to the called function
- Object life time of a method / variables called within the method
- Allows customization of logging or diagnostics
- Allows extension of injectors to tailor your own solution as the need be
- Measure the method execution time to check performance
Build your own plugins using CInject information
- CInject supports building your own plugins
- The plugin receives information from the application such as
- Target assembly & method
- Injector assembly & method
- Processing details, results with timestamp
- Exceptions and errors
- Customized Plugin menu in CInject application
And its easy to implement a plugin, just implement IPlugin interface and copy it in the Plugins folder.
If you are look at compile time injection, you may want to try dI.Hook at CodePlex or Nuget
It is developed in C# and uses Mono.Cecil for code interception and log4net for logging purposes.
Perceived and Initiated by : Punit Ganshani [ http://www.ganshani.com ]
How do I contribute?
You have an idea? You are a developer? Great!
The project is looking for serious/part contributors to help build the injectors, or optimize the injection techniques. So please mail me via http://www.ganshani.com/contact-me to be added as a contributor to this project.
Quick Guide and Examples
- Check out Documentation on CodePlex website - http://codeinject.codeplex.com/documentation
- Stay tuned to the project page - http://www.ganshani.com/applications/cinject-code-injector/
FAQ
Can I have the source code?
Yes, the source code is available on codeplex
Can I use it in my organization?
Yes, you can use it.
I have some doubts, how can I ask?
Please use the 'Discussions' tab
Do I get to know the value of arguments at runtime?
Yes, that's the actual beauty of CInject. It lets you know the value of arguments to a function at runtime.
Can I inject static methods?
Yes. In the current release, you can call create a class that implements ICInject interface and call static methods. In later release, provision for calling static methods directly will be added as well.
What version of .NET is this built on? Can I use it with other versions?
CInject is built on .NET 4.0 runtime. To use it with other versions, rebuild the Injectors, or create your own using .NET 2.0, 3.0, 3.5.
How do I distribute my plugin?
You have many alternatives to distribute the plugin
- Host the source code on CodePlex and link it with this project
- Provide the source code, and get it hosted on this webpage & www.ganshani.com website
- Host the source code on GitHub, or other repository websites and provide us the link for promotion purposes
How about code injection at compile time?
If you are looking at dynamic injection based on the code you have written in an assembly, it would be worth while trying dI.Hook You can define the injections (or called hooks) in configuration file and invoke them wherever required.
Last edited Aug 7, 2012 at 4:36 PM by punitganshani, version 14
相关推荐
《iPad2完美越狱工具cinject_0.4.3详解》 在iOS设备的世界里,越狱一直是一个备受关注的话题。它为用户提供了更大的自由度,可以自定义设备、安装不受App Store限制的应用,以及调整系统设置。cinject_0.4.3是一款...
- `CInject`类:MFC中,通常会定义一个主类来封装DLL注入的功能,这个类可能继承自`CWinApp`,并包含注入逻辑的成员函数。 - `DllMain`函数:DLL的入口点,系统在加载DLL时会调用此函数。开发者可能在这里实现一些...
向指定的进程注入指定的DLL,并调用DLL中指定的方法; DWORD pid = CInjectUtils::GetProcessIdByName("QQ.exe");...CInject c; c.inject(pid,"c:/mydll.dll","startup");//startup为mydll.dll中的一个函数名称
"cinject.exe"可能是Windows环境下的执行文件,而"cinject"可能是对应的源代码或者在其他操作系统上的可执行文件。 "README.txt":这是一个标准的文本文件,通常包含关于软件包的说明、使用指南、注意事项或开发者...
3. **进程通信**:CInject可能包含了一些进程间通信(IPC)的机制,例如使用Windows的CreateProcess、OpenProcess、WriteProcessMemory和CreateRemoteThread等API,以控制目标进程的行为。 4. **跨平台兼容性**:...
) 使用EnTT框架的ECS范例: 世界:将实体组合在一起的类系统:您可以在应用程序启动时手动创建系统或自动创建系统(类似于ECS在Unity3D上的工作方式) 组件:它们只是简单的结构通过使用CInject以及上下文和安装...