Revisiting ARP poisoning with Python and Scapy

Let's take a look at constructing a layer 2 ARP poisoning attack from the bottom up. Like before, the code here is a skeleton; with some clever Python wrapped around it, you have the potential to add a powerful tool to your arsenal. First, we bring in our imports and make some declarations:

#!/usr/bin/pythonfrom scapy.all import *import osimport sysimport threadingimport signalinterface = "eth1"target = "192.168.108.49"gateway = "192.168.108.1"packets = 1000conf.iface = interfaceconf.verb = 0

Check out those import statements—all of Scapy's power. We're familiar with os and threading, so let's look at sys and signal. The sys module is always available to us when we're Pythoning and it allows ...

Get Hands-On Penetration Testing on Windows now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.