Best way to debug scripts
This tutorial will teach you how to quickly test your code without repacking your entire .apk and compiling it.
It’s gonna be fun to code when you learn this!
Steps:
-
Attach frida
- Add frida gadget library to the
lib/archdirectory. - Load it in
GameApp.smali(In newer versions it’sTitanApplication.smaliand the"g"searching method won’t work in them. CheckBSD Brawland load your gadget under the"BSD"gadget loading). - Do not create
.config.sofile. Gadget will be automatically inlistenmode and we’re going to use it.
- Add frida gadget library to the
-
Enable USB debugging
- Enable USB debugging in settings. You can find tutorials online on how to do it, so I won’t explain it here.
-
Installing dependencies
- Download
node.jslatest LTS version and install it (Make sure it’s going to add to the system PATH). - Create a new directory in your desired place (for example: Desktop). This is where our project will be.
- Open
cmd.exein the directory location and type this:This will install frida node.js package on your PCnpm install frida - [OPTIONAL] If you want to quickly create script type this in
cmd.exe:This will createecho. >script.jsscript.jsfile in your working directory.
- Download
-
Install ADB
- Install ADB
(Android Debugging Bridge), there’s plenty of tutorials on the internet, I’m sure you’ll install it on your own.
- Install ADB
-
Loading the script
- Plug in your phone with USB cable to the PC
- Allow USB debugging.
- In
cmd.exetype:It will try to connect to your phone via the bridge.adb devices - Press Allow on the phone.
- Now open Brawl Stars with the frida gadget in it. It will be stuck on the black screen until you start the script
- To start the script in
cmd.exetype:frida -U Gadget -l script.js - Your script will start executing and you can modify the script in runtime!