-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
187 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
25 changes: 25 additions & 0 deletions
25
fridainjector/src/main/java/com/igio90/fridainjector/FridaAgent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.igio90.fridainjector; | ||
|
||
import android.content.Context; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
|
||
public class FridaAgent { | ||
|
||
private final File mAgent; | ||
|
||
public static FridaAgent fromAsset(Context context, String assetPath) throws IOException { | ||
FridaAgent fridaAgent = new FridaAgent(context); | ||
Utils.extractAsset(context, assetPath, fridaAgent.getAgent()); | ||
return fridaAgent; | ||
} | ||
|
||
private FridaAgent(Context context) { | ||
mAgent = new File(context.getFilesDir(), "agent.js"); | ||
} | ||
|
||
File getAgent() { | ||
return mAgent; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 23 additions & 2 deletions
25
fridainjector/src/main/java/com/igio90/fridainjector/Utils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,26 @@ | ||
package com.igio90.fridainjector; | ||
|
||
public class Utils { | ||
import android.content.Context; | ||
import android.content.res.AssetManager; | ||
|
||
import java.io.File; | ||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.OutputStream; | ||
|
||
} | ||
public class Utils { | ||
static void extractAsset(Context context, String assetName, File dest) throws IOException { | ||
AssetManager assetManager = context.getAssets(); | ||
InputStream in = assetManager.open(assetName); | ||
OutputStream out = new FileOutputStream(dest); | ||
byte[] buffer = new byte[1024]; | ||
int read; | ||
while ((read = in.read(buffer)) != -1) { | ||
out.write(buffer, 0, read); | ||
} | ||
in.close(); | ||
out.flush(); | ||
out.close(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
function log(what) { | ||
Java.performNow(function() { | ||
Java.use('android.util.Log').e("tweakerinj", what.toString()); | ||
Java.use('android.util.Log').e("FridaAndroidInject", what.toString()); | ||
}) | ||
} | ||
|
||
Java.performNow(function() { | ||
var TextClock = Java.use("com.android.systemui.statusbar.policy.Clock"); | ||
var Color = Java.use("android.graphics.Color"); | ||
|
||
TextClock.setTextColor.overloads[0].implementation = function() { | ||
if (this.$className === 'com.android.systemui.statusbar.policy.Clock') { | ||
arguments[0] = Color.BLACK.value; | ||
var TextView = Java.use("android.widget.TextView"); | ||
TextView.setText.overloads[0].implementation = function() { | ||
arguments[0] = Java.use("java.lang.String").$new("It works!"); | ||
return this.setText.apply(this, arguments); | ||
} | ||
return this.setTextColor.apply(this, arguments); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters