def rule(event):
    if all(
        [
            any(
                [
                    any(
                        [
                            event.deep_get("Image", default="").endswith("\\powershell.exe"),
                            event.deep_get("Image", default="").endswith("\\pwsh.exe"),
                            event.deep_get("Image", default="").endswith("\\powershell_ise.exe"),
                        ]
                    ),
                    event.deep_get("OriginalFileName", default="")
                    in ["PowerShell.EXE", "pwsh.dll"],
                ]
            ),
            "New-NetFirewallRule " in event.deep_get("CommandLine", default=""),
            " -Action " in event.deep_get("CommandLine", default=""),
            "allow" in event.deep_get("CommandLine", default=""),
        ]
    ):
        return True
    return False
