tcpdump.py 文件源码

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

项目:stepler 作者: Mirantis 项目源码 文件源码
def get_last_ping_reply_ts(path):
    """Returns last ICMP echo response timestamp.

    If there are no replies in packets - it returns None.

    Args:
        packets (list): list packets

    Returns:
        float|None: last ICMP reply timestamp or None
    """
    last_replied_ts = None
    for packet in read_pcap(path, lfilter=filter_icmp):
        if not filter_icmp(packet):
            continue
        if packet[scapy.ICMP].type == TYPE_ICMP_REPLY:
            last_replied_ts = max(last_replied_ts, packet.time)
    return last_replied_ts
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号