traceroute   A
last analyzed

Complexity

Total Complexity 0

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 0
eloc 8
dl 0
loc 16
rs 10
c 0
b 0
f 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