def rule(event):
    if all(
        [
            "base64 " in event.deep_get("CommandLine", default=""),
            any(
                [
                    any(
                        [
                            "| bash " in event.deep_get("CommandLine", default=""),
                            "| sh " in event.deep_get("CommandLine", default=""),
                            "|bash " in event.deep_get("CommandLine", default=""),
                            "|sh " in event.deep_get("CommandLine", default=""),
                        ]
                    ),
                    any(
                        [
                            event.deep_get("CommandLine", default="").endswith(" |sh"),
                            event.deep_get("CommandLine", default="").endswith("| bash"),
                            event.deep_get("CommandLine", default="").endswith("| sh"),
                            event.deep_get("CommandLine", default="").endswith("|bash"),
                        ]
                    ),
                ]
            ),
        ]
    ):
        return True
    return False
