mock.py 文件源码

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

项目:voltha 作者: opencord 项目源码 文件源码
def run(self):
        # TODO this loop could be reconciled with the ofp Connection to become a
        # single select loop.
        self.sock = s = conf.L2listen(
            type=ETH_P_ALL,
            iface=self.iface,
            filter='inbound'
        )
        while not self.finished:
            try:
                sniffed = sniff(1, iface=self.iface, timeout=1, opened_socket=s)
                print 'Sniffer received %d packet(s)' % len(sniffed)
                for pkt in sniffed:
                    self.forward_packet(pkt)

            except Exception, e:
                logging.error("scapy.sniff error: %s" % e)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号