zoukankan      html  css  js  c++  java
  • frida安装和使用方法

    frida是一个轻量级别的hook框架。官网介绍:Dynamic instrumentation toolkit for developers, reverse-engineers, and security researchers.
    frida由两部分组成:一部分是运行在系统上的交互工具frida CLI,另一部分是运行在目标机器上的代码注入工具frida-server。
    推荐使用python3来安装frida。
    -------
    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('
    ', '
    ');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有空再补上。

     
  • 相关阅读:
    踏实每一个脚印——2019年12月复盘
    修改博客园markdown编辑器代码高亮风格的方法
    Hyperion: Building the Largest In memory Search Tree
    C++11——智能指针
    拷贝控制
    分布式系统常见概念
    extern和static使用
    APUE—UNIX文件系统
    C++的一些细节
    fork和僵尸进程
  • 原文地址:https://www.cnblogs.com/pcat/p/12501850.html
Copyright © 2011-2022 走看看