arnold.py 文件源码

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

项目:nav 作者: UNINETT 项目源码 文件源码
def check_non_block(ip):
    """Checks if the ip is in the nonblocklist."""
    nonblockdict = parse_nonblock_file(NONBLOCKFILE)

    # We have the result of the nonblock.cfg-file in the dict
    # nonblockdict. This dict contains 3 things:
    # 1 - Specific ip-addresses
    # 2 - Ip-ranges (129.241.xxx.xxx/xx)
    # 3 - Ip lists (129.241.xxx.xxx-xxx)

    # Specific ip-addresses
    if ip in nonblockdict['ip']:
        LOGGER.info('Computer in nonblock list, skipping')
        raise InExceptionListError

    # Ip-ranges
    for ip_range in nonblockdict['range']:
        if ip in IP(ip_range):
            raise InExceptionListError
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号