I try to do the tracert operation in Scapy but it does not work for me, it writes me that there is an error in print (NoneType), can anyone help me solve the problem?
from scapy.all import *
from scapy.layers.inet import IP, ICMP, Ether, UDP, traceroute
TTL = 28
packet = IP(dst = '8.8.8.8') / ICMP(type = 0)
for i in range(TTL):
packet[IP].ttl = i + 1
ans = sr1(packet, timeout = 2, verbose = 0)
print(ans[IP].src)