CInject - Code Inject & Runtime Intelligence

可以拦截C#DLL的神器,比如要给一个现成的系统加个日志啥的。

CInject 

============================================

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

 


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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值