【Android逆向】滚动的天空中插入smali日志

android,逆向,滚动,空中,插入,smali,日志 · 浏览次数 : 24

小编点评

**MyLog.java** ```java public class MyLog { public static final String TAG = "JIA"; public static void logd(Object obj) { Log.d(TAG, "logd: " + obj); } public static void logi(Object obj) { Log.i(TAG, "logi: " + obj); } public static void loge(Object obj) { Log.e(TAG, "logde: " + obj); } public static void print() { Log.e(TAG, "logde print: ======"); } } ``` **MyLog.smali** ```smali # MyLog.java public class LMyLog extends Ljava/lang/Object;.source "MyLog.java"# static fields.field public static final TAG:Ljava/lang/String; = "JIA"# direct methods.method public constructor <init>()V .locals 0 .line 5 invoke-direct {p0}, Ljava/lang/Object;-><init>()V return-void.end method.method public static logd(Ljava/lang/Object;)V .locals 2 .param p0, \"obj\" # Ljava/lang/Object; .line 9 new-instance v0, Ljava/lang/StringBuilder; invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V const-string v1, \"logd: \" invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;Ljava/lang/String;)V invoke-static {}, LMyLog;->print()V invoke-static {v0}, LMyLog;->loge(Ljava/lang/Object;)V .line 14 return-void.end method.method public static print()V .locals 2 .line 21 const-string v0, \"JIA\" const-string v1, \"logde print: =====JIA com...llingsky_cn.nearme.gamecenter E logde: ball_500." # my code begin invoke-static {}, Lcom/turbochilli/rollingsky/util/NativeUtil;->getInstance()Lcom/turbochilli/rollingsky/util/NativeUtil; move-result-object v0 .......end method4. 通过AndroidKiller 重打包,并安装(手动打也可以,就是有些繁琐,借助工具更香)5. 看到了自己的日志JIA com...llingsky_cn.nearme.gamecenter E logde print: =====JIA com...llingsky_cn.nearme.gamecenter E logde: ball_500. ``` **使用说明** 1. 将 MyLog.java 和 MyLog.smali 放在与 Android 项目相同的目录下。 2. 使用 Android Studio 打开项目并构建。 3. 运行应用程序,应该可以看到日志信息。

正文

1. 编写一个MyLog.java 放到一个android工程下,编译打包,然后反编译拿到MyLog的smali代码

package com.example.logapplication;

import android.util.Log;

public class MyLog {
    public static final String TAG = "JIA";

    public static void logd(Object obj) {
        Log.d(TAG, "logd: " + obj);
    }

    public static void logi(Object obj) {
        Log.i(TAG, "logi: " + obj);
    }

    public static void loge(Object obj) {
        Log.e(TAG, "logde: " + obj);
    }

    public static void print() {
        Log.e(TAG, "logde print: =====" );
    }
}

拿到MyLog.smali后,第一件事是抹去他的包信息,得到

.class public LMyLog;
.super Ljava/lang/Object;
.source "MyLog.java"


# static fields
.field public static final TAG:Ljava/lang/String; = "JIA"


# direct methods
.method public constructor <init>()V
    .locals 0

    .line 5
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static logd(Ljava/lang/Object;)V
    .locals 2
    .param p0, "obj"    # Ljava/lang/Object;

    .line 9
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "logd: "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const-string v1, "JIA"

    invoke-static {v1, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 10
    return-void
.end method

.method public static loge(Ljava/lang/Object;)V
    .locals 2
    .param p0, "obj"    # Ljava/lang/Object;

    .line 17
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "logde: "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const-string v1, "JIA"

    invoke-static {v1, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 18
    return-void
.end method

.method public static logi(Ljava/lang/Object;)V
    .locals 2
    .param p0, "obj"    # Ljava/lang/Object;

    .line 13
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "logi: "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const-string v1, "JIA"

    invoke-static {v1, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 14
    return-void
.end method

.method public static print()V
    .locals 2

    .line 21
    const-string v0, "JIA"

    const-string v1, "logde print: ====="

    invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 22
    return-void
.end method

3. 将滚动天空拖入到AndroidKiller 中进行反编译,打开smali目录的位置,将MyLog.smali放到目录下,等于是是在源代码的根目录下(这也是要抹除包信息的原因),在目标文件a.smalionPayCancel插入自己的代码


# virtual methods
.method public varargs onPayCancel(Lcom/turbochilli/rollingsky/pay/IProduct;I[Ljava/lang/String;)V
    .locals 3

    .prologue
    const/4 v2, 0x4

    .line 57
    iget-object v0, p0, Lcom/turbochilli/rollingsky/b/a;->a:Ljava/lang/String;

    const-string v1, "ball_50"
    
	# my code begin
    invoke-static {}, LMyLog;->print()V
    invoke-static {v0}, LMyLog;->loge(Ljava/lang/Object;)V
	# my code end


    invoke-static {v0, v1}, Landroid/text/TextUtils;->equals(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Z

    move-result v0           

    if-eqz v0, :cond_1

    .line 77
    :cond_0
    :goto_0
    invoke-static {}, Lcom/turbochilli/rollingsky/util/NativeUtil;->getInstance()Lcom/turbochilli/rollingsky/util/NativeUtil;

    move-result-object v0

 ......
.end method

4. 通过AndroidKiller 重打包,并安装(手动打也可以,就是有些繁琐,借助工具更香)

5. 看到了自己的日志

JIA                     com...llingsky_cn.nearme.gamecenter  E  logde print: =====
JIA                     com...llingsky_cn.nearme.gamecenter  E  logde: ball_500

与【Android逆向】滚动的天空中插入smali日志相似的内容:

【Android逆向】滚动的天空中插入smali日志

1. 编写一个MyLog.java 放到一个android工程下,编译打包,然后反编译拿到MyLog的smali代码 package com.example.logapplication; import android.util.Log; public class MyLog { public st

【Android逆向】frida 破解 滚动的天空

1. apk 安装到手机中 2. 玩十次之后,会提示 充值 3. adb shell dumpsys window | grep mCurrentFocus 查看一些当前activity是哪一个 是 AppActivity 4. 阅读代码,感觉是unity3d做的游戏 5. apk拖入到jadx中,

【Android逆向】frida 破解 jwxdxnx02.apk

apk 路径: https://pan.baidu.com/s/1cUInoi 密码:07p9 这题比较简单,主要是用于练习frida 1. 安装apk到手机 需要输入账号密码 2. 使用jdax 查看apk package hfdcxy.com.myapplication; import andr

[Android逆向]Exposed 破解 jwxdxnx02.apk

使用exposed 遇到了一些坑,这里记录一下 源码: package com.example.exposedlesson01; import de.robv.android.xposed.IXposedHookLoadPackage; import de.robv.android.xposed.X

[Android 逆向]frida 破解 切水果大战原版.apk

1. 手机安装该apk,运行,点击右上角礼物 提示 支付失败,请稍后重试 2. apk拖入到jadx中,待加载完毕后,搜素失败,找到疑似目标类MymmPay的关键方法payResultFalse 4. adb logcat 或者androidstudio 查看该进程的日志,发现以下日志 com.mf

[Android 逆向]Xposed 破解 切水果大战原版.apk

代码 public class Main implements IXposedHookLoadPackage { boolean flag = false; @Override public void handleLoadPackage(XC_LoadPackage.LoadPackageParam

【Android逆向】frida hook so 函数

1. apk来自52pojie 链接:https://pan.baidu.com/s/1vKC1SevvHfeI7f0d2c6IqQ 密码:u1an 2.apktool反编译apk,拿到so文件 java -jar ../apktool_2.2.4.jar d app-debug.apk 3. 用j

【Android逆向】修改so文件方式修改程序行为

1. 还是之前的那个apk 链接:https://pan.baidu.com/s/1vKC1SevvHfeI7f0d2c6IqQ 密码:u1an 尝试使用 010Editor来修改so文件 2. 使用ida打开so文件,双击 hello 52pojie!,会跳转到该字符串的偏移地址,ida显示是00

【Android逆向】破解黑宝宝apk,绕过签名校验

这是52pojie的一道题,实现输入任何密码都可以登录成功 他知道你最近在学习Android逆向 他想在游戏上线前让你测试一下他新加的签名验证是否能防住别人的破解。 下面是李华编写的黑宝宝apk 链接:https://pan.baidu.com/s/1h6pX2ARE3qtiKiYbcnJ-3g 密

[Android 逆向]绕过小米需插卡安装apk限制

1. 确保自己手机是root的了 2. 给手机安装busybox,使可以用vi编辑文件 安装方法: 0. adb shell getprop ro.product.cpu.abi 获得 cpu架构信息 arm64-v8a 1. 下载 https://busybox.net/downloads/bin