# Buggy code
def unzip(app_path, ext_path):
    logger.info("Unzipping")
    try:
        files = []
        with zipfile.ZipFile(app_path, "r") as zipptr:
            for fileinfo in zipptr.infolist():
                filename = fileinfo.filename
                if not isinstance(filename, str):
                    filename = str(filename, encoding="utf-8", errors="replace")
                files.append(filename)
                zipptr.extract(filename, ext_path)
        return files
    except:
        PrintException("[ERROR] Unzipping Error")
        if platform.system() == "Windows":
            logger.info("Not yet Implemented.")
        else:
            logger.info("Using the Default OS Unzip Utility.")
            try:
                subprocess.call(
                    ["unzip", "-o", "-I utf-8", "-q", app_path, "-d", ext_path]
                )
                dat = subprocess.check_output(["unzip", "-qq", "-l", app_path])
                dat = dat.decode("utf-8").split("\n")
                files_det = ["Length   Date   Time   Name"]
                files_det = files_det + dat
                return files_det
            except:
                PrintException("[ERROR] Unzipping Error")


# 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 unzip(app_path, ext_path):
    logger.info("Unzipping")
    try:
        files = []
        with zipfile.ZipFile(app_path, "r") as zipptr:
            for fileinfo in zipptr.infolist():
                filename = fileinfo.filename
                if not isinstance(filename, str):
                    filename = str(filename, encoding="utf-8", errors="replace")
                files.append(filename)
                zipptr.extract(filename, ext_path)
        return files
    except:
        PrintException("Unzipping Error")
        if platform.system() == "Windows":
            logger.info("Not yet Implemented.")
        else:
            logger.info("Using the Default OS Unzip Utility.")
            try:
                subprocess.call(
                    ["unzip", "-o", "-I utf-8", "-q", app_path, "-d", ext_path]
                )
                dat = subprocess.check_output(["unzip", "-qq", "-l", app_path])
                dat = dat.decode("utf-8").split("\n")
                files_det = ["Length   Date   Time   Name"]
                files_det = files_det + dat
                return files_det
            except:
                PrintException("Unzipping Error")