in extractors/remcos/remcos_configuration_extractor.py [0:0]
def unpack_mode(input: pathlib.Path, output: pathlib.Path) -> None:
"""
Unpacks the configuration from the input file and writes it to the output file.
:param input: The path to the input PE containing the configuration.
:param output: The path to the output file where the unpacked configuration will be written.
"""
if not (
encrypted_configuration := configuration.read_encrypted_configuration(input)
):
raise RuntimeError(f"Failed to load encrypted configuration from {input}")
key, raw_configuration = configuration.decrypt_encrypted_configuration(
encrypted_configuration
)
output.write_text(
json.dumps(
{
"configuration_encryption_key": base64.b64encode(key).decode("utf-8"),
"configuration": configuration.unpack_configuration(raw_configuration),
}
)
)