def rule(event):
    if all(
        [
            "Set-ExecutionPolicy" in event.deep_get("ScriptBlockText", default=""),
            any(
                [
                    "Unrestricted" in event.deep_get("ScriptBlockText", default=""),
                    "bypass" in event.deep_get("ScriptBlockText", default=""),
                ]
            ),
            not any(
                [
                    "(New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')"
                    in event.deep_get("ScriptBlockText", default=""),
                    "(New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')"
                    in event.deep_get("ScriptBlockText", default=""),
                ]
            ),
        ]
    ):
        return True
    return False
