`

Using Injectors with CInject

 
阅读更多

Using Injectors with CInject

If you don’t know what is CInject, I would recommend you to read this article and get the latest version of CInject from CodePlex website.

There are few injectors that are shipped with CInject

  • LogInjector - Allows injecting logging in any .NET assembly/executable even if you do not have code of the assembly/executable.  LogInjector is built on .NET 4.0 Client Profile and uses log4net for logging purpose
  • PerformanceInjector – Allows logging the time required to execute injected method in the target assemblies
  • ObjectValueInjector – Allows getting any property of arguments passed to the injected method

You can get started with directly using them without writing a single line of code.

 

Quick Guide to using CInject

So, to get started all you would require is to

  • Download the latest stable version of CInject and unzip it to, lets say, C:\CInject
  • Locate the assemblies (DLL) / executables (EXE) that need to be injected with along with their configuration files
  • Locate your injectors assembly (DLL) and their configuration files.
  • Open the downloaded CInject application [C\CInject\Cinject.exe]
  • Choosing the Target Assembly
    • If you are targeting a single assembly (to be injected), click on Assembly > Load Assembly (F3).  As soon as you select the assembly, CInject will try to create a tree of classes and methods in the assembly.
    • If you are targeting multiple assemblies (to be injected), click on Assembly > Select Directory (F2).  CInject will browse through DLLs and EXEs in the directory and create a tree of classes and methods in each assembly or executable
  • Choosing the Injector AssemblySelect all the classes/methods (in the blue panel) that you would want to inject. Then, select the LogInjector (in the yellow panel)
    • Auto Load – If you have copied the injector assemblies into CInject directory [here, C:\CInject], they will be automatically loaded in CInject
    • Manually Load - Click on Assembly > Load Injector (F4).  This will load the injectors
CInject-DefaultInjectors
  • You can click on ‘Add selected injectors to selected methods in target assembly’.  This will add some entries in the grid (Assembly, Method, Injector).  However, this does not mean that the assembly has been injected.  If by mistake you have selected a wrong injector or a method, you can remove them by selecting it in the grid and clicking ‘Remove selected row’
  • Select Inject > Run (F5) to inject and proceed ahead to inject the target assemblies.
CInject-RunInject
  • You will be prompted when the injection has been completed.  With CInject 1.4, all the required files for each injector will be automatically copied to the folder of target assembly
  • You can now execute the target assembly. This is the new assembly with selected injectors
 

LogInjector Configuration

You can alter the log configuration by editing LogInject.log4net.xml based on the Apache log4net configuration.

Currently, LogInjector supports DEBUG, INFO and ERROR modes

  • Debug:   Prints additional information such as calls to the destructor of the method, type of parameter to each method invoked
  • Info: Just logs the name method invoked
  • Error: Logs exceptions if LogInjector fails at any point

Apart from the method information, it logs Data-Time, Thread Id, and Assembly.  You can configure these details in the xml file accompanied with the CInject executables.

In case you would want to use any other version of .NET, you would have to rebuild the code in Visual Studio.

PerformanceInjector Configuration

PerformanceInjector also uses log4net for logging the performance of the methods.  The configuration can be mentioned in loginject.log4net.xml file.

PerformanceInjector supports only INFO level of logging.

ObjectValueInjector Configuration

ObjectValueInjector uses ObjectSearch.xml to define which property needs to be retrieved in the arguments to the injected methods.

If the defined property (in configuration) does not exist in the argument, this injector does not throw any exception.  If the defined property (in configuration) exist in the argument, injector will try to get the value of the property.  If property value is NULL, it will log <null>

ObjectValueInjector uses DEBUG level of logging

Related Posts:

Post navigation

(c) Punit Ganshani, 2006-2014

分享到:
评论

相关推荐

    redux-injectors:用于Redux减速器和sagas的异步喷油器。 如React样板所用

    入门npm install redux-injectors # (or yarn add redux-injectors)设置redux存储需要将redux存储配置为允许该库工作。 该库导出了商店增强器,可以将其传递给createStore函数。 import { createStore } from "redux...

    Become A Ninja With Angular

    文档详细介绍了如何进行依赖注入(DI)、DI的便利开发、易于配置的特性,以及其他类型的提供者(Other types of provider)、分层注入器(Hierarchical injectors)、以及无需类型的依赖注入(DI without types)。...

    Understanding Automotive Electronics 8th - Chapter 11

    Until the early 1970s, however, a great deal of the routine maintenance and repair was done by car owners themselves, using inexpensive tools and equipment. However, the Clean Air Act affected not ...

    Fluid sample injectors for x-ray free electron laser at SACLA

    This paper provides a review on sample injectors which are provided at SPring-8 Angstrom Compact free electron LAser (SACLA) for conducting serial measurement in a ‘diffract-before-destroy’ scheme ...

    sql-injectors:项目二

    蜂蜜生产 该小组项目的动机是使用数据创建多个可视化图像,以回答1998年至2012年美国蜂蜜生产方面的一系列问题。我们希望该项目能够完成的工作是让用户自己绘制通过我们网页上显示的数据可视化得出结论。...

    reducer:Javascript 天真的减速器

    减速器 这是一个简单而幼稚的 reducer 实现。 Reducers 允许在单个循环中应用链式算法。 它还为函数式编程提供了更兼容的参数位置。 例子 使用地图: import { map , reduce } from 'reducer' ;...

    redux-prim:redux帮助器工具,用于使用getDefaultState和updaters抽象动作和reducer

    redux-prim redux-prim在redux之上构建一个抽象层,从而进行状态管理: 初始状态: getDefaultState 国家修改: updaters和namespacing 动作和归约器被大大削弱,而在抽象层下,一切保持不变: ...

    AngularJS 2.0新特性有哪些

    Child injectors允许子组件根据需要获取特定的服务,而实例范围的改进则使得服务管理更加可控。 3. Annotations:Annotations是AtScript中的一个重要特性,它们允许开发者关联元数据和功能,方便DI库获取必要的信息...

    redux-inject:Redux中间件生成器,允许将依赖项注入到动作创建者中

    Redux注入(已存档) 注意:此项目已存档。 不会进行进一步的更新。 Redux中间件生成器,允许将依赖项注入到动作创建者中。安装npm install redux-inject用法示例(ES6 / ES7) import { applyMiddleware , ...

    x64-injector:使用汇编器(MASM)中的LoadLibrary的x64进样器

    【x64-injector:使用汇编器(MASM)中的LoadLibrary的x64进样器】 在深入探讨x64-injector之前,我们先了解几个基础概念。x64指的是64位版本的Windows操作系统,而汇编语言(Assembly)是一种低级编程语言,它直接...

    PEx64-Injector:将x64位可执行文件注入到任何进程中,并将其屏蔽为合法的进程,以进行防病毒规避

    GIF演示怎么用?下载。用法:Migrator.exe有效负载(fpath)Migratefile(fpath)示例:Migrator.exe C:\ Users \ User \ Desktop \ Putty64.exe C:\ Windows \ System32 \ notepad.exe请注意,当您指定...

    基于StrangeIoC的点击方块加分的Demo

    3. **Injectors**: StrangeIoC使用Injectors将依赖项注入到需要它们的对象中。这可以是字段、属性或方法,使得对象无需自己创建或查找依赖项。 4. **Signals/EventSystem**: StrangeIoC的信号系统允许对象之间进行...

    Network Security Tools By Justin Clarke, Nitesh Dhanjani

    It also addresses port scanners, packet injectors, network sniffers, and web assessment tools. Network Security Tools is the one resource you want at your side when locking down your network.

    ChatServer:服务器将处理来自不同客户端的请求并将消息分发到适当的通道

    聊天服务器鞍背学院CS4B迷你项目入门运行以下命令在您的计算机上复制此存储库: git clone https://github.com/SQL-Injectors-Saddleback/ChatServer.git 进行更改之前,首先为要使用的功能创建一个分支。...

    deposit:将动态资源注入您的 html 页面

    // Set up injectors d . injector ( 'fetch' , require ( 'deposit-fetch' ) ) ; d . injector ( 'env' , function ( options , done ) { // Do stuff done ( ) ; } ) ; http . createServer ( function ( req , ...

    PEiD 0.95全插件 个人版--汉化

    以及各种针对特定壳类别的插件,如 Packers, Crypters 和 Injectors。 关于软件可能报毒的情况,这通常是由于反病毒软件的误报。某些壳或者反调试技术可能会触发反病毒软件的警报,因为它们的行为与恶意软件有相似...

    最新版FakePCIID

    Injectors目录可能包含了用于注入模拟PCI ID的代码或脚本。Debug文件可能是一些调试工具或日志,有助于诊断和解决问题。 总的来说,"最新版FakePCIID"是一个用于改善非苹果硬件在macOS系统下兼容性的工具,它通过...

    syringe:基于spoon的源代码注入库

    注射器 Syringe是一个轻量级的库,用于检测Java源代码。 Syringe构建在Spoon开放编译器之上,允许用户使用Spoon元模型检测Java语言的大多数元素。 允许使用自定义过滤来分离那些... // and injectors. Detectors detect

    FlexMateLogin

    1. **Injectors**:注入器负责在运行时将依赖关系连接到视图和控制器。在FlexMateLogin中,可能会有注入器定义如何将用户输入的数据绑定到模型。 2. **EventMap**:事件映射是Mate的关键部分,它定义了事件触发时...

Global site tag (gtag.js) - Google Analytics