utils.py 文件源码

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

项目:PiBunny 作者: tholum 项目源码 文件源码
def FindLocalIP(Iface, OURIP):
    if Iface == 'ALL':
        return '0.0.0.0'

    try:
        if IsOsX():
            return OURIP
        elif OURIP == None:
            s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
            s.setsockopt(socket.SOL_SOCKET, 25, Iface+'\0')
            s.connect(("127.0.0.1",9))#RFC 863
            ret = s.getsockname()[0]
            s.close()
            return ret
        return OURIP
    except socket.error:
        print color("[!] Error: %s: Interface not found" % Iface, 1)
        sys.exit(-1)

# Function used to write captured hashs to a file.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号