ARP man-in-the-middle tool with Scapy
A man-in-the-middle attack means that the attacker sits between the source and destination to pass all the data through the attacking system. This will allow the attacker to view the victim's activities. We can write a small script in Python with the help of Scapy to run a man-in-the-middle attack.
How to do it...
For better understanding we can write a script, following the steps:
- Create a new file named
mitm-scapy.py
and open it in your editor. - As usual, import the required module:
from scapy.all import *import osimport timeimport sys
Here we import Scapy along with the os
, time
, and sys
modules, which are required in the script.
- Now we have to define the variables for the script. We can get the variable details with the
raw_input
method in Python 2.x orinput()
in Python 3.x, rather than defining it in the script:
interface = "en0"source_ip = "192.168.1.1"destination_ip = "192.168.1.33"
- As we have to get the MAC addresses of the source and destination to craft...