frida安裝和使用方法


frida是一個輕量級別的hook框架。官網介紹:Dynamic instrumentation toolkit for developers, reverse-engineers, and security researchers.
frida由兩部分組成:一部分是運行在系統上的交互工具frida CLI,另一部分是運行在目標機器上的代碼注入工具frida-server。
推薦使用 python3來安裝frida。
官方文檔: https://frida.re/docs/home/
-------
0x01 windows上安裝frida
請使用pip3.exe來安裝
pip3 install frida-tools
# 或使用國內源
pip3 install frida-tools -i https://pypi.tuna.tsinghua.edu.cn/simple/

其中,

Running setup.py install for frida ...

會卡住,靜候一陣子會好的。

windows的frida目前只支持python2.7和python3.7

如果非要用python2.7來安裝,經pcat測試后,frida的版本最高只能到11.0.13,高於這個版本安裝后不會在Scripts目錄生成exe文件。

pip install frida==11.0.13

同樣的,國內環境安裝實在是很慢。

安裝后,使用frida如若報錯如下:

from prompt_toolkit.shortcuts import create_prompt_application, create_output, create_eventloop
ImportError: cannot import name 'create_prompt_application'

重裝下prompt-toolkit

pip install prompt-toolkit==1.0.15

 

0x02 linux上安裝firda
同樣的步驟:
pip3 install frida-tools
# 或使用國內源
pip3 install frida-tools -i https://pypi.tuna.tsinghua.edu.cn/simple/

但是會報錯:

  Running setup.py bdist_wheel for frida ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-abaq78bw/frida/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-q8tuqk3t --python-tag cp37:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.7
  creating build/lib.linux-x86_64-3.7/frida
  copying frida/core.py -> build/lib.linux-x86_64-3.7/frida
  copying frida/__init__.py -> build/lib.linux-x86_64-3.7/frida
  running build_ext
  looking for prebuilt extension in home directory, i.e. /root/frida-12.8.14-py3.7-linux-x86_64.egg
  prebuilt extension not found in home directory, will try downloading it
  querying pypi for available prebuilds
  error: <urlopen error [Errno 101] Network is unreachable>

這里關鍵是這句

i.e. /root/frida-12.8.14-py3.7-linux-x86_64.egg

我打開https://pypi.org/project/frida/#files (國內打開較慢)

發現只有frida-12.8.14-py3.6-linux-x86_64.egg,而沒有py3.7的文件,於是安裝肯定報錯。
解決法子:
把frida-12.8.14-py3.6-linux-x86_64.egg下載到本地,然后
python3 /usr/lib/python3/dist-packages/easy_install.py frida-12.8.14-py3.6-linux-x86_64.egg

當進行到:

Installed /usr/local/lib/python3.7/dist-packages/frida-12.8.14-py3.6-linux-x86_64.egg
Processing dependencies for frida==12.8.14
Searching for frida==12.8.14
Reading https://pypi.org/simple/frida/

就按ctrl+c進行中斷,因為這個網址的內容很長,國內加載會特別地慢,然后

pip3 install frida-tools -i https://pypi.tuna.tsinghua.edu.cn/simple/

順利安裝上,就可以使用以下命令:

frida
frida-kill
frida-ps
frida-discover
frida-ls-devices
frida-trace

 

0x03 frida-server

Releases:https://github.com/frida/frida/releases

注意一點:frida-server版本要和frida版本一致。

v=12.8.14
os=android-arm64
wget "https://github.com/frida/frida/releases/download/${v}/frida-server-${v}-${os}.xz"

 

0x04 frida使用方法

等pcat有空再補上。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM