def main()

in tools/warmcookie/warmcookie_str_decrypt.py [0:0]


    def main():
        for func in WarmCookie.get_string_decrypt_funcs():
            for addr, key, encrypted_str in WarmCookie.get_encrypted_string(
                WarmCookie.get_xrefs(func)
            ):
                try:
                    decrypted_str = WarmCookie.decrypt_string(encrypted_str, key)
                    null_byte_count = decrypted_str.count(b"\x00")

                    try:
                        if null_byte_count > 1:
                            new_decrypted_str = decrypted_str.decode("utf-16")
                        else:
                            new_decrypted_str = decrypted_str.decode("utf-8")

                    except UnicodeDecodeError as e:
                        print(f"Decoding error at {hex(addr)}: {e}")
                        continue

                    print(hex(addr), new_decrypted_str)
                    WarmCookie.set_decompiler_comment(addr, new_decrypted_str)
                except TypeError:
                    print(f"Failed to decrypt string at: {hex(addr)}")