import re


def rule(event):
    if all(
        [
            event.deep_get("Image", default="").endswith("\\svchost.exe"),
            not any(
                [
                    re.match(
                        r"-k\\s\\w{1,64}(?:\\s?(?:-p|-s))?",
                        event.deep_get("CommandLine", default=""),
                    ),
                    event.deep_get("CommandLine", default="") == "",
                    event.deep_get("CommandLine", default="") == "",
                ]
            ),
            not any(
                [
                    all(
                        [
                            event.deep_get("ParentImage", default="").endswith("\\MsMpEng.exe"),
                            "svchost.exe" in event.deep_get("CommandLine", default=""),
                        ]
                    ),
                    all(
                        [
                            event.deep_get("ParentImage", default="").endswith("\\MRT.exe"),
                            event.deep_get("CommandLine", default="") == "svchost.exe",
                        ]
                    ),
                ]
            ),
        ]
    ):
        return True
    return False
