# Buggy code
def update_db_entry_ipa(app_dict, info_dict, bin_dict, files, sfiles):
    """Update an IPA DB entry"""
    try:
        # pylint: disable=E1101
        StaticAnalyzerIPA.objects.filter(MD5=app_dict["md5_hash"]).update(
            TITLE="Static Analysis",
            FILE_NAME=app_dict["file_name"],
            SIZE=app_dict["size"],
            MD5=app_dict["md5_hash"],
            SHA1=app_dict["sha1"],
            SHA256=app_dict["sha256"],
            INFOPLIST=info_dict["plist_xml"],
            BINNAME=info_dict["bin_name"],
            IDF=info_dict["id"],
            BUILD=info_dict["build"],
            VERSION=info_dict["bundle_version_name"],
            SDK=info_dict["sdk"],
            PLTFM=info_dict["pltfm"],
            MINX=info_dict["min"],
            BIN_ANAL=bin_dict["bin_res"],
            LIBS=bin_dict["libs"],
            FILES=files,
            SFILESX=sfiles,
            STRINGS=bin_dict["strings"],
            PERMISSIONS=info_dict["permissions"],
            INSECCON=info_dict["inseccon"],
            BUNDLE_NAME=info_dict["bundle_name"],
            BUNDLE_URL_TYPES=info_dict["bundle_url_types"],
            BUNDLE_SUPPORTED_PLATFORMS=info_dict["bundle_supported_platforms"],
            BUNDLE_LOCALIZATIONS=info_dict["bundle_localizations"],
        )

    except:
        PrintException("[ERROR] Updating DB")


# Traceback (KeyError)
[INFO] 08/Feb/2019 16:17:54 - VM Starting
[INFO] 08/Feb/2019 16:17:55 - "POST /DynamicAnalyzer/ HTTP/1.1" 200 32400
[INFO] 08/Feb/2019 16:17:55 - "GET /static/css/devices.min.css HTTP/1.1" 200 44241
[INFO] 08/Feb/2019 16:17:55 - "GET /download/screen/screen.png HTTP/1.1" 302 0
[DEBUG] 08/Feb/2019 16:17:55 - Exception while resolving variable 'exp' in template 'general/error.html'.
Traceback (most recent call last):
File "/home/userhome/Mobile-Security-Framework-MobSF/venv/lib/python3.6/site-packages/django/template/base.py", line 829, in _resolve_lookup
current = current[bit]
File "/home/userhome/Mobile-Security-Framework-MobSF/venv/lib/python3.6/site-packages/django/template/context.py", line 83, in __getitem__
raise KeyError(key)
KeyError: 'exp'

During handling of the above exception, another exception occurred:

# Fixed code
def update_db_entry_ipa(app_dict, info_dict, bin_dict, files, sfiles):
    """Update an IPA DB entry"""
    try:
        # pylint: disable=E1101
        StaticAnalyzerIPA.objects.filter(MD5=app_dict["md5_hash"]).update(
            TITLE="Static Analysis",
            FILE_NAME=app_dict["file_name"],
            SIZE=app_dict["size"],
            MD5=app_dict["md5_hash"],
            SHA1=app_dict["sha1"],
            SHA256=app_dict["sha256"],
            INFOPLIST=info_dict["plist_xml"],
            BINNAME=info_dict["bin_name"],
            IDF=info_dict["id"],
            BUILD=info_dict["build"],
            VERSION=info_dict["bundle_version_name"],
            SDK=info_dict["sdk"],
            PLTFM=info_dict["pltfm"],
            MINX=info_dict["min"],
            BIN_ANAL=bin_dict["bin_res"],
            LIBS=bin_dict["libs"],
            FILES=files,
            SFILESX=sfiles,
            STRINGS=bin_dict["strings"],
            PERMISSIONS=info_dict["permissions"],
            INSECCON=info_dict["inseccon"],
            BUNDLE_NAME=info_dict["bundle_name"],
            BUNDLE_URL_TYPES=info_dict["bundle_url_types"],
            BUNDLE_SUPPORTED_PLATFORMS=info_dict["bundle_supported_platforms"],
            BUNDLE_LOCALIZATIONS=info_dict["bundle_localizations"],
        )

    except:
        PrintException("Updating DB")