Decoding cache.cell and cache.wifi files

As everybody knows, Android is maintaining two cache files with location information. One is cache.wifi (a wifi router database with MAC and GPS of the router) the other is cache.cell (a database with mobile communication cells and their GPS). Due to the fact, that these files are in binary format the following Python code-snippet should help to encode the actual data:

cacheFile = open("cache.wifi", 'rb')
version, entries = struct.unpack('>hh',
i = 0
while i < entries:
   key ='>h',[0])
   (accuracy, confidence, latitude, longitude, readtime) = struct.unpack('>iiddQ',
   outputFile.write('%25s %7d %5d %10f %10f %s \n' % (key,accuracy,confidence,latitude,longitude,time.strftime("%x %X %z", time.localtime(readtime/1000))))

The cache files are located at:

This snippet works for both cache files, just change the filename 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.