Python Penetration Testing Cookbook

Over 50+ hands-on recipes to help you pen test networks using Python, discover vulnerabilities, and find a recovery path
Preview in Mapt

Python Penetration Testing Cookbook

Rejah Rehim

Over 50+ hands-on recipes to help you pen test networks using Python, discover vulnerabilities, and find a recovery path

Quick links: > What will you learn?> Table of content

Mapt Subscription
FREE
$29.99/m after trial
eBook
$19.60
RRP $27.99
Save 29%
Print + eBook
$34.99
RRP $34.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$19.60
$34.99
$29.99 p/m after trial
RRP $27.99
RRP $34.99
Subscription
eBook
Print + eBook
Start 14 Day Trial

Frequently bought together


Python Penetration Testing Cookbook Book Cover
Python Penetration Testing Cookbook
$ 27.99
$ 19.60
Instant Penetration Testing: Setting Up a Test Lab How-to Book Cover
Instant Penetration Testing: Setting Up a Test Lab How-to
$ 14.99
$ 10.50
Buy 2 for $28.00
Save $14.98
Add to Cart

Book Details

ISBN 139781784399771
Paperback226 pages

Book Description

Penetration testing is the use of tools and code to attack a system in order to assess its vulnerabilities to external threats. Python allows pen testers to create their own tools. Since Python is a highly valued pen-testing language, there are many native libraries and Python bindings available specifically for pen-testing tasks.

Python Penetration Testing Cookbook begins by teaching you how to extract information from web pages. You will learn how to build an intrusion detection system using network sniffing techniques. Next, you will find out how to scan your networks to ensure performance and quality, and how to carry out wireless pen testing on your network to avoid cyber attacks. After that, we’ll discuss the different kinds of network attack. Next, you’ll get to grips with designing your own torrent detection program. We’ll take you through common vulnerability scenarios and then cover buffer overflow exploitation so you can detect insecure coding. Finally, you’ll master PE code injection methods to safeguard your network.

Table of Contents

Chapter 1: Why Python in Penetration Testing?
Introduction
Why Python is a great option for security scripting
Python 3 language basics and differences
Chapter 2: Setting Up a Python Environment
Introduction
Setting up a Python environment in Linux
Setting up a Python environment in macOS
Setting up a Python environment in Windows
Chapter 3: Web Scraping with Python
Introduction
Download web pages with Python scripts
Changing the user agent
Downloading files
Using a regular expression to get the information from the downloaded web pages
Requesting and downloading dynamic website pages
Dynamic GET requests
Chapter 4: Data Parsing with Python
Introduction
Parsing HTML tables
Extracting data from HTML documents
Parsing XML data
Chapter 5: Web Scraping with Scrapy and BeautifulSoup
Introduction
Web spiders with Scrapy
Scrapy shell
Link extractor with Scrapy
Scraping after logging into websites using Scrapy
Chapter 6: Network Scanning with Python
Introduction
Simple port scanner
IP range/network scanner
Stealth scanning
FIN scanning
XMAS scanning
TCP ACK scanning
LanScan
Chapter 7: Network Sniffing with Python
Introduction
Packet sniffer in Python
Parsing the packet
PyShark
Chapter 8: Scapy Basics
Introduction
Creating a packet with Scapy
Sending and receiving packets with Scapy
Layering packets
Reading and writing to pcap files
Sniffing packets
ARP man-in-the-middle tool with Scapy
Chapter 9: Wi-Fi Sniffing
Introduction
Finding Wi-Fi devices
Getting ready
Finding SSIDs
Exposing hidden SSIDs
Dictionary attack on hidden SSIDs
Fake access points with Scapy
Chapter 10: Layer 2 Attacks
Introduction
ARP Watcher
ARP cache poisoning
MAC flooder
VLAN hopping
ARP spoofing over VLAN hopping
DHCP starvation
Chapter 11: TCP/IP Attacks
Introduction
IP spoofing
SYN flooding
Password sniffer with Python over LAN
Chapter 12: Introduction to Exploit Development
Introduction
Memory dump
CPU instructions
Chapter 13: Windows Exploit Development
Introduction
Windows memory layout
Buffer overflow with saved return pointer overwrite
Structured Exception Handling
Egg hunters
Chapter 14: Linux Exploit Development
Introduction
Format string exploitation
Buffer overflow

What You Will Learn

  • Learn to configure Python in different environment setups.
  • Find an IP address from a web page using BeautifulSoup and Scrapy
  • Discover different types of packet sniffing script to sniff network packets
  • Master layer-2 and TCP/ IP attacks
  • Master techniques for exploit development for Windows and Linux
  • Incorporate various network- and packet-sniffing techniques using Raw sockets and Scrapy

Authors

Table of Contents

Chapter 1: Why Python in Penetration Testing?
Introduction
Why Python is a great option for security scripting
Python 3 language basics and differences
Chapter 2: Setting Up a Python Environment
Introduction
Setting up a Python environment in Linux
Setting up a Python environment in macOS
Setting up a Python environment in Windows
Chapter 3: Web Scraping with Python
Introduction
Download web pages with Python scripts
Changing the user agent
Downloading files
Using a regular expression to get the information from the downloaded web pages
Requesting and downloading dynamic website pages
Dynamic GET requests
Chapter 4: Data Parsing with Python
Introduction
Parsing HTML tables
Extracting data from HTML documents
Parsing XML data
Chapter 5: Web Scraping with Scrapy and BeautifulSoup
Introduction
Web spiders with Scrapy
Scrapy shell
Link extractor with Scrapy
Scraping after logging into websites using Scrapy
Chapter 6: Network Scanning with Python
Introduction
Simple port scanner
IP range/network scanner
Stealth scanning
FIN scanning
XMAS scanning
TCP ACK scanning
LanScan
Chapter 7: Network Sniffing with Python
Introduction
Packet sniffer in Python
Parsing the packet
PyShark
Chapter 8: Scapy Basics
Introduction
Creating a packet with Scapy
Sending and receiving packets with Scapy
Layering packets
Reading and writing to pcap files
Sniffing packets
ARP man-in-the-middle tool with Scapy
Chapter 9: Wi-Fi Sniffing
Introduction
Finding Wi-Fi devices
Getting ready
Finding SSIDs
Exposing hidden SSIDs
Dictionary attack on hidden SSIDs
Fake access points with Scapy
Chapter 10: Layer 2 Attacks
Introduction
ARP Watcher
ARP cache poisoning
MAC flooder
VLAN hopping
ARP spoofing over VLAN hopping
DHCP starvation
Chapter 11: TCP/IP Attacks
Introduction
IP spoofing
SYN flooding
Password sniffer with Python over LAN
Chapter 12: Introduction to Exploit Development
Introduction
Memory dump
CPU instructions
Chapter 13: Windows Exploit Development
Introduction
Windows memory layout
Buffer overflow with saved return pointer overwrite
Structured Exception Handling
Egg hunters
Chapter 14: Linux Exploit Development
Introduction
Format string exploitation
Buffer overflow

Book Details

ISBN 139781784399771
Paperback226 pages
Read More

Read More Reviews

Recommended for You

Instant Penetration Testing: Setting Up a Test Lab How-to Book Cover
Instant Penetration Testing: Setting Up a Test Lab How-to
$ 14.99
$ 10.50
Learning Python for Forensics Book Cover
Learning Python for Forensics
$ 47.99
$ 33.60
Effective Python Penetration Testing Book Cover
Effective Python Penetration Testing
$ 31.99
$ 22.40
Mastering Cloud Penetration Testing Book Cover
Mastering Cloud Penetration Testing
$ 43.99
$ 30.80
Python Machine Learning Book Cover
Python Machine Learning
$ 35.99
$ 25.20
Modern Python Cookbook Book Cover
Modern Python Cookbook
$ 39.99
$ 28.00