# Path: IApp.py
# class IApp(object):
#     '''
#     classdocs
#     '''
#     name = "Unknown"
#     cname = "Unknown"
#     databases = {}
#     known = False
#     dummyRE = type(re.compile("nfi"))
#     version = [-1]
#     
#     def get_versions(self):
#         return self.version
#     
#     def has_defaultversion(self):
#         if IDeviceVersion.DEFAULT_VERSION in self.version:
#             return True
#         return False
#     
#     def has_version(self,appversion):
#         if appversion in self.version:
#             return True
#         return False
#     
#     def get_packagename(self):
#         return self.name
#     
#     def get_canonicalname(self):
#         return self.cname
#     
#     def get_files(self):
#         return self.databases
#     
#     def get_file_info(self, dbname):
#         if len(self.databases) == 0:
#             return None
#         for thisdbname,defn in self.databases.iteritems():
#             if type(thisdbname) == type("str"):
#                 if thisdbname == dbname:
#                     return defn
#             elif type(thisdbname) == self.dummyRE:
#                 if thisdbname.match(dbname) != None:
#                     return defn
#         return None
#     
#     def set_packagename(self, name):
#         self.name = name
#     
#     def __init__(self):
#         return
# 
# class KnownTable(object):
#     name = None
#     sql = None
#     converter = None
#     knownfields = None
#     def __init__(self, table_name, parse_sql, converter=None, knownfields=None ):
#         self.name = table_name
#         self.sql = parse_sql
#         self.converter = converter
#         self.knownfields = knownfields
# 
# class DataTypes(object):
#     EMPTY = 0
#     DATA = 1
#     TEXT = 2
#     DATE = 3


from IApp import IApp, KnownTable, DataTypes
import ConvertUtils
import re
                    {"lastTouched":ConvertUtils.JsToUnix, 
                     "lastMessageTimestamp":ConvertUtils.JsToUnix  },
                    {"lastTouched":DataTypes.DATE, 
                     "lastMessageTimestamp":DataTypes.DATE }),
        		KnownTable("messages", None, 
                    {"dateSentMs":ConvertUtils.JsToUnix, 
                     "dateReceivedMs":ConvertUtils.JsToUnix },
                    {"dateSentMs":DataTypes.DATE, 
                     "dateReceivedMs":DataTypes.DATE }),
        		KnownTable("operations", None, 
                    {"nextTimeToAttempt":ConvertUtils.JsToUnix  },
                    {"nextTimeToAttempt":DataTypes.DATE }),
            ],
            "webview.db": [
                KnownTable("formdata", 
                    """
                    SELECT 
                        formdata._id, 
                        urlid, 
                        formurl.url, 
                        value 
                    FROM formdata 
                    INNER JOIN formurl on formdata.urlid = formurl._id""")
            ],
            "webviewCookiesChromium.db": [         
                KnownTable("cookies", None, 
                    {"creation_utc":ConvertUtils.WebkitToUnix,
                     "expires_utc":ConvertUtils.WebkitToUnix,
                     "last_access_utc":ConvertUtils.WebkitToUnix},
                    {"creation_utc":DataTypes.DATE, 

# Path: IApp.py
# class IApp(object):
#     '''
#     classdocs
#     '''
#     name = "Unknown"
#     cname = "Unknown"
#     databases = {}
#     known = False
#     dummyRE = type(re.compile("nfi"))
#     version = [-1]
#     
#     def get_versions(self):
#         return self.version
#     
#     def has_defaultversion(self):
#         if IDeviceVersion.DEFAULT_VERSION in self.version:
#             return True
#         return False
#     
#     def has_version(self,appversion):
#         if appversion in self.version:
#             return True
#         return False
#     
#     def get_packagename(self):
#         return self.name
#     
#     def get_canonicalname(self):
#         return self.cname
#     
#     def get_files(self):
#         return self.databases
#     
#     def get_file_info(self, dbname):
#         if len(self.databases) == 0:
#             return None
#         for thisdbname,defn in self.databases.iteritems():
#             if type(thisdbname) == type("str"):
#                 if thisdbname == dbname:
#                     return defn
#             elif type(thisdbname) == self.dummyRE:
#                 if thisdbname.match(dbname) != None:
#                     return defn
#         return None
#     
#     def set_packagename(self, name):
#         self.name = name
#     
#     def __init__(self):
#         return
# 
# class KnownTable(object):
#     name = None
#     sql = None
#     converter = None
#     knownfields = None
#     def __init__(self, table_name, parse_sql, converter=None, knownfields=None ):
#         self.name = table_name
#         self.sql = parse_sql
#         self.converter = converter
#         self.knownfields = knownfields
# 
# class DataTypes(object):
#     EMPTY = 0
#     DATA = 1
#     TEXT = 2
#     DATE = 3


# Path: AndroidApps/com_google_android_gm.py
from IApp import IApp, KnownTable, DataTypes
import ConvertUtils
import re

                    {"lastTouched":ConvertUtils.JsToUnix, 
                     "lastMessageTimestamp":ConvertUtils.JsToUnix  },
                    {"lastTouched":DataTypes.DATE, 
                     "lastMessageTimestamp":DataTypes.DATE }),
        		KnownTable("messages", None, 
                    {"dateSentMs":ConvertUtils.JsToUnix, 
                     "dateReceivedMs":ConvertUtils.JsToUnix },
                    {"dateSentMs":DataTypes.DATE, 
                     "dateReceivedMs":DataTypes.DATE }),
        		KnownTable("operations", None, 
                    {"nextTimeToAttempt":ConvertUtils.JsToUnix  },
                    {"nextTimeToAttempt":DataTypes.DATE }),
            ],
            "webview.db": [
                KnownTable("formdata", 
                    """
                    SELECT 
                        formdata._id, 
                        urlid, 
                        formurl.url, 
                        value 
                    FROM formdata 
                    INNER JOIN formurl on formdata.urlid = formurl._id""")
            ],
            "webviewCookiesChromium.db": [         
                KnownTable("cookies", None, 
                    {"creation_utc":ConvertUtils.WebkitToUnix,
                     "expires_utc":ConvertUtils.WebkitToUnix,
                     "last_access_utc":ConvertUtils.WebkitToUnix},
                    {"creation_utc":DataTypes.DATE, 

                     "expires_utc":DataTypes.DATE, 