Frida : Basic Usage for Android

Mar 29, 2026 • Reverse Engineering • Insidebinary Team
Table of contents

环境搭建

  • frida-server
  • frida-tools
pip3 install frida
pip3 install frida-tools

frida-server : 12.8.19

下载frida-server并解压

xz -d frida-server-12.8.19-android-arm64.xz
adb push frida-server-12.8.19-android-arm64 /data/local/tmp/frida-server-arm64

修改权限并启动frida-server

adb shell
cd /data/local/tmp
chown root:root frida-server-arm64
chmod a+x frida-server-arm64
./frida-server-arm64

遇到的问题

Unable to preload: Unable to access process with pid 402 due to system restrictions; try sudo sysctl kernel.yama.ptrace_scope=0, or run Frida as root

解决方法:

magiskhide  disable

Basic Usage

frida-ps -U
frida-trace -U -i "recvfrom" com.android.chrome

Javascript example 1

Java.enumerateLoadedClasses(
  {
  "onMatch": function(className){ 
        console.log(className) 
    },
  "onComplete":function(){}
  }
)

Javascript example 2:chrome.js

Java.perform(function () {
    var Activity = Java.use("android.app.Activity");
    Activity.onResume.implementation = function () {
        console.log("[*] onResume() got called!");
        this.onResume();
    };
});
frida -U -l chrome.js com.android.chrome

参考资料

frida
android