def rule(event):
    if all(
        [
            any(
                [
                    event.deep_get("Image", default="").endswith("\\regedit.exe"),
                    event.deep_get("OriginalFileName", default="") == "REGEDIT.EXE",
                ]
            ),
            any(
                [
                    " -E " in event.deep_get("CommandLine", default=""),
                    " /E " in event.deep_get("CommandLine", default=""),
                    " –E " in event.deep_get("CommandLine", default=""),
                    " —E " in event.deep_get("CommandLine", default=""),
                    " ―E " in event.deep_get("CommandLine", default=""),
                ]
            ),
            not all(
                [
                    any(
                        [
                            "hklm" in event.deep_get("CommandLine", default=""),
                            "hkey_local_machine" in event.deep_get("CommandLine", default=""),
                        ]
                    ),
                    any(
                        [
                            event.deep_get("CommandLine", default="").endswith("\\system"),
                            event.deep_get("CommandLine", default="").endswith("\\sam"),
                            event.deep_get("CommandLine", default="").endswith("\\security"),
                        ]
                    ),
                ]
            ),
        ]
    ):
        return True
    return False
