@cli.command('check-backup', help='Check an Android Backup')
@click.option('--serial', '-s', type=str, help=HELP_MSG_SERIAL)
@click.option('--iocs', '-i', type=click.Path(exists=True), multiple=True, default=[], help=HELP_MSG_IOC)
@click.option('--output', '-o', type=click.Path(exists=False), help=HELP_MSG_OUTPUT)
@click.argument('BACKUP_PATH', type=click.Path(exists=True))
@click.pass_context
def check_backup(ctx, iocs, output, backup_path, serial):
    log.info('Checking ADB backup located at: %s', backup_path)
    if (output and (not os.path.exists(output))):
        try:
            os.makedirs(output)
        except Exception as e:
            log.critical('Unable to create output folder %s: %s', output, e)
            ctx.exit(1)
    indicators = Indicators(log=log)
    indicators.load_indicators_files(iocs)
    if os.path.isfile(backup_path):
        log.critical('The path you specified is a not a folder!')
        if (os.path.basename(backup_path) == 'backup.ab'):
            log.info("You can use ABE (https://github.com/nelenkov/android-backup-extractor) to extract 'backup.ab' files!")
        ctx.exit(1)
    for module in BACKUP_MODULES:
        m = module(base_folder=backup_path, output_folder=output, log=logging.getLogger(module.__module__))
        if indicators.total_ioc_count:
            m.indicators = indicators
            m.indicators.log = m.log
        if serial:
            m.serial = serial
        run_module(m)
@cli.command('check-backup', help='Check an Android Backup')
@click.option('--serial', '-s', type=str, help=HELP_MSG_SERIAL)
@click.option('--iocs', '-i', type=click.Path(exists=True), multiple=True, default=[], help=HELP_MSG_IOC)
@click.option('--output', '-o', type=click.Path(exists=False), help=HELP_MSG_OUTPUT)
@click.argument('BACKUP_PATH', type=click.Path(exists=True))
@click.pass_context
def check_backup(ctx, iocs, output, backup_path, serial):
    log.info('Checking ADB backup located at: %s', backup_path)
    if (output and (not os.path.exists(output))):
        try:
            os.makedirs(output)
        except Exception as e:
            log.critical('Unable to create output folder %s: %s', output, e)
            ctx.exit(1)
    indicators = Indicators(log=log)
    indicators.load_indicators_files(iocs)
    if os.path.isfile(backup_path):
        log.critical('The path you specified is a not a folder!')
        if (os.path.basename(backup_path) == 'backup.ab'):
            log.info("You can use ABE (https://github.com/nelenkov/android-backup-extractor) to extract 'backup.ab' files!")
        ctx.exit(1)
    for module in BACKUP_MODULES:
        m = module(base_folder=backup_path, output_folder=output, log=logging.getLogger(module.__module__))
        if indicators.total_ioc_count:
            m.indicators = indicators
            m.indicators.log = m.log
        if serial:
            m.serial = serial
        run_module(m)