altering gps - Java for Android App Development

Im a java programmer new to android. Im currently doing some research into geo location based services and privacy and want to develop an app that can counter the privacy concerns.
I want to develop a security app for a college project that can alter my gps co-ordinates on my device, thus fooling all other apps on my phone into thinking I’m somewhere else, may be another country or just a mile away.
I am aware that there are apps out there in the play store to do this, but I'm not sure how I could implement it myself.
I believe there are classes and methods that can be used. such as Location and setMockLocation. I could use some advice or a point in the right direction.
I believe these methods and classes are normally used for testing purposes but I wonder If I could use them to say fool a service into thinking I’m in my city, but not in my neighbourhood.
Any help, advice would be greatly appreciated

I know this is a late response but better late than never.
I'm sure your intent is benign, but this is precisely the sort of thing frowned upon by the community. Think about it. If an app is allowed to spoof a location, all sorts of fraud could take place. Also, i would assume that any classes provided by Java/crapdroid would be "read only" when it comes to GPS.
That being said, what you can try doing is manually switching off the GPS radio, and then hard-coding a location in your app. For example something like:
int main(void) {
SomeClass.setLocation("Seattle");
}
Normally this is bad practice, and inflexible.
The other thing you can do is sort out your location (city, state, country) based on IP address and adding logic in your app to use that info without ever touching the GPS.
I would also urge you to use GPS location sparingly for 4 primary reasons
1.) You are never guaranteed the user has a device with a GPS radio. Even if s/he has one, there is no guarantee that such radio is turned on in the first place
2.) We don't live in a perfect world. GPS location may not be accurate. For example it may say "Seattle" if you're in the Seattle metro area but that could mean anywhere from Tacoma to Bellingham (a pretty large area)
3.) GPS uses power. This may be a mute point somewhat, but its still valid.
4.) Location services are not always provided by a GPS radio. usually android settings allow for a "hybrid" location approach based in part on your GPS radio, and in part on cellular radio triangulation, and / or relying on your wifi and/or cellular data. This links to point 2 above as well.
Hope this helps in some way

Since my original post, I have pursued my objective, and successfully spoofed the location of my device, Android provides a number of possible ways to do this. I font think the intent is frowned upon at all. My app provides privacy. It cant really be used to commit fraud. Any good forensics investigator would still be able to determine if a location had been spoofed.
There are at least 50 similar apps available on google play store. You should try one

Related

[Q] Better control over location/GPS services?

On my Palm Pre it was possible to enable network-based or network-assisted location without using Google services and without agreeing to let Google collect information about you and your device in the background. On the Shift, this doesn't appear to be the case: apparently, you can have pure GPS satellite location only *or* you can enable network assistance, but to do the latter you have to use Google's services and agree to Google's terms.
So I was wondering whether this is something that developers of custom ROMS and mods are able to do anything about. Would it be possible to tinker with the framework, or whatever part of the firmware controls such things, to allow for more finely-grained control over location services for the end user? Ideally, you would be able to choose:
1) GPS satellites only
2) GPS/aGPS (assisted location or rough triangulation)
3) The above, plus Google's network/Wi-Fi based location services (and agree to whatever terms Google requires for the use of same)
Interestingly, the Galaxy Tab already seems to have the sort of control that I'm talking about.
If I'm misunderstanding something about the way our EVO Shift devices handle location services, please let me know...e.g., could it be the case that selecting only "use GPS satellites" already enables aGPS? If so, you couldn't prove it by me. None of my applications, including Google Maps, seem to be able to use rough network location when I have only "GPS satellites" enabled, although the device itself clearly knows what tower it's registered with at any given time.
Anyway, I just thought I would bring this up to see whether there is any developer interest in tweaking this stuff, and also whether there are other users who are also interested.
BTW, I am aware that this is a "Google phone." No need to point it out. I just want to be able to use the same kind of network-assisted location services that I was able to use on my other, non-Google phones on Sprint.
AnalogXDA said:
On my Palm Pre it was possible to enable network-based or network-assisted location without using Google services and without agreeing to let Google collect information about you and your device in the background. On the Shift, this doesn't appear to be the case: apparently, you can have pure GPS satellite location only *or* you can enable network assistance, but to do the latter you have to use Google's services and agree to Google's terms.
So I was wondering whether this is something that developers of custom ROMS and mods are able to do anything about. Would it be possible to tinker with the framework, or whatever part of the firmware controls such things, to allow for more finely-grained control over location services for the end user? Ideally, you would be able to choose:
1) GPS satellites only
2) GPS/aGPS (assisted location or rough triangulation)
3) The above, plus Google's network/Wi-Fi based location services (and agree to whatever terms Google requires for the use of same)
Interestingly, the Galaxy Tab already seems to have the sort of control that I'm talking about.
If I'm misunderstanding something about the way our EVO Shift devices handle location services, please let me know...e.g., could it be the case that selecting only "use GPS satellites" already enables aGPS? If so, you couldn't prove it by me. None of my applications, including Google Maps, seem to be able to use rough network location when I have only "GPS satellites" enabled, although the device itself clearly knows what tower it's registered with at any given time.
Anyway, I just thought I would bring this up to see whether there is any developer interest in tweaking this stuff, and also whether there are other users who are also interested.
BTW, I am aware that this is a "Google phone." No need to point it out. I just want to be able to use the same kind of network-assisted location services that I was able to use on my other, non-Google phones on Sprint.
Click to expand...
Click to collapse
Not much of a help, most likely.
All i know gps wise is theres a couple of ## codes for the dialer in Sense roms. I think one is ##gpsresetx#
There are gps apps too, which GREATLY help lock and accuracy. Check the market.
Hope somebody knows more than me
Sent from my HTC Speedy (Gonzalez)
Well, although I started the topic in the hopes of starting discussion about how to use network location without being locked down by Google...now that you mention it, it would also be cool if Speedy ROM developers could find a way to fix the cycle of "acquire fix, lose fix, acquire fix, lose fix" that is all too common with these devices...
Sent from my PG06100 using XDA App

[Q] Car Kit Tester App

Hi all,
i am working for a german car manufacturer as test lead for telephone car kits.
I often have problems with testers reporting not enough data for network related problems/errors.
My idea is to supply them with any Android device with a little application recording the track they were driving and as additional info also gives me relevant data of the mobile cells they were booked in during the testdrive.
Recording the track data is the easy part with apps like "My Tracks".
There is also an app called "Antennas" in the market which give me basic cell infos.
Problem is I only need the cell data from cells in which i was registered, i dont need tons of data from neighbouring cells etc...
Since some very experienced devs are around here i'd like to ask how much effort it would be to develop such an app which i.e. generates a *kml file which i can overlay ontop of my track information (i.e. sets a flag everytime i change to a new mobile cell on my way with its relevant data (Cell-ID, network type, fieldstrength etc...))?
Or does anyone knows an app which already does this?
Sorry for my english
effort
prototype could be done fast (several days). but it will take you way more effort to create a stable app which runs on all android devices. does your department already have some experience in android development? some experience in java/eclipse/embedded programming would help a lot.
-didi
We have no one with particular android experience, but we have several ppl with much eclipse/java knowledge and experience.
I'll just ask them, they have to try it in their free time lol, because this app development is not covered by my project and far from official

[Q] Augmented Reality App Development

I would like to know how the AR app Layar/junaio works. I want to build a similar app but for indoor guide of a particular building. The building is fixed and the plan inside the building doesn't change.
The crux of the app would be to guide visitors of the building to their destinations.
End Result: Possibly throw a map as output or provide wikitude like drive.
Typical Usage:
Visitor visits the building, scans the QR code posted at the entrance and downloads the app from appstore/market
At the lobby, user opens the downloaded app and scans another huge picture (Can be barcode or any unique picture)
The app shows the different areas of the building just like layar or junaio and then user selects a particular area and requires a navigation map as output from the point.
Will be using different unique pictures/barcodes at different point to locate the users location instead of relying on gps as it would not help indoors for navigation.
Any inputs on how to start would be of great help. I'm an experienced mobile app developer and have developed regular utility apps, api mashups etc. But nothing in AR.
AR apps usually use a combination of GPS, Compass, Altitude, Accelerometer, and gyroscope data to figure out the exact location of a device. They then access the camera view and place graphics on top of it.
The problem with your idea is that most AR apps usually come in one of two forms:
- Outside without pinpoint accuracy to position, (the device knows exactly the heading so the direction is perfect but the distance may be a litte off)
- Based off a target symbol (think 3ds card, barcode, etc) to keep a point of reference in the scene
Unfortunately your application would require you to be indoors so it would be extremely hard to figure out the exact position because of the GPS loss. At best you could have a series of "scanable qrcodes" to then display a map and direct the user to the next point. You could determine the exact position of a user by calculating the change in gyroscope data from the beginning to the current time, but that would hard especially dealing with inaccuracies and interruptions.
I think the safest bet for your app would be to have codes at certain points to help at your users. If anyone else has a better answer please correct me XD
Dsbtwins said:
You could determine the exact position of a user by calculating the change in gyroscope data from the beginning to the current time, but that would hard especially dealing with inaccuracies and interruptions.
Click to expand...
Click to collapse
That would be epic... but not all phones have gyros. Soo...
What about having devices setup to emit a distinct directional non audible noise that the phone will listen for and use that to key the user to what room they are in. All phones have a microphone.
Or key off music in a room if there is any
From something awesome
Dsbtwins said:
At best you could have a series of "scanable qrcodes" to then display a map and direct the user to the next point.
I think the safest bet for your app would be to have codes at certain points to help at your users. If anyone else has a better answer please correct me XD
Click to expand...
Click to collapse
Well, I have already discounted the use of gps. Series of QR/Scannable Codes
should help me solve the problem. Since I would only be showing a map from the QR/Scannable Code point.
Let me give you an example of how I would like to implement in real life.
User enters walmart, opens the app after scanning the first scannable code, he gets to see the different areas/offers on the camera view (AR)
and then would like to give a map output on how to reach within, when the user selects say "groceries" on the camera view. The app should give a map output on how to reach the groceries area from the scanned location.
I believe lot of people get lost in locating things in a large retail store. Walmart was just an example to explain, there are other stores which have this issue.
Guys, your inputs on the idea itself are welcome.
killersnowman said:
That would be epic... but not all phones have gyros. Soo...
What about having devices setup to emit a distinct directional non audible noise that the phone will listen for and use that to key the user to what room they are in. All phones have a microphone.
From something awesome
Click to expand...
Click to collapse
I dont think it will work in a noisy environment like malls, retail stores etc. But works well in a ambient place like museum. Though ur idea is brilliant, dont know how it will work in reality.
Yes that sounds like it should be possible. An honestly what you could do is have a large "maker" (some sort of distinguishable shape and color or pattern) on a cube in the middle of the store, that way when the user holds up his phone to look at it, the phone will know what he is looking at depending on which face on the cube it is. you can then use that as a reference in the view and map out location icons over the view.

Security breach found on htc devices

The Vulnerability
In recent updates to some of its devices, HTC introduces a suite of logging tools that collected information. Lots of information. LOTS. Whatever the reason was, whether for better understanding problems on users' devices, easier remote analysis, corporate evilness - it doesn't matter. If you, as a company, plant these information collectors on a device, you better be DAMN sure the information they collect is secured and only available to privileged services or the user, after opting in.
That is not the case. What Trevor found is only the tip of the iceberg - we are all still digging deeper - but currently any app on affected devices that requests a single android.permission.INTERNET (which is normal for any app that connects to the web or shows ads) can get its hands on:
the list of user accounts, including email addresses and sync status for each
last known network and GPS locations and a limited previous history of locations
phone numbers from the phone log
SMS data, including phone numbers and encoded text (not sure yet if it's possible to decode it, but very likely)
system logs (both kernel/dmesg and app/logcat), which includes everything your running apps do and is likely to include email addresses, phone numbers, and other private info
Normally, applications get access to only what is allowed by the permissions they request, so when you install a simple, innocent-looking new game from the Market that only asks for the INTERNET permission (to submit scores online, for example), you don't expect it to read your phone log or list of emails.
But that's not all. After looking at the huge amount of data (the log file was 3.5MB on my EVO 3D) that is vulnerable to apps exploiting this vulnerability all day, I found the following is also exposed (granted, some of which may be already available to any app via the Android APIs):
active notifications in the notification bar, including notification text
build number, bootloader version, radio version, kernel version
network info, including IP addresses
full memory info
CPU info
file system info and free space on each partition
running processes
current snapshot/stacktrace of not only every running process but every running thread
list of installed apps, including permissions used, user ids, versions, and more
system properties/variables
currently active broadcast listeners and history of past broadcasts received
currently active content providers
battery info and status, including charging/wake lock history
and more
Let me put it another way. By using only the INTERNET permission, any app can also gain at least the following:
ACCESS_COARSE_LOCATION Allows an application to access coarse (e.g., Cell-ID, WiFi) location
ACCESS_FINE_LOCATION Allows an application to access fine (e.g., GPS) location
ACCESS_LOCATION_EXTRA_COMMANDS Allows an application to access extra location provider commands
ACCESS_WIFI_STATE Allows applications to access information about Wi-Fi networks
BATTERY_STATS Allows an application to collect battery statistics
DUMP Allows an application to retrieve state dump information from system services.
GET_ACCOUNTS Allows access to the list of accounts in the Accounts Service
GET_PACKAGE_SIZE Allows an application to find out the space used by any package.
GET_TASKS Allows an application to get information about the currently or recently running tasks: a thumbnail representation of the tasks, what activities are running in it, etc.
READ_LOGS Allows an application to read the low-level system log files.
READ_SYNC_SETTINGS Allows applications to read the sync settings
READ_SYNC_STATS Allows applications to read the sync stats
Theoretically, it may be possible to clone a device using only a small subset of the information leaked here.
I'd like to reiterate that the only reason the data is leaking left and right is because HTC set their snooping environment up this way. It's like leaving your keys under the mat and expecting nobody who finds them to unlock the door. For a more technical explanation, see the section below.
Additionally, and the implications of this could end up being insignificant, yet still very suspicious, HTC also decided to add an app called androidvncserver.apk to their Android OS installations. If you're not familiar with the definition of VNC, it is basically a remote access server. On the EVO 3D, it was present from the start and updated in the latest OTA. The app doesn't get started by default, but who knows what and who can trigger it and potentially get access to your phone remotely? I'm sure we'll know soon enough - HTC, care to tell us what it's doing here?
Technical Details
In addition to Carrier IQ (CIQ) that was planted by HTC/Sprint and prompted all kinds of questions a while ago, HTC also included another app called HtcLoggers.apk. This app is capable of collecting all kinds of data, as I mentioned above, and then... provide it to anyone who asks for it by opening a local port. Yup, not just HTC, but anyone who connects to it, which happens to be any app with the INTERNET permission. Ironically, because a given app has the INTERNET permission, it can also send all the data off to a remote server, killing 2 birds with one stone permission.
In fact, HtcLogger has a whole interface which accepts a variety of commands (such as the handy :help: that shows all available commands). Oh yeah - and no login/password are required to access said interface.
Furthermore, it's worth noting that HtcLogger tries to use root to dump even more data, such as WiMax state, and may attempt to run something called htcserviced - at least this code is present in the source:
/system/xbin/su 0 /data/data/com.htc.loggers/bin/htcserviced
HtcLoggers is only one of the services that is collecting data, and we haven't even gotten to the bottom of what else it can do, let alone what the other services are capable of doing. But hey - I think you'll agree that this is already more than enough.
Patching The Vulnerability
... is not possible without either root or an update from HTC. If you do root, we recommend immediate removal of Htcloggers (you can find it at /system/app/HtcLoggers.apk).
Stay safe and don't download suspicious apps. Of course, even quality-looking apps can silently capture and send off this data, but the chance of that is lower.
Affected Phones
Note: Only stock Sense firmware is affected - if you're running an AOSP-based ROM like CyanogenMod, you are safe.
EVO 4G
EVO 3D
Thunderbolt
EVO Shift 4G? (thanks, pm)
MyTouch 4G Slide? (thanks, Michael)
the upcoming Vigor? (thanks, bjn714)
some Sensations? (thanks, Nick)
View 4G? (thanks, Pat)
the upcoming Kingdom? (thanks, Pat)
most likely others - we haven't verified them yet, but you can help us by downloading the proof of concept above and running the APK
HTC's Response
After finding the vulnerability, Trevor contacted HTC on September 24th and received no real response for five business days, after which he released this information to the public (as per RF full disclosure Policy). In my experience, lighting fire under someone's ass in public makes things move a whole lot faster, which is why responsible disclosure is a norm in the security industry. (This is where we come in.)
As far as we know, HTC is now looking into the issue, but no statement has been issued yet.
HTC, you got yourself into this mess, and it's now up to you to climb out of the hole as fast as possible, in your own interest.
The ball is in your court.
Credit
ANDROID POLICE
Huge thank you to Trevor Eckhart who found the vulnerability and Justin Case for working with us today digging deeper.
Hi there, I need help, someone is consistently hacking into my phone, htc evo 4g, they are penetration testers and pc savvy, currently I cant login to the phn for trying to do a factory reset. They kept intercepting me and now my password does not work. Who knows maybe they changed it on their side. I wrote down everything I saw. I was seeing all these process running for the same app. in my applications. My phone was getting hot, freezes but its people that live in my apt complex and at work. can you help?
zzm5 said:
Hi there, I need help, someone is consistently hacking into my phone, htc evo 4g, they are penetration testers and pc savvy, currently I cant login to the phn for trying to do a factory reset. They kept intercepting me and now my password does not work. Who knows maybe they changed it on their side. I wrote down everything I saw. I was seeing all these process running for the same app. in my applications. My phone was getting hot, freezes but its people that live in my apt complex and at work. can you help?
Click to expand...
Click to collapse
Is your device rooted?
I used root explorer and removed the HtcLoggers.apk and other than the forced close loop that removing it caused (requiring me to remove the battery), after rebooting all seems to be working fine.
EDIT: Actually I didn't just delete HtcLoggers.apk but moved it to a safe location on the SD Card in case there was a problem and it needed to be restored. I highly suggest you do this instead of just deleting it, or better yet, a nandroid backup.
there are a few good ROMS out there that have the ICQ loggers removed already.
Do we really need three threads on the front page about the same thing?

Mobile phone Intrusion Detection System

Hi,
I'm new to this forum and after having a solid look around the site I have been unable to find anything that comes close to what I have in mind.
I am currently a student at Edinburgh Napier University and I am looking into the possibility of creating a local Intrusion Detection System on a Smartphone. One capable of informing a user that an intruder is currently attempting to gain access to their device and carry out malicious activities.
Has anyone managed to find anything I have not as I am under the impression that no such software exists for any type of Smartphone device. My main consideration is with Windows Phone but I would like to hear about anything that is out there that relates to this.
Any help would be amazing.
Thanks in advance :highfive:
I have no input, but this is interesting stuff. Will the hardware be robust enough to support it?
I know people have gotten Ubuntu running on various mobile devices, but it'd be interesting to see how SNORT (or similar) plays with mobile hardware.
The problem you are going to have (not unsurmountable) is that if you ignore the infosec/marketing what you have out there is primarily black box IDS devices, with capabilities to also run as an IPS.
However only the most nieve such as UK Gov & Local Gov have( certainly none of the Tier 1 Inv.Banks I have worked for) have switched IPS on for fear of backlash. It would be something if developed I would be interested in seeing, certainly if it could act as an IDS on a Ad-Hoc VPN there is commercial opportunities there....
So ask yourself - are you REALLY wanting to BOTH Detect and Prevent or merely Detect and Acknowledge. The latter a more easy task, less of a hit on functionality.
Perhaps there is an old Cybertrust source code now opensource....as a thought for you, but it would need reengineering as was a custom image.
In the meantime if what you actually want is Single IP/MAC/Hardware protection - why not root the device, install Synodroid (to control who or what has SU equivalent access) & DroidWall (firewall to limit traffic) & do an audit of the Apps you have downloaded of the rights requested. Perhaps setup a VPN to your university network or local broadband router (if you trust who manages them) so at least there is another layer to go through. However if you someone who opens zip's//tars on the device with install privileges elevated then your accepting the consequences. (Above Android related)
There is bound to be an IP traffic audit tool app - so you could use to Record a 24/26/48 hour period of the address ranges and what process linked back. But as you then start moving down the completely pain in the neck Firewall Rule analysis piece and SIEM world, don't!
Thanks finlaand
Thanks finlaand that is a lot to go on I really appreciate your thoughts.
I will be sure to keep you all up-to-date on how things are going.
Many thanks again :good:

Categories

Resources