bnalls33 / MockMockLocations

XPosed Module Preventing Apps from Detecting "Allow mock locations" setting.
74 stars 17 forks source link

Pokemon Go #3

Open mtx-z opened 8 years ago

mtx-z commented 8 years ago

Pokemon Go application on Android seems to detect it anyway (block GPS localization if developer settings is enabled). Would be really cool to have it work with it !

NovaCygni commented 8 years ago

Confirmed :(

twilightgod commented 8 years ago

+1

Rooie89 commented 8 years ago

+1

veneliniliev commented 8 years ago

+1

bnalls33 commented 8 years ago

Ok, it should work now. I released a new update.

RevMuun commented 8 years ago

New update seems to help but the game keeps flipping between detecting and not detecting mock locations. Curious if anyone else is having the same problem?

kayraucklnc commented 8 years ago

Doesnt work game behaving by itself. It works for making fake gps apps detect on but game detect on too :( i cant see pokeballs or gyms

bnalls33 commented 8 years ago

What GPS app are you using? What type of phone? I have a Nexus 5X & this GPS app: https://play.google.com/store/apps/details?id=com.incorporateapps.fakegps.fre&hl=en

mtx-z commented 8 years ago

It's not the Niantic first localized app. I think there is another check happening. I was able to simulate a path on the game, seeing my player walk on the map following the path/speed i setted. But even if this work, the game see something and say 'cannot locate you'.

bnalls33 commented 8 years ago

Are you moving too quickly along the path?

mtx-z commented 8 years ago

Nop, setted a 5km/h speed, the player seems to respect that. So even if i see me moving on the map, the app see something and dont trust/want the locations data.

RevMuun commented 8 years ago

I have a Galaxy S5 using the same Fake GPS app you're using (PRO version).

Go seems to flip back and forth from accepting my location and failing to locate me. Happy to help debug in any way I can.

mtx-z commented 8 years ago

2 files in the app are refering to the 'mock' word :

    PendingResult<Status> setMockLocation(GoogleApiClient googleApiClient, Location location);
    public static final String KEY_LOCATION_CHANGED = "com.google.android.location.LOCATION";
    public static final String KEY_MOCK_LOCATION = "mockLocation";
    public PendingResult<Status> setMockLocation(GoogleApiClient client, Location mockLocation) {
        return client.zzb(new C06394(this, client, mockLocation));
    }

    public PendingResult<Status> setMockMode(GoogleApiClient client, boolean isMockMode) {
        return client.zzb(new C06383(this, client, isMockMode));
    }

Idk enough of Android/Java to understand something usefull.

I also see near some 'looper' variable, isMockMode boolean, PendingResult result methods... So the localization coming and going, seems to loop. A CRON job like to check Mock Mode somehow.

EDIT: used this to decompile apk

skylve commented 8 years ago

I could successfully mock the location by blocking all apps in MockMock (couldn't whitelist pokemon only). Though my location is jumping between my real and mocked position (maybe since the mocking app don't see the mocking is on).

Did somebody check if they are using a background process to verify if the location is mocked. If they do so, this line sharedPreferences.getStringSet(Common.PREF_KEY_WHITELIST_APP_LIST, new HashSet<String>(0)).contains(lpparam.packageName)) wouldn't work since the package name would be something like com.nianticlabs.pokemongo:background.

bnalls33 commented 8 years ago

I haven't checked but you're right, there could be other processes. I didn't build the whitelist for Pokemon Go purposes.

mtx-z Has some good findings too. This is the first I've heard about FusedLocationProvider. KEY_MOCK_LOCATION is new to me. We may need to mock Location.getExtraLocation(KEY_MOCK_LOCATION), and/or modify getExtras() to modify the value "KEY_MOCK_LOCATION" in the bundle.

mtx-z commented 8 years ago

Android documentation

KEY_MOCK_LOCATION Key used for the Bundle extra in Location object holding a boolean indicating whether the location was set using setMockLocation(GoogleApiClient, Location).

Also see this stack and this about Fused locator

skylve commented 8 years ago

@bnalls33 The whitelist is a really good feature, downloaded MockMock few days ago and was looking forward this ! Thanks for adding it =) If you want, I can submit a PR to also manage background process.

ireflex198 commented 8 years ago

Could you help me out? Im new to this stuff, so please bear with me if i say anything stupid. You said you released a new version that works with pokemon go and other apps, could you provide a link for an apk? Thanks!

mtx-z commented 8 years ago

You can find a build here. Note that the app is not 100% working with PokeGo yet.

mtx-z commented 8 years ago

I tried to view some file using an Hex Editor. From file

\assets\bin\Data\Managed\Metadata

... MockILocationProvider.get_HasValidLocation.get_IsMeasuredLocation.HasValidLocation.IsMeasuredLocation.MockIMapController.add_OnWorldScaleOrOriginChanged.remove_OnWorldScaleOrOriginChanged.get_CompassLock.set_CompassLock.get_Config.set_Config.get_GPSLock.set_GPSLock. ...

ireflex198 commented 8 years ago

Is root required for this BTW? So can i just install the apk and use a gps spoofer? Thanks for the help in advance.

skylve commented 8 years ago

@ireflex198 take a look at Xposed, this repository is only a module for this framework. Also, this is not really a place to ask for this stuff, more about how to develop it (I saw you created your Github account to ask this question). @bnalls33 we should maybe close this Issue (or rename it?) and create different ones to manage what @mtx-z is saying.

bnalls33 commented 8 years ago

@skylve What were you suggesting that your code would do "[I can submit a PR to also] manage background process"

RevMuun commented 8 years ago

Was reading up on possible other hooks and saw this: https://stackoverflow.com/questions/6880232/disable-check-for-mock-location-prevent-gps-spoofing

Is it possible that Pokemon Go is looking to see if any app is requesting ACCESS_MOCK_LOCATION permissions and assuming nefarious purposes?

Is there any value to preventing the LocationManager.removeTestProvider function?

DJWassink commented 8 years ago

How sure are we that it's even pokemon which is doing this? Without pokemon started on my phone (stopped in androids apps settings menu). It also shows the same behaviour in google maps.

Okay so it is indeed because of the FusedLocationService. Check this reddit post how to disable it

https://www.reddit.com/r/PokemonGoSpoofing/comments/4sdqkg/android_if_gps_jumps_from_spoof_location_to_real/

NovaCygni commented 8 years ago

Throwing it out there but most people are just being dumb and havnt set "GPS Mode/Location Services" to "Device Only" and are being dumb using LowPower (* Wifi networks GPS location *) or HighAccuracy... the correct setting should be device GPS only.