# Path: mobsf/MobSF/utils.py
# def disable_print():
#     sys.stdout = open(os.devnull, 'w')
# 
# def enable_print():
#     sys.stdout = sys.__stdout__


import logging
        import quark
from pathlib import Path
from django.conf import settings
from mobsf.MobSF.utils import (
    disable_print,
    enable_print,
)
    from quark import config
    from quark.freshquark import download
    from quark.report import Report
# -*- coding: utf_8 -*-



logger = logging.getLogger(__name__)


def quark_analysis(app_dir, apk_file):
    """QUARK Analysis of APK files."""
    if not getattr(settings, 'QUARK_ENABLED', True):
        return []
    try:
    except ImportError:
        logger.error('Failed to import Quark')
        return []
    if not Path(apk_file).exists():
        logger.error('APK not found')
        return []

    quark_ver = quark.__version__


    logger.info('Running Quark %s', quark_ver)
    json_report = {}
    try:
        # freshquark: update quark rules

# Path: mobsf/MobSF/utils.py
# def disable_print():
#     sys.stdout = open(os.devnull, 'w')
# 
# def enable_print():
#     sys.stdout = sys.__stdout__


# Path: mobsf/MalwareAnalyzer/views/quark.py
import logging
        import quark
from pathlib import Path
from django.conf import settings
from mobsf.MobSF.utils import (
    disable_print,
    enable_print,
)
    from quark import config
    from quark.freshquark import download
    from quark.report import Report

# -*- coding: utf_8 -*-



logger = logging.getLogger(__name__)


def quark_analysis(app_dir, apk_file):
    """QUARK Analysis of APK files."""
    if not getattr(settings, 'QUARK_ENABLED', True):
        return []
    try:
    except ImportError:
        logger.error('Failed to import Quark')
        return []
    if not Path(apk_file).exists():
        logger.error('APK not found')
        return []

    quark_ver = quark.__version__


    logger.info('Running Quark %s', quark_ver)
    json_report = {}
    try:
        # freshquark: update quark rules

        disable_print()