October 01, 2017

Motoactv hacking: Updating golf info

Posted at October 1, 2017 02:20 AM in Software .

   Ongoing theme of many products or features that I enjoy are either discontinued, modified, or closed down. This occurrence happened when I brought my motoactv out to the Torrey Pines North golf course. In preparation I reset to stock firmware, rooted it, and then downloaded the California courses through the official app.

The next day got to the first tee and the yardage did not match the scorecard. We were paired with some strangers, so I asked if something changed recently. They said the course was re-designed last year mainly swapping the back nine with the front. This article provides more details of the changes.

The redesign meant I couldn't use my motoactv as a range finder for the day. No problem, use the course markers and estimations for the day. However, there's an upcoming tee time next week and I needed to make things right.

As you see, course info from 2012 would not cut it.

More info after the click.

The rest of this post will describe how I made it right. Note: the last entry in the list is truncated but reads Torrey Pines North New. That's the one I put into there.

  • Figuring out the app structure
  • Seeing known good data
  • Getting relevant updated data
  • Inserting back into the app

Figuring out the app structure

This is much easier with a rooted device. Combined with websearching I Was able to get all the info needed to figure out the app structure. The app downloads zip packages from a server with a format like CountryAbbr-StateAbbr_Version.zip. For example, US-CA_753.0.zip. Other countries have a similar, but slightly different format.

The downloaded data package

Within the zip package there's a folder with the same state abbreviation, in this example: CA. Within that folder there are many numbered files with an extension .xml.enc. There's also a database index file.

The xml is encouraging to see, so the data will be easy to format for loading back to the software. However the .enc extension is a bit worrisome as it indicates some encoding. Opening the file confirms this as there's no recognizable xml data within.

Now that I know what to look for it is time to go poking around the motoactv itself. Logging into it's adb shell and doing a search for a known good numbered filename shows the unzipped data stored in /mnt/sdcard/golfcourses in the directory matching the state abbreviation, in this example /mnt/sdcard/golfcourses/CA.

The databases

Under /mnt/sdcard/golfcourses there's a database for looking up zipcodes based on gps coordinates location. This one seems won't be needing to be edited for my purpose. I don't live in a new unregistered city or area.

The state's index was interesting and will need to be edited to add an entry once I make a new entry. Here's the schema:

CREATE TABLE courses ( _id INTEGER PRIMARY KEY, name TEXT, city TEXT, latitude REAL, longitude REAL, filename TEXT );
CREATE INDEX IDX_COURSE_NAME_CITY_NAME ON courses(name, city);
CREATE INDEX IDX_LAT_LON ON courses(latitude, longitude);

Under /data/data/com.motorola.motogolf there's also a directory called databases which contains golf.db and courses.db. Poking around at those it looks like neither of these will need to be altered. If you're loading courses only by side-loading and not receiving from the server then the courses.db will need to be altered to signal that the course is presently available. Here's the schema:
CREATE TABLE android_metadata (locale TEXT);
CREATE TABLE course_country (_id INTEGER PRIMARY KEY NOT NULL, country_name TEXT);
CREATE TABLE course_state_country (_id INTEGER PRIMARY KEY NOT NULL, state_name TEXT, state_abb TEXT, country_id INTEGER NOT NULL, version_number REAL, status INTEGER );
CREATE TABLE course_download_requests (request_id INTEGER PRIMARY KEY NOT NULL, state_id INTEGER, file_name TEXT, request_status INTEGER, action INTEGER);

Here's my listing with CA loaded and with MA not loaded:
5|California|CA|1|753.0|10
22|Massachusetts|MA|1||0

Now I think I will know how to make the app see the data once I can create it. In order to create it I need to see known good data.

Seeing known good data

Best place to begin is where you are familiar. After looking at the database the file 5497.xml.enc matches the errant Torrey Pines north data set. Doing some websearches and happening upon an article by a beta tester it was determined that the data comes from SkyDroid. Looking at SkyDroid's Torrey Pines North listing showed correct data. They've updated it, but since Motorola discontinued this product many years ago I don't hope to see the updated via the official channel.

One observation was that the Torrey Pines North course_id in the URL did not match with 5497. However their Torrey Pines South listing matched my motoactv database ID of 216.

Now I have a data source, but I still don't know how to see the formatting. There's two ways to go about this, but I am not smart enough about encryption to take the method of reversing the encoding.

I chose to see how motorola did it and now know take to my compiler to write a program in C with openssl crypto library in order to decode the .xml.enc file into a simple .xml file. Later I would write an encrypt function into the same program. Here's the top of the code.

Success, the schema is pretty simple to follow with nodes such as course and subcourses. Within subcourses there's holes and features within them to describe the green or hazards and positions such as front, center, and back.

Getting relevant updated data

Poking around a couple hours on SkyDroid's website and within their javascript and php sites I was unable to download the data in the same xml format. Then I tried to figure out how to turn the markers on the map into manual gps coordinates with google and their sites/APIs. That was also a dead end for me.

Then I figured why not do the same as I did with the motorola approach and see how SkyDroid does it. Success.

Inserting back into the app

Two approaches were considered. Since the old data is stale I could simply replace it and have less work. However, to ensure I didn't mess anything up I decided to make a new original entry.

I took my newly obtained data, inserted it into a file called 46028.xml, then I wrote the encrypter function in my program, encrypted it, and finally gave it the .enc extension.

Then pulled the index.db from the CA directory of the device and cloned the Torrey Pines North entry. Updated the entry to point the file to 46028.xml. Put the file back on the device in the right spot and rebooted the device to find the playable course on there! Next week will put this to good use.

Trackback

You can ping this entry by using http://www.wanderinghuman.com/cgi-bin/mt-tb.cgi/119 .

Comments

Very energetic article, I loved that bit. Will there be a part 2?

Posted by grosir celana sirwal at October 13, 2017 12:42 AM

Very energetic article, I loved that bit. Will there be a part 2?

Posted by grosir celana sirwal at October 13, 2017 12:42 AM

This text is invaluable. How can I find out more?

Posted by master seo at October 13, 2017 01:55 AM

I do not even know how I ended up here, but I thought this post was
good. I do not know who you are but definitely you're going to a famous blogger if you aren't already ;) Cheers!

Posted by gaming stuhl test at October 13, 2017 12:50 PM

Hi, this weekend is nice designed for me, as
this time i am reading this fantastic educational post here
att my house.

Posted by https://horoscopestarotspsychics.blogspot.com at October 15, 2017 12:21 AM

Magnificent beat ! I wuld like to apprentice whilst you amend your
site, how can i subscribe for a blog website?
The account aided me a appropriate deal. I had been a little bit familiar of this your
broadcast provided bright clear concept

Posted by Fausto Scibetta at October 15, 2017 09:24 AM

First of all I want to say wonderful blog! I had a quick question that I'd like to ask if you don't mind.
I was interested to find out how you center yourself and clear your head prior to writing.

I've had a difficult time clearing my thoughts in getting my
thoughts out. I do enjoy writing however it just seems like the first 10
to 15 minutes are wasted just trying to figure out how to begin. Any recommendations or hints?
Kudos!

Posted by grosir celana sirwal at October 16, 2017 05:42 AM

First of all I want to say wonderful blog! I had a quick question that I'd like to ask if you don't mind.
I was interested to find out how you center yourself
and clear your head prior to writing. I've had a difficult
time clearing my thoughts in getting my thoughts out.
I do enjoy writing however it just seems like the first
10 to 15 minutes are wasted just trying to figure out how to begin. Any recommendations or hints?
Kudos!

Posted by grosir celana sirwal at October 16, 2017 05:43 AM

Wow, amazing weblog format! How lengthy have you ever
been blogging for? you made running a blog look easy. Thhe full look of your wegsite is great, as ell
as the content material!

Posted by kursus bahasa inggris sekitar bsd at October 17, 2017 01:14 AM

Thanks for sharing your thoughts on best arc lighter.
Regards

Posted by best arc lighter at October 17, 2017 08:43 PM

There is certainly a great deal to learn about this issue.
I love all of the points you made.

Posted by try these guys out at October 18, 2017 04:27 PM

Interesting blog! Is your theme custom made or did you download it from somewhere?
A theme like yours with a few simple adjustements would really make my blog stand out.
Please let me know where you got your theme.

Thanks a lot

Posted by Courses at October 18, 2017 05:58 PM

Once you've thought we would quit, turn it into a momentous event in your own life by consciously putting away a date when you is going to do it.
So often it's said that the inner world creates our outer world,
and then for many I believe that is true. As you begin to
feel good physically, mentally, emotionally and psychologically you'll
be involved in your own personal life, and those that care about you'll also
reap the advantages because you reconnect on the healthy,
positive level.

Posted by Priscilla at October 19, 2017 02:05 AM

I just could not go away your website prior to suggesting that I extremely enjoyed the
usual info an individual provide to your guests?
Is going to be back frequently in order to check up on new
posts

Posted by gamification strategy at October 23, 2017 06:33 AM

I just could not go away your website prior to suggesting that I extremely enjoyed the usual
info an individual provide to your guests? Is going to be badk frequently iin order to check
up on new posts

Posted by gamification strategy at October 23, 2017 06:34 AM

We are a bunch of volunteers and opening a brand new
scheme in our community. Your website offered us with helpful info to paintings on.
You have done an impressive activity and our entire group will probably be thankful to
you.

Posted by Pearline at October 27, 2017 10:01 AM

Hey! I know this is kind of off topic but I was wondering which blog platform are you using for this site?
I'm getting fed up of Wordpress because I've had problems with hackers and I'm
looking at alternatives for another platform. I would be fantastic if you could point me in the direction of a good platform.

Posted by download universal androot apk at November 1, 2017 09:16 PM

Hey! I know this is kind of off topic but I was wondering which blog platform are you using for this site?
I'm getting fed up of Wordpress because I've had problems with hackers and I'm looking
at alternatives for another platform. I would be fantastic if you could point me in the direction of a
good platform.

Posted by download universal androot apk at November 1, 2017 09:17 PM

Excellent post. I used to be checking continuously this weblog and I'm impressed!
Very helpful information specifically the remaining section :
) I care for such info a lot. I used to be seeking this certain info for a very long time.
Thanks and good luck.

Posted by root genius apk at November 2, 2017 10:45 PM

I am in fact happy to glance at this blog posts which consists of plenty of helpful data,
thanks for providing these information.

Posted by root master apk download at November 5, 2017 06:58 AM

Hey just wanted to give you a quick heads up. The
text in your post seem to be running off the screen in Chrome.
I'm not sure if this is a format issue or something to
do with browser compatibility but I thought I'd post to let you know.
The design look great though! Hope you get the problem resolved
soon. Many thanks

Posted by Android Hacking at November 7, 2017 08:33 AM

Hello very cool blog!! Guy .. Beautiful .. Wonderful ..

I will bookmark your site and take the feeds additionally?
I'm happy to find so many useful information right here within the put up, we want work
out more techniques in this regard, thank you for sharing.
. . . . .

Posted by Learn colors at November 11, 2017 12:06 AM

Hello very cool blog!! Guy .. Beautiful ..
Wonderful .. I will bookmark your site and take the feeds additionally?
I'm happy to find so many useful information right here within the put up, we want work out more techniques in this regard, thank you for sharing.
. . . . .

Posted by Learn colors at November 11, 2017 12:07 AM

At this time I am ready to do my breakfast, afterward having my breakfast coming
again to read additional news.

Posted by 33___ at November 12, 2017 02:37 AM

I am actually delighted to glance at this weblog posts which carries lots of valuable information, thanks for providing these kinds
of data.

Posted by Lemuel at November 25, 2017 06:54 PM

I'm not certain the place you are getting your information, however great topic.
I needs to spend some time finding out much more or working out more.
Thanks for wonderful information I used to be searching for this information for
my mission.

Posted by baju senam aerobik at November 28, 2017 09:55 AM

As a Newbie, I am always exploring online for artices
that can help me. Thank you

Posted by Cynthia at November 28, 2017 11:16 PM

Post a comment










Remember personal info?