-
-
Save JarLob/a2954430c35905b48f758391cdaf209e to your computer and use it in GitHub Desktop.
Frida script to fake location on Android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const simulated_latitude = 48.8534 | |
const simulated_longitude = 2.3488 | |
Java.perform(function(){ | |
const Location = Java.use('android.location.Location') | |
var location = Location.$new("gps") | |
location.setLatitude(simulated_latitude) | |
location.setLongitude(simulated_longitude) | |
Location.$init.overload("android.location.Location").implementation = function(x){ | |
console.log("Instantiated new location ( Location ) ") | |
return location | |
} | |
Location.$init.overload("java.lang.String").implementation = function(x){ | |
console.log("Instantiated new location ( String ) ") | |
return location | |
} | |
Location.getLatitude.implementation = function(){ | |
console.log("Old latitude : " + this.getLatitude() + ", New Latitude : " + simulated_latitude) | |
return simulated_latitude | |
} | |
Location.getLongitude.implementation = function(){ | |
console.log("Old longitude : " + this.getLongitude() + ", New Longitude : " + simulated_longitude) | |
return simulated_longitude | |
} | |
// Not sure if needed, bypass fake location check | |
Location.isFromMockProvider.implementation = function(){ | |
console.log("Location.isFromMockProvider -> false") | |
return false | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment