From d8282439277aa502a2708e93a1a83e8341644fa9 Mon Sep 17 00:00:00 2001 From: Manuel Vergara Date: Tue, 30 Jan 2024 18:42:12 +0100 Subject: [PATCH] Add intercept packets script --- python-ofensivo/15_hacking/06_intercept.py | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 python-ofensivo/15_hacking/06_intercept.py diff --git a/python-ofensivo/15_hacking/06_intercept.py b/python-ofensivo/15_hacking/06_intercept.py new file mode 100644 index 0000000..960c140 --- /dev/null +++ b/python-ofensivo/15_hacking/06_intercept.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 + +import scapy.all as scapy + + +def process_packet(packet): + """ + Procesa los paquetes que llegan a la cola 0 + """ + + if packet.haslayer(scapy.DNSRR): + + qname = packet[scapy.DNSQR].qname + + # print(qname) + + if "hack4u.io" in qname.decode() or "vergaracarmona.es" in qname.decode(): + + print( + f"\n------------------\n{packet.show()}\n------------------\n" + ) + + +scapy.sniff( + iface="wlo1", filter="udp and port 53", + store=False, prn=process_packet +)