def rule(event):
    if all(
        [
            any(
                [
                    event.deep_get("Image", default="").endswith("\\powershell.exe"),
                    event.deep_get("Image", default="").endswith("\\pwsh.exe"),
                ]
            ),
            any(
                [
                    "-f C:\\Users\\Public" in event.deep_get("CommandLine", default=""),
                    '-f "C:\\Users\\Public' in event.deep_get("CommandLine", default=""),
                    "-f %Public%" in event.deep_get("CommandLine", default=""),
                    "-fi C:\\Users\\Public" in event.deep_get("CommandLine", default=""),
                    '-fi "C:\\Users\\Public' in event.deep_get("CommandLine", default=""),
                    "-fi %Public%" in event.deep_get("CommandLine", default=""),
                    "-fil C:\\Users\\Public" in event.deep_get("CommandLine", default=""),
                    '-fil "C:\\Users\\Public' in event.deep_get("CommandLine", default=""),
                    "-fil %Public%" in event.deep_get("CommandLine", default=""),
                    "-file C:\\Users\\Public" in event.deep_get("CommandLine", default=""),
                    '-file "C:\\Users\\Public' in event.deep_get("CommandLine", default=""),
                    "-file %Public%" in event.deep_get("CommandLine", default=""),
                ]
            ),
        ]
    ):
        return True
    return False
