[Python] Is latency available within traceroute in scapy

Discussão em 'Python' iniciado por Stack, Fevereiro 20, 2025.

  1. Stack

    Stack Membro Participativo

    from scapy.all import traceroute

    def perform_traceroute(target):
    result, _ = traceroute(target, maxttl=50, verbose=True)
    print(result)

    for hop in result:
    query_packet = hop[0]
    answer_packet = hop[1]

    hop_number = query_packet.ttl
    hop_latency = answer_packet.time
    hop_ip = answer_packet.src
    print(answer_packet.show())


    targets = ["101.191.135.146"] #, "131.100.187.189", "100.42.240.1"


    perform_traceroute(targets)


    The time value I'm getting out of the answer packet doesn't seem to be correct.

    I've had a look through the raw response as well using .show() and i cant see any latency/time values in there, which i thought there would be.

    Has anyone managed to get the latency values out of the traceroute functionality of scapy?

    I'm quite new to python so bear that in mind as well :D

    I've had a look through the raw response as well using .show() and i cant see any latency/time values in there, which i thought there would be.

    Continue reading...

Compartilhe esta Página