# Path: IApp.py
# class DataTypes(object):
#     EMPTY = 0
#     DATA = 1
#     TEXT = 2
#     DATE = 3
# 
# 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


import os,cgi,string,re,StringIO
import ExtractStore
import shutil
import magic
import biplist
import traceback,sys,base64
from IApp import DataTypes, IApp
from MimeGuesser import MimeGuesser
                content = f.read()
            except:
                return """
                <p>File {} not found. Please make sure that you haven't
                unmounted any images regarding this case
                """.format(cgi.escape(appfile.filepath))
            return self._get_datahtml(content)
        else:
            return self._get_datahtml(appfile.content)
    
    def dump_strings(self, appfile):
        if appfile.ftype == ExtractStore.TYPE_MULTI:
            if appfile.filepath == None:
                return "<p>Unexpected Error: no filepath specified</p>"
            try:
                f = open(appfile.filepath, "rb")
                content = f.read()
            except:
                return """
                <p>File {} not found. Please make sure that you haven't
                unmounted any images regarding this case
                """.format(cgi.escape(appfile.filepath))
            return self._get_stringshtml( self.restringsdump(content))
        else:
            return self._get_stringshtml(self.restringsdump(appfile.content))
    
    def datahandler(self, value):
        return """
                <button class="btn btn-primary btn-sm" onclick="hideshow(this);">
                Show Data <span class="glyphicon glyphicon-chevron-down"></span>

# Path: IApp.py
# class DataTypes(object):
#     EMPTY = 0
#     DATA = 1
#     TEXT = 2
#     DATE = 3
# 
# 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


# Path: HtmlExtract.py
import os,cgi,string,re,StringIO
import ExtractStore
import shutil
import magic
import biplist
import traceback,sys,base64
from IApp import DataTypes, IApp
from MimeGuesser import MimeGuesser

                content = f.read()
            except:
                return """
                <p>File {} not found. Please make sure that you haven't
                unmounted any images regarding this case
                """.format(cgi.escape(appfile.filepath))
            return self._get_datahtml(content)
        else:
            return self._get_datahtml(appfile.content)
    
    def dump_strings(self, appfile):
        if appfile.ftype == ExtractStore.TYPE_MULTI:
            if appfile.filepath == None:
                return "<p>Unexpected Error: no filepath specified</p>"
            try:
                f = open(appfile.filepath, "rb")
                content = f.read()
            except:
                return """
                <p>File {} not found. Please make sure that you haven't
                unmounted any images regarding this case
                """.format(cgi.escape(appfile.filepath))
            return self._get_stringshtml( self.restringsdump(content))
        else:
            return self._get_stringshtml(self.restringsdump(appfile.content))
    
    def datahandler(self, value):
        return """
                <button class="btn btn-primary btn-sm" onclick="hideshow(this);">
                Show Data <span class="glyphicon glyphicon-chevron-down"></span>

                </button>