in src/jndi_deobfuscate/jndi_deobfuscate.py [0:0]
def _transform_replace_obfuscated_variable(initial_string: str) -> str:
"""Given a JNDI string using features to obfuscate a static string, return a deobfuscated string by
replacing those features with the appropriate multiple character groups."""
accumulator = initial_string
lowered = initial_string.lower()
for key in VARIABLE_REPLACEMENT_DICT.keys():
special_string_lowered = VARIABLE_REPLACEMENT_DICT[key].lower()
while special_string_lowered in lowered:
special_string_index = lowered.find(special_string_lowered)
accumulator = (
f"{accumulator[:special_string_index]}"
f"{key}"
f"{accumulator[special_string_index+ len(special_string_lowered):]}"
)
lowered = accumulator.lower()
return accumulator