| Total Complexity | 0 |
| Total Lines | 16 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import socket |
||
| 2 | |||
| 3 | from scapy.layers.inet import traceroute |
||
| 4 | |||
| 5 | # target = ["192.168.1.254"] |
||
| 6 | # target = ["1.1.1.1"] |
||
| 7 | # target = ["8.8.8.8"] |
||
| 8 | target = ["www.google.com"] |
||
| 9 | # for i in range(3): |
||
| 10 | traceroute_result, packets = traceroute(target, maxttl=32) |
||
| 11 | |||
| 12 | # print(traceroute_result, "\n") |
||
| 13 | for packet in packets: |
||
| 14 | ip_address = packet.src |
||
| 15 | hostname = socket.gethostbyaddr(ip_address) |
||
| 16 | # print(packet, "\t", hostname) |
||
| 17 |