Packet Manipulation With Scapy: Build Your Own Network Hacking Tools With Scapy in Python

Abdeladim Fadheli

Language: English

Published: Mar 30, 2023

Page Count: 562

Description:

Welcome to "Packet Manipulation with Scapy using Python," a comprehensive guide to understanding, analyzing, and manipulating network packets using Python and Scapy. As our world becomes increasingly connected, the need for understanding how network protocols and devices communicate with each other has never been more vital. With the power of Python and Scapy, you can dive into the intricacies of networking, and create your own tools to interact with the network.

Whether you are a seasoned network engineer, an aspiring ethical hacker, or simply a curious learner, this book will provide you with the tools and knowledge necessary to gain a deeper understanding of the world of networking.

Throughout the book, we will explore different topics, starting with various practical applications, such as DHCP listeners, network scanning, Wi-Fi scanning, SYN flooding attacks, and more. You will also learn about more advanced topics, like ARP and DNS spoofing, packet sniffing, and injecting code into HTTP responses. By the end of the book, you will have the skills to create advanced network scanners and implement various network attacks.

We will build interesting Python scripts that heavily use

DHCP Listener : We build a Python script that looks for DNS request packets and prints them to the console. Since DHCP is enabled for most networks, you’ll be able to capture any device’s important information that was recently connected to your network. Network Scanner : A simple network scanner that uses ARP requests to discover connected devices in the same network. Wi-Fi Scanner : We’ll build an airodump-ng clone that scans for nearby Wi-Fi’s using Scapy. SYN Flooding Attack : One of the most common denial of service attacks, we’ll make a script that does that. Creating Fake Access Points : We’ll build a script to send 802.11 beacon frames continuously to forge fake access points nearby. Forcing Devices to Disconnect : Like beacon frames, we make a Python code that can send 802.11 deauthentication frames in the air. ARP Spoofing Attack : You’ll learn to forge malicious ARP packets and send them into the network to be man-in-the-middle. Detecting ARP Spoofing Attacks : A Python script to detect malicious ARP replies and warn the user when that happens. DNS Spoofing : After you’re man-in-the-middle using ARP Spoofing, you can modify the victim’s packet on the fly. In this script, we’ll target DNS response packets and change the response domain name to a modified domain to forward the target users to malicious websites. Sniffing HTTP Packets : Another use case of being man-in-the-middle is that you can sniff many packets that include helpful information, such as HTTP data. Injecting Code into HTTP Packets : Rather than just viewing the packets, why not modify them and include malicious Javascript, HTML, or CSS code on the websites the user visits? Advanced Network Scanner : Finally, we build an advanced network scanner that is robust in most network settings; we bundle a bunch of scanners such as passive monitoring, ARP scanning, UDP scanning, and ICMP scanning. We even include the DHCP listener in it. Besides that, you’ll be able to write more than 500 lines of Python code and learn a lot about Python classes, IP addresses, threading, and more.