def _transform_replace_default_values_from_unresolved_variables()

in src/jndi_deobfuscate/jndi_deobfuscate.py [0:0]


def _transform_replace_default_values_from_unresolved_variables(input_string: str) -> str:
    # TODO: when you implement order-of-operations, only do this AFTER multi-letter string replacement.
    # (the other variables may cause this to test positive.)
    """Given a JNDI string, that contains a JNDI/Java feature known as `unresolved variables with default values` (UVWDV), this method will attempt
    to deobfuscate the string by replacing all of those UVWDV with the intended default values.
    """
    output_string = input_string
    if _does_string_have_unresolved_variables_with_default_values(output_string):
        (
            full_variable,
            default_value,
        ) = _transform_extract_default_values_from_unresolved_variables(output_string)
        if full_variable and default_value:
            output_string = input_string.replace(full_variable, default_value)
    return output_string