Skip to content

Instantly share code, notes, and snippets.

class MainFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
Timber.d("MainFragment created")
return inflater.inflate(R.layout.fragment_main, container, false)
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0"
android:compileSdkVersion="29"
android:compileSdkVersionCodename="10"
package="com.lolkek.secure"
platformBuildVersionCode="29"
platformBuildVersionName="10">
.class public final Lcom/lolkek/secure/MyApplication;
.super Landroid/app/Application;
.source ""
# direct methods
.method public constructor <init>()V
.registers 1
invoke-direct {p0}, Landroid/app/Application;-><init>()V
return-void
.end method
# virtual methods
.class public final Lb/b/a/a;
.super Ld/a/a$b;
.source ""
.method public constructor <init>()V
...
.end method
# virtual methods
.method public a(ILjava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
.registers 5
.annotation build Landroid/annotation/SuppressLint;
.class public final Ld/a/a;
.super Ljava/lang/Object;
...
.method public static constructor <clinit>()V
...
.end method
.method public static a(Ld/a/a$b;)V
...
const-string v0, "Cannot plant Timber into itself."
invoke-direct {p0, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
public final class Timber {
...
public static void plant(@NotNull Tree tree) {
...
if (tree == TREE_OF_SOULS) {
throw new IllegalArgumentException("Cannot plant Timber into itself.");
}
...
}
}
@DexEdit(contentOnly = true) // contentOnly tells compiler that we should replace only content, not class itself.
// As a benefit we should not look for base class and can focus on content
public class a {
// this is obfuscated tree.log() method
@DexReplace // replacing this method completely
public void a(int priority, String tag, String message, Throwable throwable) {
Log.e("HACKED", message);
}
}
public final class a {
public final void a$app(int priority, @NotNull String tag, @NotNull String message, @NotNull Throwable throwable) {
Intrinsics.checkParameterIsNotNull(tag, "tag");
Intrinsics.checkParameterIsNotNull(message, "message");
Intrinsics.checkParameterIsNotNull(throwable, "throwable");
Log.e("HACKED", message);
}
}
@DexEdit(contentOnly = true) // overriding contentOnly. As well no need for searching base Application class, interfaces and etc.
public class MyApplication extends Application {
@DexAppend // add this code additionally to the method without replacing anything inside it
@Override
public void onCreate() {
Log.e("HAHAHA","YOU'VE BEEN HACKED!");
}
}
object AnalyticsConstants {
object Events {
object FirstLaunch {
const val EVENT = "first_launch"
}
object SessionStart {
const val EVENT = "session_start"
}
object Navigated { // Each event is having its own class
const val EVENT = "navigated" // this is event name.