def send_udp_reply(pkt):
    ip = IP()
    udp = UDP()
    ip.src = pkt[IP].dst
    ip.dst = pkt[IP].src
    udp.id = pkt[UDP].id
    udp.sport = pkt[UDP].dport
    udp.dport = pkt[UDP].sport
    print("[UDP] Sending UDP reply to %s" % ip.dst)
    data = "Udp reply"
    send(ip / udp / data, verbose=0)
def send_tcp_reply(pkt, flag):
    ip = IP()
    tcp = TCP()
    ip.src = pkt[IP].dst
    ip.dst = pkt[IP].src
    tcp.ack = pkt[TCP].ack
    tcp.sport = pkt[TCP].dport
    tcp.dport = pkt[TCP].sport
    tcp.flags = flag
    print("[UDP] Sending TCP reply to %s" % ip.dst)
    data = "Tcp reply"
    send(ip / tcp / data)
def send_echo_reply(pkt):
    ip = IP()
    icmp = ICMP()
    ip.src = pkt[IP].dst
    ip.dst = pkt[IP].src
    icmp.type = 0
    icmp.code = 0
    icmp.id = pkt[ICMP].id
    icmp.seq = pkt[ICMP].seq
    print("[ICMP] Sending echo reply to %s" % ip.dst)
    data = "Icmp reply"
    send(ip/icmp/data, verbose=0)