lib/core/templates.py
def create_error_template(record: dict,
                          error_str: str) -> dict:
    """
    Creates skeleton of error result dictionary
    """

    result = {'ip': record['ip'],
              'port': record['port'],
              'data': {'jarm': {'status': 'unknown-error',
                                'error': ''}}}
    if 'error' in record:
        if record['error']:
            result['data']['jarm']['error'] = record['error']
    if 'raw_jarm' in record:
        if record['raw_jarm']:
            result['data']['jarm']['raw_jarm'] = record['raw_jarm']
    if error_str:
        result['data']['jarm']['error'] = error_str
    if 'hostname' in record:
        if record['hostname']:
            result['hostname'] = record['hostname']
    for k in list(result.keys()):
        if not result[k]:
            result.pop(k)
    return result

    Creates skeleton of error result dictionary
    
Creates skeleton of error result dictionary
Creates skeleton of error result dictionary
def create_error_template(record: dict,
                          error_str: str) -> dict:
    result = {'ip': record['ip'],
              'port': record['port'],
              'data': {'jarm': {'status': 'unknown-error',
                                'error': ''}}}
    if 'error' in record:
        if record['error']:
            result['data']['jarm']['error'] = record['error']
    if 'raw_jarm' in record:
        if record['raw_jarm']:
            result['data']['jarm']['raw_jarm'] = record['raw_jarm']
    if error_str:
        result['data']['jarm']['error'] = error_str
    if 'hostname' in record:
        if record['hostname']:
            result['hostname'] = record['hostname']
    for k in list(result.keys()):
        if not result[k]:
            result.pop(k)
    return result
def create_error_template ( record : dict , error_str : str ) -> dict : result = { 'ip' : record [ 'ip' ] , 'port' : record [ 'port' ] , 'data' : { 'jarm' : { 'status' : 'unknown-error' , 'error' : '' } } } if 'error' in record : if record [ 'error' ] : result [ 'data' ] [ 'jarm' ] [ 'error' ] = record [ 'error' ] if 'raw_jarm' in record : if record [ 'raw_jarm' ] : result [ 'data' ] [ 'jarm' ] [ 'raw_jarm' ] = record [ 'raw_jarm' ] if error_str : result [ 'data' ] [ 'jarm' ] [ 'error' ] = error_str if 'hostname' in record : if record [ 'hostname' ] : result [ 'hostname' ] = record [ 'hostname' ] for k in list ( result . keys ( ) ) : if not result [ k ] : result . pop ( k ) return result
Creates skeleton of error result dictionary
Creates skeleton of error result dictionary
"""
    Creates skeleton of error result dictionary
    """
record
dict
error_str
str