import re


def rule(event):
    if all(
        [
            event.deep_get("Image", default="").endswith("/ls"),
            any(
                [
                    event.deep_get("CommandLine", default="").endswith(" /"),
                    " / " in event.deep_get("CommandLine", default=""),
                ]
            ),
            re.match(
                r"(?:\\s-[^-\\s]{0,20}i|\\s--inode\\s)", event.deep_get("CommandLine", default="")
            ),
            re.match(
                r"(?:\\s-[^-\\s]{0,20}d|\\s--directory\\s)",
                event.deep_get("CommandLine", default=""),
            ),
        ]
    ):
        return True
    return False
