3

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 :)

Pablo
  • 138
  • 7
  • 2
    I know it's a little late, but - The third method returns a primitive boolean value, `Z`. In order to return true, add this line `const/4 v0, 0x1` just before the return statement. The other two methods involve Boolean objects so we can't use primitives, I think. For the first method add this line `sget-object v0, Ljava/lang/Boolean;->TRUE:Ljava/lang/Boolean;` before return. For the second, I'm not sure what you're trying to do, but the function should return void (`V`), not boolean. If you want to set `p1` to true, try `sget-object p1, Ljava/lang/Boolean;->TRUE:Ljava/lang/Boolean;`. – t.m.adam Dec 21 '20 at 19:00

0 Answers0