From the course: Penetration Testing Essential Training
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Using Scapy to work with packets - Linux Tutorial
From the course: Penetration Testing Essential Training
Using Scapy to work with packets
- [Instructor] It's occasionally useful when testing to use raw packets to probe a target. We can do this in Python by invoking the Scapy library. Scapy is a Python tool, but it also comes as a library to use within our own Python scripts. It enables us to create each of the layers of a packet and within those layers to set all or any of the fields. Let's try a simple demonstration of Scapy to create a SYN flood, and we'll prepare a script called spack.pi, "nano spack.pi". Okay. Here we can see the flood routine, setting a loop across all target ports and create a TCP SYN packet with its source and destination IP addresses, and source and destination ports, and sending it to all ports on the target. Okay, let's run this script against our metasploitable server. "Sudo python spack.pi". Okay. This is sending out a lot of packets. Of course, this isn't a sophisticated flood, but it does demonstrate the ease of using Scapy.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.