Intel Pin初探
1、在/home/hf/Desktop/pin/pin-3.30-98830-g1d7b601b3-gcc-linux/source/tools/ManualExamples/目录下写自己的pintools
去到该目录
cd /home/hf/Desktop/pin/pin-3.30-98830-g1d7b601b3-gcc-linux/source/tools/ManualExamples/
编写pintools
vim Mycmp.cpp
下面是Mycmp.cpp内容
#include "pin.H"
#include <iostream>
#include <fstream>
std::ofstream outfile;
VOID Instruction(INS ins, VOID *v)
{
if (INS_Opcode(ins) == XED_ICLASS_CMP)
{
outfile << "CMP Instruction at address: " << INS_Address(ins) << std::endl;
for (UINT32 i = 0; i < INS_OperandCount(ins); ++i)
{
if (INS_OperandIsReg(ins, i))
{
outfile << "Operand " << i << ": Register" << std::endl;
}
else if (INS_OperandIsMemory(ins, i))
{
outfile << "Operand " << i << ": Memory" << std::endl;
}
else if (INS_OperandIsImmediate(ins, i))
{
outfile << "Operand " << i << ": Immediate Value: " << INS_OperandImmediate(ins, i) << std::endl;
}
}
outfile << std::endl;
}
}
VOID Fini(INT32 code, VOID *v)
{
outfile.close();
}
int main(int argc, char *argv[])
{
// Initialize Pin
PIN_InitSymbols();
if (PIN_Init(argc, argv))
{
return -1;
}
// Open output file
outfile.open("cmp_operations.txt");
// Register Instruction to be called to instrument instructions
INS_AddInstrumentFunction(Instruction, 0);
// Register Fini to be called when the application exits
PIN_AddFiniFunction(Fini, 0);
// Start the program, never returns
PIN_StartProgram();
return 0;
}
2、生成pintool
当前在目录下
输入
make obj-intel64/Mycmp.so TARGET=intel64
这时可以在obj-intel64目录下查看到Mycmp.so

3、使用Pintool
我的mytools.so在/home/hf/Desktop/pin/pin-3.30-98830-g1d7b601b3-gcc-linux/source/tools/ManualExamples/obj-intel64/,要分析的service.exe在/home/hf/Desktop/pin/
去目录下
cd /home/hf/Desktop/pin/pin-3.30-98830-g1d7b601b3-gcc-linux/
使用命令执行pintool
./pin -t /home/hf/Desktop/pin/pin-3.30-98830-g1d7b601b3-gcc-linux/source/tools/ManualExamples/obj-intel64/Mycmp.so -- /home/hf/Desktop/pin/service.exe
这个命令的格式为 pin -t <pintool目录绝对路径> -- <要分析的程序的绝对路径>
上面的方法会将结果输出到命令行,我们还可以将结果输出到一个文本文件中,只需在命令后加上 > output.txt
即
./pin -t /home/hf/Desktop/pin/pin-3.30-98830-g1d7b601b3-gcc-linux/source/tools/ManualExamples/obj-intel64/Mycmp.so -- /home/hf/Desktop/pin/service.exe > output.txt
注意:此时可能没有操作server.exe的权限
使用命令查看server.exe的权限
ls -l /home/hf/Desktop/pin/Server.exe
如果输出中没有执行权限(x 权限),可以使用 chmod 命令添加执行权限:
chmod +x /home/hf/Desktop/pin/Server.exe
Intel Pin初探的更多相关文章
- Intel pin 2.14/CentOS 6 X86-64/安装
环境:Intel Pin 2.14 CentOS 6 X86-64 --linux.tar.gz 进入 ./source/tools/ManualExamples make all TARGET=in ...
- intel Pin:动态二进制插桩的安装和使用,以及如何开发一个自己的Pintool
先贴几个你可能用得上的链接 intel Pin的官方介绍Pin: Pin 3.21 User Guide (intel.com) intel Pin的API文档Pin: API Reference ( ...
- Intel Pin基础
参考:http://software.intel.com/sites/landingpage/pintool/docs/62732/Pin/html/ http://blog.nruns.com/bl ...
- [转]Data Structure Recovery using PIN and PyGraphviz
Source:http://v0ids3curity.blogspot.com/2015/04/data-structure-recovery-using-pin-and.html --------- ...
- Tracing Memory access of an oracle process : Intel PinTools
https://mahmoudhatem.wordpress.com/2016/11/07/tracing-memory-access-of-an-oracle-process-intel-pinto ...
- pin-a-binary-instrumentation-tool
https://software.intel.com/en-us/articles/pin-a-binary-instrumentation-tool-downloads Introduction t ...
- Vuzzer自动漏洞挖掘工具简单分析附使用介绍
Vuzzer 是由计算机科学机构 Vrije Universiteit Amsterdam.Amsterdam Department of Informatics 以及 International ...
- VEX IR语言语法
/*---------------------------------------------------------------*//*--- High-level IR description - ...
- libVEX学习
VEX IR是一种更加接近于compiler使用的中间语言/中间表示,它是不依赖于特定体系架构的. 1. Code Blocks code blocks是VEX处理代码的一个单元,使用IRSB结构体表 ...
- Valgrind学习
Valgrind与其他DBI(Pin, DynamoRIO)的区别 我们需要了解DBI的几个 D&R Disassemble-and-Resynthesise 反汇编后重新组装 Valgrin ...
随机推荐
- 邀请参与第四季度 Flutter 开发者调查
本次调研会较为详细地了解大家对 Flutter 框架.开发语言.package 生态 (包括 Firebase package).IDE 插件以及 Material Design / Cupertin ...
- Apache-Shiro <=1.2.4 反序列化漏洞 (代码审计)
一.Apache Shiro 简介: Apache Shiro提供了认证.授权.加密和会话管理功能,将复杂的问题隐藏起来,提供清晰直观的API使开发者可以很轻松地开发自己的程序安全代码.并且在实现此目 ...
- 阿里邮箱网页正常登陆,outlook报错
事件起因: 某客户使用阿里邮箱办公,然又使用outlook绑定阿里邮箱:在网页端可以登录阿里邮箱,但是在outlook的登录的时候,服务器.端口均设置无误,但是就是登录不上去,死活都等登录不上去,总是 ...
- Java使用snmp协议采集服务器信息
Java使用snmp协议采集服务器信息 一.snmp简介 SNMP是专门设计用于在 IP 网络管理网络节点(服务器.工作站.路由器.交换机及Hubs等)的一种标准协议,它是一种应用层协议. ...
- 使用 vite 配置目录别名
你是否被 ../ ../../ 这样的路径折磨的心力憔悴,如果你使用 vite 的话,不妨来试试 alias 命名目录吧. 安装 @types/node 来加载 path 模块 npm i @type ...
- .Net 反射的学习
// 反射 // 一切从 type 开始 2 种拿到 type 的方式 // 作用:动态的操作对象 获取属性 方法 特性 // 1. 拿到对象的 type // typeof(类); // 2. 拿到 ...
- yarn serve 不能开启vue项目 the project seem to require yarn but isnot install
error: answer: 删除 yarn.lock 或者使用 npm run serve 替换 ; ps: yarn.lock 是锁定第三方包版本的文件:
- 谈谈你对 vue 的理解
vue 是创建用户界面的 js 框架 ,是创建 spa 应用的框架 :使用 mvvm 模式,数据驱动视图模型 ,业务逻辑和页面解构分离开发:使用高效的 diff 算法渲染页面结构 : 采用组件化模式, ...
- python中模块的概念以及常用模块
模块的概念:为了减少常用代码重复输入,同时方便多人协作,python中定义了模块一词. 模块是一些函数的集合.在python中可以使用import导入某一模块的单个或者所有功能. python中的模块 ...
- 云原生周刊:Argo Rollouts 支持 Kubernetes Gateway API 1.0 | 2024.7.1
开源项目 Kubetools Recommender System Kubetools Recommender System (Krs) 是一个基于 GenAI 的工具,用于帮助管理和优化 Kuber ...