使用cecil 完毕 code injection
1. 安装Mono.Cecil
2. 创建一个測试项目:
加入測试方法:
这种方法的返回值会被动态重写.
public class Class1{public static string Test(){return "ok";}}
3. code Injection 代码:
var path = @"\XX\bin\Debug\ClassLibrary1.dll";var assembly = AssemblyDefinition.ReadAssembly(path);var type =assembly.MainModule.GetType("ClassLibrary1.Class1");var foundMethod = type.GetMethods().First(m => m.Name =="Test");
清空当前方法指令foundMethod.Body.Instructions.Clear();
获得当前IL的指令执行器var worker = foundMethod.Body.GetILProcessor();
改动返回值Instruction ins1 = worker.Create(OpCodes.Ldstr, "will be changed onnext time run");Instruction ins2 = worker.Create(OpCodes.Ret);worker.Append(ins1);worker.Append(ins2);
保存DLL文件assembly.Write(path);下次调用就会看到(由于新保存的DLL下次才干载入到)Console.WriteLine(Class1.Test());Console.Read();
4. 执行查看结果
使用cecil 完毕 code injection相关推荐
- 使用cecil 完成 code injection
1. 安装Mono.Cecil 2. 创建一个测试项目: 添加测试方法: 这个方法的返回值会被动态重写. public class Class1{public static string Test() ...
- OBSIDIUM V1.25 Code Injection
OBSIDIUM V1.25 Code Injection [目 标]: 超级自动注册申请王 V1.9 [工 具]: [任 务]:不脱壳代码注入破解 [操作平台]:Win200 ...
- Linux Running State Process .so、code Injection Technology
catalog 0. 引言 1. 基于so文件劫持进行代码注入 2. 基于函数符号表(PLT)中库函数入口地址的修改进行代码注入 3. PLT redirection through shared o ...
- CVE: 2014-6271 Bash Specially-crafted Environment Variables Code Injection Vulnerability Analysis
1. 漏洞的起因 这个漏洞的起因源自于Bash(Bourne Again SHell)的ENV指令 http://ss64.com/bash/env.html env: Display, set, o ...
- Characterizing, exploiting, and detecting DMA code injection vulnerabilities,Eurosys2021
Characterizing, exploiting, and detecting DMA code injection vulnerabilities in the presence of an I ...
- Bash Specially-crafted Environment Variables Code Injection Vulnerability Analysis
http://www.cnblogs.com/LittleHann/p/3992778.html 转载于:https://www.cnblogs.com/cybertitan/p/3999011.ht ...
- 运用Mono.Cecil 反射读取.NET程序集元数据
CLR自带的反射机智和API可以很轻松的读取.NET程序集信息,但是不能对程序集进行修改.CLR提供的是只读的API,但是开源项目Mono.Cecil不仅仅可以读取.NET程序集的元数据,还可以进行修 ...
- code representation-CPG
Modeling and Discovering Vulnerabilities with Code Property Graphs 一.背景 二.Representations Of Code 2. ...
- C++内存管理(转)http://www.cnblogs.com/qiubole/archive/2008/03/07/1094770.html
[导语] 内存管理是C++最令人切齿痛恨的问题,也是C++最有争议的问题,C++高手从中获得了更好的性能,更大的自由,C++菜鸟的收获则是一遍一遍的检查代码和对C++的痛恨,但内存管理在C++中无处不 ...
- 用户领域 API 监控和代码注入检测
原文地址:Userland API Monitoring and Code Injection Detection 原文作者:dtm 译文出自:掘金翻译计划 本文永久链接:github.com/xit ...
最新文章
- 2022-2028年中国灭火器行业市场前瞻与投资战略规划分析报告
- vlc的应用之十:vlc的远程控制
- 28-Interview-面试
- 少走弯路,给Java 1~5 年程序员的建议
- boost::timer库使用
- 智能门锁能实现哪些生活场景?
- ROS学习笔记10(创建一个ROS消息和服务)
- 浅析 C++智能指针和 enable_shared_from_this 机制
- BZOJ2934 : [Poi1999]祭坛问题
- HDU2156 分数矩阵【数学计算+水题】
- [原] 求薪水第三高的雇员的SQL题(图解)
- 系泊系统设计建模matlab程序,系泊系统设计-数学建模论文.docx
- 常用密码技术-对称加密
- php 正则 问号,正则表达式的问号需要怎样使用
- Jetpack之LiveData
- 修复计算机有什么用,电脑硬盘坏道修复了对以后电脑使用有什么影响吗?
- 打造离线版 123D Catch
- 网站关键词排名优化中常见的问题及解决方法
- 计算机中存储数据最小的单位是什么,计算机中存储数据的最小单位和存储容量的基本单位各是什么?...
- JAVA:String类型