You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using your library I am having issues with the traceroute portion. Below is my code. I feel like I have practically followed your example besides using input instead of a pre-defined IP.
from icmplib import ping, multiping, traceroute, Host, Hop
def trace(addresses):
for address in addresses:
hops = traceroute(
"{address}", count=3, interval=0.5, timeout=2, max_hops=10, fast_mode=False,
)
print(address)
print("Distance (ttl) Address Average round-trip time")
last_distance = 0
for hop in hops:
if last_distance + 1 != hop.distance:
print("****")
print(f"{hop.distance} {hop.address} {hop.avg_rtt} ms")
last_distance = hop.distance
I am a beginner so maybe I am doing something wrong but it seems like hop isn't defined in your library.
The text was updated successfully, but these errors were encountered:
Otherwise, this line is incorrect: hops = traceroute("{address}", count=3, interval=0.5, timeout=2, max_hops=10, fast_mode=False)
"{address}" is a string. It is not the address variable. Use instead: hops = traceroute(address, count=3, interval=0.5, timeout=2, max_hops=10, fast_mode=False)
Using your library I am having issues with the traceroute portion. Below is my code. I feel like I have practically followed your example besides using input instead of a pre-defined IP.
I am a beginner so maybe I am doing something wrong but it seems like hop isn't defined in your library.
The text was updated successfully, but these errors were encountered: