__init__.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:iampoliciesgonewild 作者: monkeysecurity 项目源码 文件源码
def _expand_wildcard_action(action):
    """
    :param action: 'autoscaling:*'
    :return: A list of all autoscaling permissions matching the wildcard
    """
    if isinstance(action, list):
        expanded_actions = []
        for item in action:
            expanded_actions.extend(_expand_wildcard_action(item))
        return expanded_actions

    else:
        if '*' in action:
            expanded = [
                expanded_action.lower() for expanded_action in all_permissions if fnmatch.fnmatchcase(
                    expanded_action.lower(), action.lower()
                )
            ]

            # if we get a wildcard for a tech we've never heard of, just return the wildcard
            if not expanded:
                return [action.lower()]

            return expanded
        return [action.lower()]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号