How to bypass isFromMockProvider

91 views Asked by At

I tried to edit source code of an app which is used to locate servants It has a function or parameter isFromMockProvider() I guess this one is the culprit

I want to bypass it So that App could not know that I am using Mock location.

I am a python dev not know enough about Smali Please Help.. Thank You..

method public static final isMocked(Landroid/location/Location;)Z

    .locals 2

    const-string v0, "<this>"

    invoke-static {p0, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V

    sget v0, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v1, 0x1f

    if-lt v0, v1, :cond_0

    .line 200

    invoke-static {p0}, Lcom/free/freeapp/ui/RouteStepView$$ExternalSyntheticApiModelOutline0;->m(Landroid/location/Location;)Z

    move-result p0

    goto :goto_0

    .line 202

    :cond_0

    invoke-virtual {p0}, Landroid/location/Location;->isFromMockProvider()Z

    move-result p0

    :goto_0

    return p0

.end method
1

There are 1 answers

0
Robert On

If you want to modify the result of the call isFromMockProvider()then you have to look at these two lines:

invoke-virtual {p0}, Landroid/location/Location;->isFromMockProvider()Z

move-result p0

The first line calls the method isFromMockProvider(), the second stores the return value of the call into register p0.

Then p0is later returned as return value of isMocked(Location).

If you want to prevent your mocked locations from being recognized you need to let isMocked(Location) false (which is 0 in Smali as there is no special boolean type).

The easiest way is to leave everything as it is and just ignore the return value of isFromMockProvider(). So instead of the two lines presented in the first code block of this post we use this one:

invoke-virtual {p0}, Landroid/location/Location;->isFromMockProvider()Z

# move-result p0 # line is commented out

const/4 p0, 0x0 # write false=0 into p0