addr = socket.gethostbyname('dalitstan.org')
target = [addr]
result, unans = traceroute(target,maxttl=32)
I am doing this and getting the below output. Is there some way here to get the IP of specific hop in a variable. And also why some hop number are missing in the traceroute result?
Begin emission:
Finished to send 32 packets.
*************************
Received 25 packets, got 25 answers, remaining 7 packets
185.53.178.6:tcp80
1 192.168.43.1 11
3 10.71.83.18 11
4 172.16.26.245 11
5 172.26.31.242 11
11 49.44.18.38 11
13 103.198.140.164 11
14 103.198.140.27 11
15 80.81.194.27 11
16 217.64.161.25 11
17 217.64.170.214 11
18 185.53.178.6 SA
19 185.53.178.6 SA
20 185.53.178.6 SA
21 185.53.178.6 SA
22 185.53.178.6 SA
23 185.53.178.6 SA
24 185.53.178.6 SA
25 185.53.178.6 SA
26 185.53.178.6 SA
27 185.53.178.6 SA
28 185.53.178.6 SA
29 185.53.178.6 SA
30 185.53.178.6 SA
31 185.53.178.6 SA
32 185.53.178.6 SA
On trying result.get_trace()['185.53.178.6'][7]
I am getting below error. What may be the issue.
Traceback (most recent call last):
File "cens2.py", line 16, in <module>
print result.get_trace()['185.53.178.6'][7]
File "/usr/local/lib/python2.7/dist-packages/scapy/layers/inet.py", line 1040, in get_trace
m = min(x for x, y in k.itervalues() if y[1])
File "/usr/local/lib/python2.7/dist-packages/scapy/layers/inet.py", line 1040, in <genexpr>
m = min(x for x, y in k.itervalues() if y[1])
TypeError: 'bool' object has no attribute '__getitem__'
You can extract the value for a hop using result.get_trace() So for hop 7 use result.get_trace()['185.53.178.6'][7]
Some index checking from a different trace shown as.