# Path: mobsf/MobSF/utils.py
# def python_dict(value):
#     if not value:
#         value = {}
#     if isinstance(value, dict):
#         return value
#     return ast.literal_eval(value)
# 
# def python_list(value):
#     if not value:
#         value = []
#     if isinstance(value, list):
#         return value
#     return ast.literal_eval(value)
# 
# Path: mobsf/StaticAnalyzer/models.py
# class StaticAnalyzerIOS(models.Model):
#     FILE_NAME = models.CharField(max_length=255, default='')
#     APP_NAME = models.CharField(max_length=255, default='')
#     APP_TYPE = models.CharField(max_length=20, default='')
#     SIZE = models.CharField(max_length=50, default='')
#     MD5 = models.CharField(max_length=32, default='', primary_key=True)
#     SHA1 = models.CharField(max_length=40, default='')
#     SHA256 = models.CharField(max_length=64, default='')
#     BUILD = models.TextField(default='')
#     APP_VERSION = models.CharField(max_length=100, default='')
#     SDK_NAME = models.CharField(max_length=50, default='')
#     PLATFORM = models.CharField(max_length=50, default='')
#     MIN_OS_VERSION = models.CharField(max_length=50, default='')
#     BUNDLE_ID = models.TextField(default='')
#     BUNDLE_URL_TYPES = models.TextField(default=[])
#     BUNDLE_SUPPORTED_PLATFORMS = models.CharField(max_length=50, default=[])
#     ICON_FOUND = models.BooleanField(default=False)
#     INFO_PLIST = models.TextField(default='')
#     BINARY_INFO = models.TextField(default={})
#     PERMISSIONS = models.TextField(default={})
#     ATS_ANALYSIS = models.TextField(default=[])
#     BINARY_ANALYSIS = models.TextField(default=[])
#     MACHO_ANALYSIS = models.TextField(default={})
#     IOS_API = models.TextField(default={})
#     CODE_ANALYSIS = models.TextField(default={})
#     FILE_ANALYSIS = models.TextField(default=[])
#     LIBRARIES = models.TextField(default=[])
#     FILES = models.TextField(default=[])
#     URLS = models.TextField(default=[])
#     DOMAINS = models.TextField(default={})
#     EMAILS = models.TextField(default=[])
#     STRINGS = models.TextField(default=[])
#     FIREBASE_URLS = models.TextField(default=[])
#     APPSTORE_DETAILS = models.TextField(default={})
#     SECRETS = models.TextField(default=[])
#     TRACKERS = models.TextField(default={})
# 
# Path: mobsf/StaticAnalyzer/models.py
# class RecentScansDB(models.Model):
#     ANALYZER = models.CharField(max_length=50, default='')
#     SCAN_TYPE = models.CharField(max_length=10, default='')
#     FILE_NAME = models.CharField(max_length=260, default='')
#     APP_NAME = models.CharField(max_length=260, default='')
#     PACKAGE_NAME = models.CharField(max_length=260, default='')
#     VERSION_NAME = models.CharField(max_length=50, default='')
#     MD5 = models.CharField(max_length=32, default='', primary_key=True)
#     TIMESTAMP = models.DateTimeField(default=datetime.now)


import logging
from django.conf import settings
from mobsf.MobSF.utils import python_dict, python_list
from mobsf.StaticAnalyzer.models import StaticAnalyzerIOS
from mobsf.StaticAnalyzer.models import RecentScansDB
            'MIN_OS_VERSION': info_dict['min'],
            'BUNDLE_ID': info_dict['id'],
            'BUNDLE_URL_TYPES': info_dict['bundle_url_types'],
            'BUNDLE_SUPPORTED_PLATFORMS':
                info_dict['bundle_supported_platforms'],
            'ICON_FOUND': app_dict['icon_found'],
            'INFO_PLIST': info_dict['plist_xml'],
            'BINARY_INFO': bin_dict['bin_info'],
            'PERMISSIONS': info_dict['permissions'],
            'ATS_ANALYSIS': info_dict['inseccon'],
            'BINARY_ANALYSIS': bin_dict['bin_code_analysis'],
            'MACHO_ANALYSIS': bin_dict['checksec'],
            'IOS_API': code_dict['api'],
            'CODE_ANALYSIS': code_dict['code_anal'],
            'FILE_ANALYSIS': all_files['special_files'],
            'LIBRARIES': bin_dict['libraries'],
            'FILES': all_files['files_short'],
            'URLS': code_dict['urlnfile'],
            'DOMAINS': code_dict['domains'],
            'EMAILS': code_dict['emailnfile'],
            'STRINGS': bin_dict['strings'],
            'FIREBASE_URLS': code_dict['firebase'],
            'APPSTORE_DETAILS': app_dict['appstore'],
            'SECRETS': app_dict['secrets'],
            'TRACKERS': code_dict['trackers'],
        }
        if update_type == 'save':
            db_entry = StaticAnalyzerIOS.objects.filter(
                MD5=app_dict['md5_hash'])
            if not db_entry.exists():

# Path: mobsf/MobSF/utils.py
# def python_dict(value):
#     if not value:
#         value = {}
#     if isinstance(value, dict):
#         return value
#     return ast.literal_eval(value)
# 
# def python_list(value):
#     if not value:
#         value = []
#     if isinstance(value, list):
#         return value
#     return ast.literal_eval(value)
# 
# Path: mobsf/StaticAnalyzer/models.py
# class StaticAnalyzerIOS(models.Model):
#     FILE_NAME = models.CharField(max_length=255, default='')
#     APP_NAME = models.CharField(max_length=255, default='')
#     APP_TYPE = models.CharField(max_length=20, default='')
#     SIZE = models.CharField(max_length=50, default='')
#     MD5 = models.CharField(max_length=32, default='', primary_key=True)
#     SHA1 = models.CharField(max_length=40, default='')
#     SHA256 = models.CharField(max_length=64, default='')
#     BUILD = models.TextField(default='')
#     APP_VERSION = models.CharField(max_length=100, default='')
#     SDK_NAME = models.CharField(max_length=50, default='')
#     PLATFORM = models.CharField(max_length=50, default='')
#     MIN_OS_VERSION = models.CharField(max_length=50, default='')
#     BUNDLE_ID = models.TextField(default='')
#     BUNDLE_URL_TYPES = models.TextField(default=[])
#     BUNDLE_SUPPORTED_PLATFORMS = models.CharField(max_length=50, default=[])
#     ICON_FOUND = models.BooleanField(default=False)
#     INFO_PLIST = models.TextField(default='')
#     BINARY_INFO = models.TextField(default={})
#     PERMISSIONS = models.TextField(default={})
#     ATS_ANALYSIS = models.TextField(default=[])
#     BINARY_ANALYSIS = models.TextField(default=[])
#     MACHO_ANALYSIS = models.TextField(default={})
#     IOS_API = models.TextField(default={})
#     CODE_ANALYSIS = models.TextField(default={})
#     FILE_ANALYSIS = models.TextField(default=[])
#     LIBRARIES = models.TextField(default=[])
#     FILES = models.TextField(default=[])
#     URLS = models.TextField(default=[])
#     DOMAINS = models.TextField(default={})
#     EMAILS = models.TextField(default=[])
#     STRINGS = models.TextField(default=[])
#     FIREBASE_URLS = models.TextField(default=[])
#     APPSTORE_DETAILS = models.TextField(default={})
#     SECRETS = models.TextField(default=[])
#     TRACKERS = models.TextField(default={})
# 
# Path: mobsf/StaticAnalyzer/models.py
# class RecentScansDB(models.Model):
#     ANALYZER = models.CharField(max_length=50, default='')
#     SCAN_TYPE = models.CharField(max_length=10, default='')
#     FILE_NAME = models.CharField(max_length=260, default='')
#     APP_NAME = models.CharField(max_length=260, default='')
#     PACKAGE_NAME = models.CharField(max_length=260, default='')
#     VERSION_NAME = models.CharField(max_length=50, default='')
#     MD5 = models.CharField(max_length=32, default='', primary_key=True)
#     TIMESTAMP = models.DateTimeField(default=datetime.now)


# Path: mobsf/StaticAnalyzer/views/ios/db_interaction.py
import logging
from django.conf import settings
from mobsf.MobSF.utils import python_dict, python_list
from mobsf.StaticAnalyzer.models import StaticAnalyzerIOS
from mobsf.StaticAnalyzer.models import RecentScansDB

            'MIN_OS_VERSION': info_dict['min'],
            'BUNDLE_ID': info_dict['id'],
            'BUNDLE_URL_TYPES': info_dict['bundle_url_types'],
            'BUNDLE_SUPPORTED_PLATFORMS':
                info_dict['bundle_supported_platforms'],
            'ICON_FOUND': app_dict['icon_found'],
            'INFO_PLIST': info_dict['plist_xml'],
            'BINARY_INFO': bin_dict['bin_info'],
            'PERMISSIONS': info_dict['permissions'],
            'ATS_ANALYSIS': info_dict['inseccon'],
            'BINARY_ANALYSIS': bin_dict['bin_code_analysis'],
            'MACHO_ANALYSIS': bin_dict['checksec'],
            'IOS_API': code_dict['api'],
            'CODE_ANALYSIS': code_dict['code_anal'],
            'FILE_ANALYSIS': all_files['special_files'],
            'LIBRARIES': bin_dict['libraries'],
            'FILES': all_files['files_short'],
            'URLS': code_dict['urlnfile'],
            'DOMAINS': code_dict['domains'],
            'EMAILS': code_dict['emailnfile'],
            'STRINGS': bin_dict['strings'],
            'FIREBASE_URLS': code_dict['firebase'],
            'APPSTORE_DETAILS': app_dict['appstore'],
            'SECRETS': app_dict['secrets'],
            'TRACKERS': code_dict['trackers'],
        }
        if update_type == 'save':
            db_entry = StaticAnalyzerIOS.objects.filter(
                MD5=app_dict['md5_hash'])
            if not db_entry.exists():

                StaticAnalyzerIOS.objects.create(**values)