Pablo
Pablo

Reputation: 138

Smali: modify methods to return True

I've been struggling reverse engineering an apk for a few hours and now I think I'm stuck. I have a few methods to modify in order to always return True. For one I managed to simply set a constant an return it but for these ones I can't wrap my head around it.

1 - This one must be quite simple I guess :

.method public getHasRight()Ljava/lang/Boolean;
    .locals 1
    .annotation build Landroidx/annotation/NonNull;
    .end annotation

    .line 1
    invoke-virtual {p0}, Lcom/milibris/lib/mlkc/model/KCIssue;->realmGet$hasRight()Ljava/lang/Boolean;

    move-result-object v0

    return-object v0
.end method

2 - This one I think I need to set p1 as true but I always get errors during compilation.

.method public setIsFree(Ljava/lang/Boolean;)V
    .locals 0
    .param p1    # Ljava/lang/Boolean;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param

    .line 1
    invoke-virtual {p0, p1}, Lcom/milibris/lib/mlkc/model/KCIssue;->realmSet$isFree(Ljava/lang/Boolean;)V

    return-void
.end method

3 - This one, as it doesn't have Ljava/lang/Boolean I'm not even sure it must return a boolean ? How can I be sure. And anyway, how can I make it return true ?

.method public isConnected()Z
    .locals 1

    .line 1
    iget-object v0, p0, Landroid/support/v4/media/MediaBrowserCompat;->a:Landroid/support/v4/media/MediaBrowserCompat$b;

    invoke-interface {v0}, Landroid/support/v4/media/MediaBrowserCompat$b;->isConnected()Z

    move-result v0

    return v0
.end method

Sorry for this wish list but I have too many purple links on Google. Smali is quite hard to grasp at first, especially when you're not from the Java world.

Thanks for your help :)

Upvotes: 3

Views: 3571

Answers (0)

Related Questions