Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/igio90/fridaandroidinjector
Inject frida agents on local processes through an Android app
https://github.com/igio90/fridaandroidinjector
Last synced: 4 days ago
JSON representation
Inject frida agents on local processes through an Android app
- Host: GitHub
- URL: https://github.com/igio90/fridaandroidinjector
- Owner: iGio90
- Created: 2020-01-05T03:29:59.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-25T09:19:14.000Z (over 3 years ago)
- Last Synced: 2025-01-02T00:07:36.798Z (11 days ago)
- Language: Java
- Homepage:
- Size: 32.9 MB
- Stars: 263
- Watchers: 15
- Forks: 63
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Frida Injector for Android
is a library allowing you to inject frida agents from an Android application.
The things are very very easy:
#### Setup
```
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
``````
dependencies {
implementation 'com.github.iGio90:FridaAndroidInjector:+'
}
```#### How to:
```java
try {
// build an instance of FridaInjector providing binaries for arm/arm64/x86/x86_64 as needed
// assets/frida-inject-12.8.2-android-arm64
FridaInjector fridaInjector = new FridaInjector.Builder(this)
.withArm64Injector("frida-inject-12.8.2-android-arm64")
.build();// build an instance of FridaAgent
FridaAgent fridaAgent = new FridaAgent.Builder(this)
.withAgentFromAssets("agent.js")
.build();// inject systemUi
fridaInjector.inject(fridaAgent, "com.android.systemui", true);
} catch (IOException e) {
e.printStackTrace();
}
````#### Implementing "on('message')"
```java
public class MainActivity extends AppCompatActivity implements OnMessage {
@Override
public void onMessage(String data) {
try {
JSONObject object = new JSONObject(data);
Log.e("FridaInjector", "SystemUI pid: " + object.getString("pid"));
} catch (JSONException e) {
e.printStackTrace();
}
}
}
``````java
FridaAgent fridaAgent = new FridaAgent.Builder(this)
.withAgentFromAssets("agent.js")
.withOnMessage(this)
.build();
```and from your agent
```javascript
Java.send({'pid': Process.id});
```#### Implementing sync interfaces
this allows to play with target objects in runtime from your java impl
```java
public class Interfaces {
static final class ActivityInterface implements FridaInterface {
@Override
public Object call(Object[] args) {
Log.e("FridaAndroidInject", Arrays.toString(args));
return null;
}
}
}
```
```java
// register a custom interface
fridaAgent.registerInterface("activityInterface", Interfaces.ActivityInterface.class);
```and from your agent
```javascript
var app = Java.use("android.app.Activity");
app.onResume.overloads[0].implementation = function() {
this.onResume.apply(this, arguments);
Java.activityInterface(Java.cast(this, app), "otherArg1", "otherArg2");
};
```### additional
* console.log is redirected to Log.e("FridaAndroidInject", what);The example apk [here](https://github.com/igio90/FridaAndroidInjector/tree/master/example.apk) is built and ready to try. You will see it works! (only arm64).