lib/core/jarm_calc.py
def read_packet(data: Union[bytes, None]):
    """
    If a packet is received, decipher the details
    :param data:
    :return:
    """
    try:
        if not data:
            return "|||"
        jarm = ""
        #Server hello error
        if data[0] == 21:
            selected_cipher = b""
            return "|||"
        #Check for server hello
        elif (data[0] == 22) and (data[5] == 2):
            counter = data[43]
            #Find server's selected cipher
            selected_cipher = data[counter+44:counter+46]
            #Find server's selected version
            version = data[9:11]
            #Format
            jarm += str(selected_cipher.hex())
            jarm += "|"
            jarm += str(version.hex())
            jarm += "|"
            #Extract extensions
            extensions = (extract_extension_info(data, counter))
            jarm += extensions
            return jarm
        else:
            return "|||"

    except Exception as e:
        return "|||"

    If a packet is received, decipher the details
    :param data:
    :return:
    
If a packet is received, decipher the details
If a packet is received decipher the details
def read_packet(data: Union[bytes, None]):
    try:
        if not data:
            return "|||"
        jarm = ""
        if data[0] == 21:
            selected_cipher = b""
            return "|||"
        elif (data[0] == 22) and (data[5] == 2):
            counter = data[43]
            selected_cipher = data[counter+44:counter+46]
            version = data[9:11]
            jarm += str(selected_cipher.hex())
            jarm += "|"
            jarm += str(version.hex())
            jarm += "|"
            extensions = (extract_extension_info(data, counter))
            jarm += extensions
            return jarm
        else:
            return "|||"
    except Exception as e:
        return "|||"
def read_packet ( data : Union [ bytes , None ] ) : try : if not data : return "|||" jarm = "" if data [ 0 ] == 21 : selected_cipher = b"" return "|||" elif ( data [ 0 ] == 22 ) and ( data [ 5 ] == 2 ) : counter = data [ 43 ] selected_cipher = data [ counter + 44 : counter + 46 ] version = data [ 9 : 11 ] jarm += str ( selected_cipher . hex ( ) ) jarm += "|" jarm += str ( version . hex ( ) ) jarm += "|" extensions = ( extract_extension_info ( data , counter ) ) jarm += extensions return jarm else : return "|||" except Exception as e : return "|||"
If a packet is received, decipher the details
If a packet is received decipher the details
"""
    If a packet is received, decipher the details
    :param data:
    :return:
    """ #Server hello error #Check for server hello #Find server's selected cipher #Find server's selected version #Format #Extract extensions
None
data
Union[bytes, None]
None