snmpsimd.py 文件源码

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

项目:snmpsim 作者: etingof 项目源码 文件源码
def probeContext(transportDomain, transportAddress, contextName):
    candidate = [
        contextName, '.'.join([str(x) for x in transportDomain])
    ]
    if transportDomain[:len(udp.domainName)] == udp.domainName:
        candidate.append(transportAddress[0])
    elif udp6 and transportDomain[:len(udp6.domainName)] == udp6.domainName:
        candidate.append(
            str(transportAddress[0]).replace(':', '_')
        )
    elif unix and transportDomain[:len(unix.domainName)] == unix.domainName:
        candidate.append(transportAddress)

    candidate = [str(x) for x in candidate if x]

    while candidate:
        yield rfc1902.OctetString(os.path.normpath(os.path.sep.join(candidate)).replace(os.path.sep, '/')).asOctets()
        del candidate[-1]

# main script body starts here
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号