Black Hat Python, 2nd Edition cover

Black Hat Python, 2nd Edition

Python Programming for Hackers and Pentesters
by Justin Seitz and Tim Arnold
April 2021, 216 pp.
ISBN-13: 
9781718501126
Lay-flat binding

Look Inside!

Download Chapter 3: Writing a Sniffer


Click here to download all the code and resources for the book.

When it comes to creating powerful and effective hacking tools, Python is the language of choice for most security analysts. In this second edition of the bestselling Black Hat Python, you’ll explore the darker side of Python’s capabilities: everything from writing network sniffers, stealing email credentials, and bruteforcing directories to crafting mutation fuzzers, investigating virtual machines, and creating stealthy trojans.

All of the code in this edition has been updated to Python 3.x. You’ll also find new coverage of bit shifting, code hygiene, and offensive forensics with the Volatility Framework as well as expanded explanations of the Python libraries ctypes, struct, lxml, and BeautifulSoup, and offensive hacking strategies like splitting bytes, leveraging computer vision libraries, and scraping websites.

You’ll learn how to:

  • Create a trojan command-and-control server using GitHub
  • Detect sandboxing and automate common malware tasks like keylogging and screenshotting
  • Extend the Burp Suite web-hacking tool
  • Escalate Windows privileges with creative process control
  • Use offensive memory forensics tricks to retrieve password hashes and find vulnerabilities on a virtual machine
  • Abuse Windows COM automation
  • Exfiltrate data from a network undetected

When it comes to offensive security, you need to be able to create powerful tools on the fly. Learn how with Black Hat Python.

Author Bio 

Justin Seitz is the president and co-founder of Dark River Systems Inc., where he spends his time shipping Hunchly, consulting for hedge funds and doing OSINT research. He is the author of Gray Hat Python (No Starch Press), the first book to cover Python for security analysis.

Tim Arnold has worked as a professional Python software developer at the SAS Institute for more than 20 years. He contributes to several open source software projects and volunteers as a hacking trainer in his local community.

Table of contents 

Foreword by Charlie Miller
Preface
Chapter 1: Setting up Your Python Environment
Chapter 2: Basic Networking Tools
Chapter 3: Writing a Sniffer
Chapter 4: Owning the Network with Scapy
Chapter 5: Web Hackery
Chapter 6: Extending Burp Proxy
Chapter 7: GitHub Command and Control
Chapter 8: Common Trojaning Tasks on Windows
Chapter 9: Fun with Exfiltration
Chapter 10: Windows Privilege Escalation
Chapter 11: Offensive Forensics
Index

View the Copyright Page
View the detailed Table of Contents
View the Index

Reviews 

Black Hat Python is a fun read written by experts with years of experience who are willing to share the secrets they have learned along the way. While It might not immediately turn you into a super stunt hacker like me, it will certainly get you started down the correct path.”
(from the foreword)
—Charlie Miller, Security Researcher

"If you work as a computer security professional and want to code in Python, this is definitely a book that belongs on your bookshelf."
—Craig Mullins, Data and Technology Today

"An essential resource for anyone involved in offensive security or looking to improve their Python programming skills. Its comprehensive coverage, practical examples, and step-by-step instructions make it an invaluable tool for anyone looking to become a skilled hacker or penetration tester."
—InfoSecNoobs.com

Reviews of the first edition of Black Hat Python:

Selected by Cyber Defense Magazine as 1 of 100 Best CyberSecurity Books

"Another incredible Python book. With a minor tweak or two many of these programs will have at least a ten year shelf life, and that is rare for a security book."
—Stephen Northcutt, founding president of the SANS Technology Institute

"A great book using Python for offensive security purposes."
—Andrew Case, Volatility core developer and coauthor of The Art of Memory Forensics

"If you truly have a hacker’s mindset, a spark is all you need to make it your own and do something even more amazing. Justin Seitz offers plenty of sparks."
—Ethical Hacker

"Whether you're interested in becoming a serious hacker/penetration tester or just want to know how they work, this book is one you need to read. Intense, technically sound, and eye-opening."
—Sandra Henry-Stocker, IT World

"Definitely a recommended read for the technical security professional with some basic previous exposure to Python."
—Richard Austin, IEEE Cipher

"This book breaks down how to create powerful tools using Python like network sniffers or keyloggers. This book even goes over how to escalate privileges in Windows."
—Davin Jackson, Alpha Cyber Security, Books to Start Your Penetration Testing Journey

Updates 

View the latest errata.