def _get_NTLMv2_temp(timestamp, client_challenge, target_info):
        """
        [MS-NLMP] v28.0 2016-07-14

        2.2.2.7 NTLMv2_CLIENT_CHALLENGE - variable length
        The NTLMv2_CLIENT_CHALLENGE structure defines the client challenge in
        the AUTHENTICATE_MESSAGE. This structure is used only when NTLM v2
        authentication is configured and is transported in the NTLMv2_RESPONSE
        structure.

        The method to create this structure is defined in 3.3.2 NTLMv2
        Authentication. In this method this variable is known as the temp
        value. The target_info variable corresponds to the ServerName variable
        used in that documentation. This is in reality a lot more than just the
        ServerName and contains the AV_PAIRS structure we need to transport
        with the message like Channel Binding tokens and others. By default
        this will be the target_info returned from the CHALLENGE_MESSAGE plus
        MSV_AV_CHANNEL_BINDINGS if specified otherwise it is a new target_info
        set with MSV_AV_TIMESTAMP to the current time.

        :param timestamp: An 8-byte timestamp in windows format, 100
            nanoseconds since 1601-01-01
        :param client_challenge: A random 8-byte response generated by the
        `client for the AUTHENTICATE_MESSAGE
        :param target_info: The target_info structure from the
            CHALLENGE_MESSAGE with the CBT attached if required
        :return temp: The CLIENT_CHALLENGE structure that will be added to the
            NtChallengeResponse structure
        """
        resp_type = b'\x01'
        hi_resp_type = b'\x01'
        reserved1 = b'\x00' * 2
        reserved2 = b'\x00' * 4
        reserved3 = b'\x00' * 4
        # This byte is not in the structure defined in 2.2.2.7 but is in the
        # computation guide, works with it present
        reserved4 = b'\x00' * 4

        temp = resp_type
        temp += hi_resp_type
        temp += reserved1
        temp += reserved2
        temp += timestamp
        temp += client_challenge
        temp += reserved3
        temp += target_info.pack()
        temp += reserved4

        return temp
def _get_NTLMv2_temp ( timestamp , client_challenge , target_info ) : resp_type = b'\x01' hi_resp_type = b'\x01' reserved1 = b'\x00' * 2 reserved2 = b'\x00' * 4 reserved3 = b'\x00' * 4 reserved4 = b'\x00' * 4 temp = resp_type temp += hi_resp_type temp += reserved1 temp += reserved2 temp += timestamp temp += client_challenge temp += reserved3 temp += target_info . pack ( ) temp += reserved4 return temp
[MS-NLMP] v28.0 2016-07-14

        2.2.2.7 NTLMv2_CLIENT_CHALLENGE - variable length
        The NTLMv2_CLIENT_CHALLENGE structure defines the client challenge in
        the AUTHENTICATE_MESSAGE. This structure is used only when NTLM v2
        authentication is configured and is transported in the NTLMv2_RESPONSE
        structure.

        The method to create this structure is defined in 3.3.2 NTLMv2
        Authentication. In this method this variable is known as the temp
        value. The target_info variable corresponds to the ServerName variable
        used in that documentation. This is in reality a lot more than just the
        ServerName and contains the AV_PAIRS structure we need to transport
        with the message like Channel Binding tokens and others. By default
        this will be the target_info returned from the CHALLENGE_MESSAGE plus
        MSV_AV_CHANNEL_BINDINGS if specified otherwise it is a new target_info
        set with MSV_AV_TIMESTAMP to the current time.

        :param timestamp: An 8-byte timestamp in windows format, 100
            nanoseconds since 1601-01-01
        :param client_challenge: A random 8-byte response generated by the
        `client for the AUTHENTICATE_MESSAGE
        :param target_info: The target_info structure from the
            CHALLENGE_MESSAGE with the CBT attached if required
        :return temp: The CLIENT_CHALLENGE structure that will be added to the
            NtChallengeResponse structure