翻译自官网文档:
https://www.frida.re/docs/installation/
安装Frida并准备好应该只需要几分钟。如果(你觉得)安装过程很麻烦(a pain in the ass),请提交一个问题(或提交拉取请求)(https://github.com/frida/frida-website/issues/new)来描述您遇到的问题以及我们如何使安装过程更容易。
Requirements for Frida’s CLI tools
安装Frida’s CLI tools非常简单直接,但在开始之前,需要确保系统满足一些要求:
- Python — 极推荐最新的3.x
- Windows, macOS, or GNU/Linux(操作系统)
Install with pip(使用pip安装
安装Frida’s CLI tools最好的方式就是通过PyPI(https://pypi.python.org/pypi/frida-tools):
$ pip install frida-tools
如果安装Frida中遇到问题,查看troubleshooting page 或report an issue,这样Frida community可以为所有人改进安装体验。
Install manually(手动安装
You can also grab other binaries from Frida’s GitHub releases page.
https://github.com/frida/frida/releases
Testing your installation(检测一下
开启一个可以注入的进程:
$ cat
就把它晾在那等待输入。在Windows上,可能需要使用notepad.exe
。
请注意,此示例不适用于macOS El Capitan及更高版本,因为它拒绝对系统二进制文件的此类尝试。More details 。但是,如果将cat二进制文件复制到例如 /tmp/cat ,然后运行,那么示例应该工作:
$ cp /bin/cat /tmp/cat
$ /tmp/cat
在另一个终端中,使用以下内容创建一个example.py文件:
import frida
def on_message(message, data):
print("[on_message] message:", message, "data:", data)
session = frida.attach("cat")
script = session.create_script("""'use strict';
rpc.exports.enumerateModules = function () {
return Process.enumerateModulesSync();
};
""")
script.on("message", on_message)
script.load()
print([m["name"] for m in script.exports.enumerate_modules()])
如果使用的是GNU/Linux,指令:
$ sudo sysctl kernel.yama.ptrace_scope=0
来启用ptracing非子进程(ptracing non-child processes)。
到这里,我们就算准备好Frida了,运行example.py脚本并观察:
$ python example.py
输出应该与下面的类似(取决于个人平台和库版本):
[u'cat', …, u'ld-2.15.so']