Frida Tutorial
Samouczek Frida
Wskazówka dotycząca bug bounty: zarejestruj się na platformie Intigriti, premium platformie bug bounty stworzonej przez hakerów, dla hakerów! Dołącz do nas na https://go.intigriti.com/hacktricks już dziś i zacznij zarabiać nagrody do 100 000 USD!
Instalacja
Zainstaluj narzędzia Frida:
Pobierz i zainstaluj na urządzeniu Android serwer Frida (Pobierz najnowsze wydanie). Jednolinijkowe polecenie do ponownego uruchomienia adb w trybie root, połączenia z nim, przesłania frida-server, nadania uprawnień do wykonania i uruchomienia go w tle:
Sprawdź, czy to działa:
Samouczki
Źródło: https://medium.com/infosec-adventures/introduction-to-frida-5a3f51595ca1 APK: https://github.com/t0thkr1s/frida-demo/releases Kod źródłowy: https://github.com/t0thkr1s/frida-demo
Kliknij link, aby przeczytać.
Źródło: https://11x256.github.io/Frida-hooking-android-part-2/ (Części 2, 3 i 4) APK i kod źródłowy: https://github.com/11x256/frida-android-examples
Kliknij link, aby przeczytać.
Źródło: https://joshspicer.com/android-frida-1 APK: https://github.com/OWASP/owasp-mstg/blob/master/Crackmes/Android/Level_01/UnCrackable-Level1.apk
Kliknij link, aby przeczytać.
Więcej niesamowitych skryptów Frida znajdziesz tutaj: https://codeshare.frida.re/
Szybkie przykłady
Wywoływanie Fridy z wiersza poleceń
Podstawowy skrypt Pythona
Podstawowy skrypt Pythona
Hookowanie funkcji bez parametrów
Zahacz funkcję a()
z klasy sg.vantagepoint.a.c
Hook java exit()
exit()
Introduction
In this tutorial, we will learn how to hook the exit()
method in Java using Frida. By hooking this method, we can intercept the application's exit calls and perform additional actions before the application terminates.
Prerequisites
Before we begin, make sure you have the following:
A rooted Android device or an emulator
Frida installed on your machine
Basic knowledge of JavaScript and Java
Steps
Follow these steps to hook the exit()
method:
Launch the target application on your Android device or emulator.
Open a terminal and start the Frida server by running the following command:
Create a new JavaScript file, for example
hook_exit.js
, and add the following code:Save the JavaScript file.
In the terminal, navigate to the directory where the JavaScript file is saved.
Use Frida to inject the JavaScript code into the target application by running the following command:
Replace
<package_name>
with the package name of the target application.You should see the output of the
console.log()
statements in the terminal whenever theexit()
method is called.Customize the additional actions in the JavaScript code as per your requirements.
Conclusion
By hooking the exit()
method in Java using Frida, we can intercept the application's exit calls and perform additional actions before the application terminates. This technique can be useful for various purposes, such as debugging, analyzing application behavior, or modifying the application's flow.
Frida Tutorial: Hook MainActivity .onStart()
& .onCreate()
.onStart()
& .onCreate()
W tym samouczku dowiesz się, jak używać Fridy do przechwytywania wywołań metod .onStart()
i .onCreate()
w klasie MainActivity w aplikacji Androidowej.
Wymagania
Aby zacząć, musisz mieć zainstalowane następujące narzędzia:
Kroki
Sklonuj repozytorium z przykładową aplikacją Androidową:
Otwórz projekt w Android Studio i zbuduj go.
Uruchom aplikację na urządzeniu lub emulatorze.
Uruchom Fridę w trybie serwera na swoim komputerze:
Uruchom skrypt Fridy, który przechwytuje wywołania metod
.onStart()
i.onCreate()
w klasie MainActivity:Podłącz się do urządzenia/emulatora za pomocą Fridy:
Teraz, gdy aplikacja zostanie uruchomiona, zobaczysz w konsoli wiadomości potwierdzające, że metody
.onStart()
i.onCreate()
zostały przechwycone.
Podsumowanie
Dzięki Fridzie możesz łatwo przechwytywać wywołania metod w aplikacjach Androidowych. W tym samouczku nauczyłeś się, jak przechwycić metody .onStart()
i .onCreate()
w klasie MainActivity.
Hook android .onCreate()
.onCreate()
Introduction
In this tutorial, we will learn how to hook the .onCreate()
method in an Android application using Frida. By hooking this method, we can intercept and modify the behavior of the application during its initialization process.
Prerequisites
Before we begin, make sure you have the following:
A rooted Android device or an emulator
Frida installed on your machine
Basic knowledge of JavaScript and Android development
Steps
Start by launching the target application on your device or emulator.
Open a terminal and run the following command to start the Frida server:
Next, we need to find the process ID (PID) of the target application. Run the following command to list all running processes:
Look for the process corresponding to the target application and note down its PID.
Now, create a new JavaScript file (e.g.,
hook.js
) and add the following code:Replace
com.example.TargetClass
with the actual class name of the target application.Save the
hook.js
file and run the following command to start the hooking process:Replace
<PID>
with the PID of the target application obtained in step 3.If everything is set up correctly, you should see the message
onCreate() hooked
in the Frida console.Now, whenever the target application's
.onCreate()
method is called, your custom code will be executed.
Conclusion
By hooking the .onCreate()
method in an Android application using Frida, you can gain control over the application's initialization process and modify its behavior as desired. This technique can be useful for various purposes, such as bypassing security checks or analyzing the application's internal workings.
Hookowanie funkcji z parametrami i pobieranie wartości
Hookowanie funkcji deszyfrującej. Wyświetl wejście, wywołaj oryginalną funkcję, odszyfruj dane wejściowe i na koniec wyświetl odszyfrowane dane:
Hookowanie funkcji i wywoływanie ich z naszym wejściem
Zahacz funkcję, która przyjmuje ciąg znaków i wywołaj ją z innym ciągiem znaków (od tutaj).
Pobieranie już utworzonego obiektu klasy
Jeśli chcesz wyodrębnić pewną cechę utworzonego obiektu, możesz to zrobić za pomocą tego sposobu.
W tym przykładzie zobaczysz, jak pobrać obiekt klasy my_activity i jak wywołać funkcję .secret(), która wyświetli prywatną cechę obiektu:
Inne samouczki Frida
Wskazówka dotycząca nagrody za błąd: Zarejestruj się na platformie Intigriti, premium platformie nagród za błędy stworzonej przez hakerów, dla hakerów! Dołącz do nas na https://go.intigriti.com/hacktricks już dziś i zacznij zarabiać nagrody do 100 000 USD!
Last updated