from typing import List
from typing import Dict
from typing import Any


def filter_shells(items: List[Dict[str, Any]], shells: List[str]) -> List[Dict[str, Any]]:
    """Returns only payloads which work when executed on specific underlying shells."""
    if not shells:
        return items

    filtered = []
    for item in items:
        has_shell = False
        for shell in shells:
            if "revshell" in item and shell in item["revshell"]["shell"]:
                has_shell = True
            if "bindshell" in item and shell in item["bindshell"]["shell"]:
                has_shell = True
        if has_shell:
            filtered.append(item)
    return filtered