def rule(event):
    if all(
        [
            event.deep_get("TargetFilename", default="").endswith("\\ntds.dit"),
            any(
                [
                    any(
                        [
                            event.deep_get("Image", default="").endswith("\\cmd.exe"),
                            event.deep_get("Image", default="").endswith("\\cscript.exe"),
                            event.deep_get("Image", default="").endswith("\\mshta.exe"),
                            event.deep_get("Image", default="").endswith("\\powershell.exe"),
                            event.deep_get("Image", default="").endswith("\\pwsh.exe"),
                            event.deep_get("Image", default="").endswith("\\regsvr32.exe"),
                            event.deep_get("Image", default="").endswith("\\rundll32.exe"),
                            event.deep_get("Image", default="").endswith("\\wscript.exe"),
                            event.deep_get("Image", default="").endswith("\\wsl.exe"),
                            event.deep_get("Image", default="").endswith("\\wt.exe"),
                        ]
                    ),
                    any(
                        [
                            "\\AppData\\" in event.deep_get("Image", default=""),
                            "\\Temp\\" in event.deep_get("Image", default=""),
                            "\\Public\\" in event.deep_get("Image", default=""),
                            "\\PerfLogs\\" in event.deep_get("Image", default=""),
                        ]
                    ),
                ]
            ),
        ]
    ):
        return True
    return False
