def rule(event):
    if all(
        [
            event.deep_get("Image", default="").endswith("/perl"),
            " -e " in event.deep_get("CommandLine", default=""),
            any(
                [
                    all(
                        [
                            "fdopen(" in event.deep_get("CommandLine", default=""),
                            "::Socket::INET" in event.deep_get("CommandLine", default=""),
                        ]
                    ),
                    all(
                        [
                            "Socket" in event.deep_get("CommandLine", default=""),
                            "connect" in event.deep_get("CommandLine", default=""),
                            "open" in event.deep_get("CommandLine", default=""),
                            "exec" in event.deep_get("CommandLine", default=""),
                        ]
                    ),
                ]
            ),
        ]
    ):
        return True
    return False
