lib/core/jarm_calc.py
def extract_extension_info(data: bytes, counter):
    """
    Deciphering the extensions in the server hello
    :param data:
    :param counter:
    :return:
    """
    try:
        #Error handling
        if (data[counter+47] == 11):
            return "|||"
        elif (data[counter+50:counter+53] == b"\x0e\xac\x0b") or (data[82:85] == b"\x0f\xf0\x0b"):
            return "|||"
        count = 49+counter
        length = int.from_bytes(data[counter+47:counter+49], byteorder='big')
        maximum = length+(count-1)
        types = []
        values = []
        #Collect all extension types and values for later reference
        while count < maximum:
            types.append(data[count:count+2])
            ext_length = int.from_bytes(data[count+2:count+4], byteorder='big')
            if ext_length == 0:
                count += 4
                values.append("")
            else:
                values.append(data[count+4:count+4+ext_length])
                count += ext_length+4
        result = ""
        #Read application_layer_protocol_negotiation
        alpn = find_extension(b"\x00\x10", types, values)
        result += str(alpn)
        result += "|"
        #Add formating hyphens
        add_hyphen = 0
        while add_hyphen < len(types):
            result += types[add_hyphen].hex()
            add_hyphen += 1
            if add_hyphen == len(types):
                break
            else:
                result += "-"
        return result
    #Error handling
    except IndexError as e:
        result = "|||"
        return result

    Deciphering the extensions in the server hello
    :param data:
    :param counter:
    :return:
    
Deciphering the extensions in the server hello
Deciphering the extensions in the server hello
def extract_extension_info(data: bytes, counter):
    try:
        if (data[counter+47] == 11):
            return "|||"
        elif (data[counter+50:counter+53] == b"\x0e\xac\x0b") or (data[82:85] == b"\x0f\xf0\x0b"):
            return "|||"
        count = 49+counter
        length = int.from_bytes(data[counter+47:counter+49], byteorder='big')
        maximum = length+(count-1)
        types = []
        values = []
        while count < maximum:
            types.append(data[count:count+2])
            ext_length = int.from_bytes(data[count+2:count+4], byteorder='big')
            if ext_length == 0:
                count += 4
                values.append("")
            else:
                values.append(data[count+4:count+4+ext_length])
                count += ext_length+4
        result = ""
        alpn = find_extension(b"\x00\x10", types, values)
        result += str(alpn)
        result += "|"
        add_hyphen = 0
        while add_hyphen < len(types):
            result += types[add_hyphen].hex()
            add_hyphen += 1
            if add_hyphen == len(types):
                break
            else:
                result += "-"
        return result
    except IndexError as e:
        result = "|||"
        return result
def extract_extension_info ( data : bytes , counter ) : try : if ( data [ counter + 47 ] == 11 ) : return "|||" elif ( data [ counter + 50 : counter + 53 ] == b"\x0e\xac\x0b" ) or ( data [ 82 : 85 ] == b"\x0f\xf0\x0b" ) : return "|||" count = 49 + counter length = int . from_bytes ( data [ counter + 47 : counter + 49 ] , byteorder = 'big' ) maximum = length + ( count - 1 ) types = [ ] values = [ ] while count < maximum : types . append ( data [ count : count + 2 ] ) ext_length = int . from_bytes ( data [ count + 2 : count + 4 ] , byteorder = 'big' ) if ext_length == 0 : count += 4 values . append ( "" ) else : values . append ( data [ count + 4 : count + 4 + ext_length ] ) count += ext_length + 4 result = "" alpn = find_extension ( b"\x00\x10" , types , values ) result += str ( alpn ) result += "|" add_hyphen = 0 while add_hyphen < len ( types ) : result += types [ add_hyphen ] . hex ( ) add_hyphen += 1 if add_hyphen == len ( types ) : break else : result += "-" return result except IndexError as e : result = "|||" return result
Deciphering the extensions in the server hello
Deciphering the extensions in the server hello
"""
    Deciphering the extensions in the server hello
    :param data:
    :param counter:
    :return:
    """ #Error handling #Collect all extension types and values for later reference #Read application_layer_protocol_negotiation #Add formating hyphens #Error handling
None
data
bytes
None
counter
None