def rule(event):
    if all(
        [
            event.deep_get("EventID", default="") == 4648,
            any(
                [
                    event.deep_get("ProcessName", default="").endswith("\\cmd.exe"),
                    event.deep_get("ProcessName", default="").endswith("\\powershell.exe"),
                    event.deep_get("ProcessName", default="").endswith("\\pwsh.exe"),
                    event.deep_get("ProcessName", default="").endswith("\\winrs.exe"),
                    event.deep_get("ProcessName", default="").endswith("\\wmic.exe"),
                    event.deep_get("ProcessName", default="").endswith("\\net.exe"),
                    event.deep_get("ProcessName", default="").endswith("\\net1.exe"),
                    event.deep_get("ProcessName", default="").endswith("\\reg.exe"),
                ]
            ),
            not any(
                [
                    event.deep_get("TargetServerName", default="") == "localhost",
                    all(
                        [
                            event.deep_get("SubjectUserName", default="").endswith("$"),
                            event.deep_get("TargetUserName", default="").endswith("$"),
                        ]
                    ),
                ]
            ),
        ]
    ):
        return True
    return False
