函数完整替换的一则实例,较简单;

滚动的天空

版本:1.1.0.140

运营:OPPO

Pay:咪咕支付

Smali:OppPay$2$1.smali

思路:

虽然取消支付【支付失败】并没有弹窗,但返回消息仍然是支付失败【\u652f\u4ed8\u53d6\u6d88】,直接全局搜索;

在/smali/com/turbochilli/rollingsky/pay/OppPay$2$1.smali存在 onFailure 和 onSuccess 方法;

只需要用onSuccess的内容把onFailure的内容替换掉即可;

购买只需要点【其他支付】-【x 关掉】-【放弃支付】即可触发onFailure方法,即实现onSuccess函数效果;

两个函数虽然接受参数的个数不同,不完美但破解内购成功;

QQ20171221-215557@2x.png

Smali

OppPay$2$1.smali:

.method public onFailure(Ljava/lang/String;I)V
    .locals 4

    .prologue
    const/16 v3, 0xc

    const/4 v2, 0x0

    .line 112
    const/16 v0, 0x3ec

    if-eq v0, p2, :cond_1

    .line 113
    const-string v0, "lx"

    const-string v1, "onFailure--->\u652f\u4ed8\u5931\u8d25"

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

    .line 114
    iget-object v0, p0, Lcom/turbochilli/rollingsky/pay/OppPay$2$1;->this$1:Lcom/turbochilli/rollingsky/pay/OppPay$2;

    iget-object v0, v0, Lcom/turbochilli/rollingsky/pay/OppPay$2;->val$mPayCallback:Lcom/turbochilli/rollingsky/pay/PayCallback;

    if-eqz v0, :cond_0

    .line 115
    iget-object v0, p0, Lcom/turbochilli/rollingsky/pay/OppPay$2$1;->this$1:Lcom/turbochilli/rollingsky/pay/OppPay$2;

    iget-object v0, v0, Lcom/turbochilli/rollingsky/pay/OppPay$2;->val$mPayCallback:Lcom/turbochilli/rollingsky/pay/PayCallback;

    iget-object v1, p0, Lcom/turbochilli/rollingsky/pay/OppPay$2$1;->this$1:Lcom/turbochilli/rollingsky/pay/OppPay$2;

    iget-object v1, v1, Lcom/turbochilli/rollingsky/pay/OppPay$2;->val$iProduct:Lcom/turbochilli/rollingsky/pay/IProduct;

    new-array v2, v2, [Ljava/lang/String;

    invoke-interface {v0, v1, v3, v2}, Lcom/turbochilli/rollingsky/pay/PayCallback;->onPayCancel(Lcom/turbochilli/rollingsky/pay/IProduct;I[Ljava/lang/String;)V

    .line 125
    :cond_0
    :goto_0
    return-void

    .line 120
    :cond_1
    const-string v0, "lx"

    const-string v1, "onFailure--->\u652f\u4ed8\u53d6\u6d88"

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

    .line 121
    iget-object v0, p0, Lcom/turbochilli/rollingsky/pay/OppPay$2$1;->this$1:Lcom/turbochilli/rollingsky/pay/OppPay$2;

    iget-object v0, v0, Lcom/turbochilli/rollingsky/pay/OppPay$2;->val$mPayCallback:Lcom/turbochilli/rollingsky/pay/PayCallback;

    if-eqz v0, :cond_0

    .line 122
    iget-object v0, p0, Lcom/turbochilli/rollingsky/pay/OppPay$2$1;->this$1:Lcom/turbochilli/rollingsky/pay/OppPay$2;

    iget-object v0, v0, Lcom/turbochilli/rollingsky/pay/OppPay$2;->val$mPayCallback:Lcom/turbochilli/rollingsky/pay/PayCallback;

    iget-object v1, p0, Lcom/turbochilli/rollingsky/pay/OppPay$2$1;->this$1:Lcom/turbochilli/rollingsky/pay/OppPay$2;

    iget-object v1, v1, Lcom/turbochilli/rollingsky/pay/OppPay$2;->val$iProduct:Lcom/turbochilli/rollingsky/pay/IProduct;

    new-array v2, v2, [Ljava/lang/String;

    invoke-interface {v0, v1, v3, v2}, Lcom/turbochilli/rollingsky/pay/PayCallback;->onPayCancel(Lcom/turbochilli/rollingsky/pay/IProduct;I[Ljava/lang/String;)V

    goto :goto_0
.end method

.method public onSuccess(Ljava/lang/String;)V
    .locals 3

    .prologue
    .line 101
    const-string v0, "lx"

    new-instance v1, Ljava/lang/StringBuilder;

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

    const-string v2, "onSuccess--->\u652f\u4ed8\u6210\u529f---resultMsg:"

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

    move-result-object v1

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

    move-result-object v1

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

    move-result-object v1

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

    .line 103
    iget-object v0, p0, Lcom/turbochilli/rollingsky/pay/OppPay$2$1;->this$1:Lcom/turbochilli/rollingsky/pay/OppPay$2;

    iget-object v0, v0, Lcom/turbochilli/rollingsky/pay/OppPay$2;->val$mPayCallback:Lcom/turbochilli/rollingsky/pay/PayCallback;

    if-eqz v0, :cond_0

    .line 104
    invoke-static {}, Lcom/turbochilli/rollingsky/c;->a()Lcom/turbochilli/rollingsky/c;

    move-result-object v0

    invoke-virtual {v0}, Lcom/turbochilli/rollingsky/c;->h()Lcom/turbochilli/rollingsky/c$b;

    move-result-object v0

    iget-object v1, p0, Lcom/turbochilli/rollingsky/pay/OppPay$2$1;->this$1:Lcom/turbochilli/rollingsky/pay/OppPay$2;

    iget-object v1, v1, Lcom/turbochilli/rollingsky/pay/OppPay$2;->val$orderId:Ljava/lang/String;

    invoke-interface {v0, v1}, Lcom/turbochilli/rollingsky/c$b;->b(Ljava/lang/String;)V

    .line 105
    iget-object v0, p0, Lcom/turbochilli/rollingsky/pay/OppPay$2$1;->this$1:Lcom/turbochilli/rollingsky/pay/OppPay$2;

    iget-object v0, v0, Lcom/turbochilli/rollingsky/pay/OppPay$2;->val$mPayCallback:Lcom/turbochilli/rollingsky/pay/PayCallback;

    iget-object v1, p0, Lcom/turbochilli/rollingsky/pay/OppPay$2$1;->this$1:Lcom/turbochilli/rollingsky/pay/OppPay$2;

    iget-object v1, v1, Lcom/turbochilli/rollingsky/pay/OppPay$2;->val$iProduct:Lcom/turbochilli/rollingsky/pay/IProduct;

    const/16 v2, 0xc

    invoke-interface {v0, v1, v2}, Lcom/turbochilli/rollingsky/pay/PayCallback;->onSendOrderInfo(Lcom/turbochilli/rollingsky/pay/IProduct;I)V

    .line 107
    :cond_0
    return-void
.end method