frida 简单试用
内容来自官方访问,主要是一个学习试用
安装frida
推荐基于venv
python3 -m venv venv
source venv/bin/activate
pip install frida-tools
案例
进行分析c 语言的函数调用
- hello.c
#include <stdio.h>
#include <unistd.h>
void
f (int n)
{
printf ("Number: %d\n", n);
}
int
main (int argc,
char * argv[])
{
int i = 0;
printf ("f() is at %p\n", f);
while (1)
{
f (i++);
sleep (1);
}
}
构建
gcc -Wall hello.c -o hello
- frida 钩子
hook.py
from __future__ import print_function
import frida
import sys
session = frida.attach("hello")
script = session.create_script("""
Interceptor.attach(ptr("%s"), {
onEnter: function(args) {
send(args[0].toInt32());
}
});
""" % int(sys.argv[1], 16))
def on_message(message, data):
print(message)
script.on('message', on_message)
script.load()
sys.stdin.read()
运行
- 运行hello
同时会包含地址
地址信息 0x40057d
./hello
f() is at 0x40057d
Number: 0
捕捉
python hook.py 0x40057d
效果
说明
以上是frida 一个简单使用,从功能体验上,frida 还是比较强大的,而且还是比较灵活的,很值得深入学习下
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
2021-09-04 修改java jar内容的方法
2021-09-04 基于minfs 的静态网站部署模式
2021-09-04 minfs 简单介绍
2021-09-04 几个不错的s3 压力测试工具
2020-09-04 Interpreting /proc/meminfo and free output for Red Hat Enterprise Linux 5, 6 and 7
2018-09-04 restheart 基本使用
2017-09-04 centos 7 bbr 安装