Jump to ratings and reviews
Rate this book

Black Hat Python: Python Programming for Hackers and Pentesters

Rate this book
When it comes to creating powerful and effective hacking tools, Python is the language of choice for most security analysts. But just how does the magic happen?

In Black Hat Python, the latest from Justin Seitz (author of the best-selling Gray Hat Python), you'll explore the darker side of Python's capabilities writing network sniffers, manipulating packets, infecting virtual machines, creating stealthy trojans, and more. You'll learn how to:


Create a trojan command-and-control using GitHub
Detect sandboxing and automate common malware tasks, like keylogging and screenshotting
Escalate Windows privileges with creative process control
Use offensive memory forensics tricks to retrieve password hashes and inject shellcode into a virtual machine
Extend the popular Burp Suite web-hacking tool
Abuse Windows COM automation to perform a man-in-the-browser attack
Exfiltrate data from a network most sneakily
Insider techniques and creative challenges throughout show you how to extend the hacks and how to write your own exploits.When it comes to offensive security, your ability to create powerful tools on the fly is indispensable. Learn how in Black Hat Python.

"

171 pages, Paperback

First published November 25, 2014

Loading...
Loading...

About the author

Justin Seitz

9 books30 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
272 (43%)
4 stars
207 (33%)
3 stars
95 (15%)
2 stars
32 (5%)
1 star
14 (2%)
Displaying 1 - 30 of 36 reviews
Profile Image for Julio Biason.
199 reviews32 followers
December 26, 2016
The very first chapter give me high hopes for this book: Since Python is basically part of every single Linux install, you could do a shitton retrieving system and user information by just using the normal packages. You won't even need to install nmap or similar; using plain Python packages, you could check which services are running and such.

But then, things go downhill.

After the first chapter, you start to add Python packages, which means you need to have root access -- and even if you use something like a virtualenv, you still would announce yourself by requesting things over the net using easy_install (the book never mentions pip -- heck, it doesn't even mentions virtualenv to avoid being root), which could be easily blocked by sysadmins if your company doesn't have anything with Python.

And it doesn't stop at that: after these starting chapters, it start hacking Windows machines. Heck, Python is not installed by default on Windows and a py2exe executable weights something like 15Mb, which isn't much in bandwidth, but it's noticeable. And then it starts installing packages and more packages and requesting to run things as administrator, which would surely be a hassle.

The Python code itself is simplistic, to say the least. At the very first chapters I noticed that the code was basically C code translated to Python, which wouldn't be a problem if you're thinking about replacing basic hack code with Python code -- because it is easier to find Python installed than GCC, for example -- but with the problems cited above actually make me think that the author never really cared about Pythonic code, just did the very minimum to make code run and that's it.

So, it's a bad book about hacking because it requires privileged access beforehand and it's a bad book about Python because it doesn't follow Python good practices. In the end, it's just a book with a few interesting Python libraries, nothing more.
Profile Image for Emily.
206 reviews13 followers
September 6, 2015
Loved it, great examples with solid explanations of code. Great fun to play with in my spare time. As I had prior experience with sockets in C I was pleased to be able to pick up sockets in python so quickly. Github did not disappoint.

Not a book for a beginner scripter even if it does start with "how to install an IDE" - which was my only hang up ironically. Kali 2.0 came out a few weeks after this book and my determination to test it out while working through this book was a pain the ass. Eventually gave up on dropping WingIDE into Kali 2.0 and stuck with CLI and good ol' GCC.
Profile Image for Muhammad.
31 reviews7 followers
September 4, 2017
Much better than Gray Hat Python, though some dependencies are a hell to install. Gives information on useful tools every penetration tester/hacker should have in their arsenal.
53 reviews
Read
June 8, 2026
HIRE A LEGITIMATE ETHICAL HACKER FOR HELP

Ethical Hacking, Digital Forensics & Cyber Investigations by Hackertechs Services.

Contact Information:
Email: Hackertechs001@Gmail.Com
Text / Telegram: +1 626-244-7310

Suspecting infidelity is emotionally exhausting. Doubt, anxiety, and unanswered questions can quietly consume your peace of mind. In today’s digital world, affairs are no longer limited to secret meetings—they often happen through WhatsApp, social media, hidden emails, dating apps, and encrypted phones.

That’s why more people now choose to hire a hacker to catch a cheating spouse—not an illegal hacker, but a licensed ethical hacker and private investigator who can uncover the truth legally, discreetly, and professionally.

At Hackertechs Service, we specialize in ethical hacking, digital forensics, and cybersecurity investigations designed to reveal hidden digital behavior while preserving privacy, legality, and evidence integrity.


Why People Hire a Hacker to Catch a Cheating Partner.
Clients come to us when:

* Their spouse suddenly guards their phone
* Messages and call logs keep disappearing
* Social media behavior has changed
* Devices are locked or encrypted
* Financial activity seems hidden
* They need evidence for divorce or custody cases

Contact Information:
Email: Hackertechs001@Gmail.Com
Text / Telegram: +1(626) 244-7310
Profile Image for Silas Hue.
43 reviews
Read
June 8, 2026
HIRE A PRIVATE INVESTIGATOR TO CATCH A CHEATER : HACKER FOR HIRE NEEDED

HACKERTECHS001@GMAIL.COM
Hello there, am recommending everyone to a very trusted, reliable and gifted hacker. He is competent, and provides excellent services. She is very affordable and charges way less,

Many services he can offers include: Social Media Hack( Snapchat, WhatsApp, Instagram, Facebook/Messenger, Twitter, Viber etc.), GPS Location Tracking, Recovering of lost bitcoin/ bitcoin account, Intercepting and Retrieving Instant Messages, Credit Score Increase, WhatsApp Spy, Facebook/Messenger Spy, Skype Spy in real time, Remotely Accessing SMS, retrieve deleted files, Private Investigator, crypto currency wallet hijack, erase leaked sex tape of all kinds. What made me had trust in him was his offer of total Refund of any displeasing services but i didn't have to use that Choice.
HACKERTECHS001@GMAIL COM
Profile Image for Anton Antonov.
359 reviews52 followers
August 3, 2024
This tech book was quite different from the ones I’ve read before, especially at that period of time.
It offered a unique and enjoyable reading experience. Although hacking and penetration testing aren’t my areas of interest, the book helped me confirm that.

What I did find valuable was learning how to write small Python programs for decoding the Internet Protocol (IP) and ICMP. It served as a fun introduction to concepts that were relatively new to me at the time.

The book delves further into hacking and writing various small hacky programs. While it’s entertaining, it’s not my preferred type of fun - and that’s perfectly fine.

P.S. There’s also a 2nd edition from 2021 that I haven’t checked out yet. I recommend starting with that one, as the book now uses dated Python libraries.
54 reviews
Read
June 8, 2026
I highly recommend Hackertechs Cyber Service to anyone looking to hack/spy or recover lost/deactivated Facebook/instagram/TikTok, Meta related accounts, traceable scam funds . The important thing is ensure you still have access to the initial email used to create the account.
To Hire -( Hackertechs001@Gmail.Com )/ ( +16262447310 via telegram or text ) via Mail only.
Have always had trust issues with my spouse so I hired HACKERTECHS TEAM ( Hackertechs001@Gmail.Com ) to help me gain access into my Wife’s iCloud/iphone to be sure she isn’t a cheat, because I am planning to propose to her very soon, and with the help of this team of private investigators, I successfully gained access into her iCloud, WhatsApp, Instagram and Snapchat
Profile Image for Helium Christel.
55 reviews
Read
June 8, 2026
UNCOVER INFIDELITY THROUGH ETHICAL HACKING AND LEGIT HACKERS

Have always had trust issues with my spouse so I hired HACKERTECHS TEAM ( Hackertechs001@Gmail.Com ) to help me gain access into my Wife’s iCloud/iphone to be sure she isn’t a cheat, because I am planning to propose to her very soon, and with the help of this team of private investigators, I successfully gained access into her iCloud, WhatsApp, Instagram and Snapchat and now I can monitor what ever she does on her Iphone.. thank you so much HACKERTECHS TEAM. If you need this kind of service, then hire them via the Gmail- ( Hackertechs001@Gmail.Com ) / (+1 (626) 244-7310)
54 reviews
Read
June 8, 2026
Hackertechs001@Gmail.Com
Text / Telegram : +1(626) 244 7310
Huge thanks to HACKERTECHS SPY for helping me uncover the painful truth, It was a complete success.. I had long suspected my girlfriend was cheating on WhatsApp , and they helped me securely access her phone and social media including Facebook and Snapchat , what I found confirmed everything. Their service was fast, discreet, and incredibly professional. I finally got the clarity I needed, and I’ll always be grateful. So many people recommend them and now I see why. If you need help uncovering the truth, This is the team to trust and can vouch for . Reach them on email:( Hackertechs001@Gmail.Com )to get the help you need as well.
Profile Image for Roses Williams.
54 reviews
June 8, 2026
In needs of an expert to help you get cheating tran In needs of an expert to help you get cheating translated proofs HACKERTECHS has played a role in the industry to catching any cheating partner remotely.. If you need help to catch any cheating partner just like he did for me, i recommend you should hire him and thank me later. ( HACKERTECHS001@GMAIL.COM / +1 626-244-7310 )His name is Henry Goblets, His service is like a tracker on his phone that lets you monitor virtually any activity on your partner’s phone, including text messages, call logs, and even location, listen to outgoing calls, gps live location. This can work on any person device (it can be your colleagues at work or someone you want to hack for the truth) slated proofs HACKERTECHS has played a role in the industry to catching any cheating partner remotely.. If you need help to catch any cheating partner just like he did for me, i recommend you should hire him and thank me later. (HACKERTECHS001@GMAIL.COM)His name is Henry Goblets, His service is like a tracker on his phone that lets you monitor virtually any activity on your partner’s phone, including text messages, call logs, and even location, listen to outgoing calls, gps live location. This can work on any person device (it can be your colleagues at work or someone you want to hack for the truth)
9 reviews
Read
June 9, 2026
In needs of an expert to help you get cheating tran In needs of an expert to help you get cheating translated proofs HACKERTECHS has played a role in the industry to catching any cheating partner remotely.. If you need help to catch any cheating partner just like he did for me, i recommend you should hire him and thank me later. ( HACKERTECHS001@GMAIL.COM / +1 626-244-7310 )His name is Henry Goblets, His service is like a tracker on his phone that lets you monitor virtually any activity on your partner’s phone, including text messages, call logs, and even location, listen to outgoing calls, gps live location. This can work on any person device (it can be your colleagues at work or someone you want to hack for the truth) slated proofs HACKERTECHS has played a role in the industry to catching any cheating partner remotely.. If you need help to catch any cheating partner just like he did for me, i recommend you should hire him and thank me later. (HACKERTECHS001@GMAIL.COM)His name is Henry Goblets, His service is like a tracker on his phone that lets you monitor virtually any activity on your partner’s phone, including text messages, call logs, and even location, listen to outgoing calls, gps live location. This can work on any person device (it can be your colleagues at work or someone you want to hack for the truth)
1 review
June 10, 2023
First half of the book, 90 pages are good, but then shifts to Windows stuff.
I liked the examples with multi threading.
However “Violent Python, Syngress” is a much better read and if you have red that one, you can skip this one.
Profile Image for baas.
37 reviews2 followers
December 30, 2023
Read this throughout 2023 for great insights and ways to create some good Python scripts. It's a bit outdated (Python 2.7) and not suitable for beginners at all. Make sure to be proficient with Python before buying
42 reviews1 follower
May 25, 2025
Terrific book with heaps of theory and hands on examples. Covers a lot of topics.

By the end of the book I was not "coding along", but rather just reading through the examples.

Some parts were a bit dated, but most of the examples still worked.
16 reviews1 follower
October 7, 2017
Python ทำให้ทุกอย่างง่ายดาย แม้กระทั่งการเขียน malware
3 reviews1 follower
May 2, 2019
Decent book, but many of the codes just don't work. Be prepared to fix them. But, hey that's a good way to learn too right?
Profile Image for Michal Zima.
6 reviews5 followers
April 5, 2020
Excellent content, so many things to learn it's hard to find a start.

But the code could be written in python3
Profile Image for عَبدُالكَرِيمْ .
207 reviews3 followers
February 22, 2021
The book is full of snippet of codes! What's the use of that on a physical book? I wish it just discussed ideas and methods like the book Algorithm or the like.

Meh read. Didn't really like it.
645 reviews
August 20, 2021
Interesting codes, but book hard to read on an eReader because of the way the code was linked to the explanation.
9 reviews
February 26, 2022
Entry levels for for hacking. There’s not much about python. Good examples and use cases. Things are well explained. I skipped several chapters as its windows related though.
Profile Image for Hugh Smalley.
48 reviews
September 14, 2016

Black Hat Python explores the darker side of Python’s capabilities, helping you test your systems and improve your security posture.



When it comes to creating powerful and effective hacking tools, Python is the language of choice for most security analysts. But just how does the magic happen?


In *Black Hat Python*, the latest from Justin Seitz (author of the best-selling *Gray Hat Python*), you'll explore the darker side of Python's capabilities writing network sniffers, manipulating packets, infecting virtual machines, creating stealthy trojans, and more. You'll learn how to:


Create a trojan command-and-control using GitHub
Detect sandboxing and automate common malware tasks, like keylogging and screenshotting
Escalate Windows privileges with creative process control
Use offensive memory forensics tricks to retrieve password hashes and inject shellcode into a virtual machine
Extend the popular Burp Suite web-hacking tool
Abuse Windows COM automation to perform a man-in-the-browser attack
Exfiltrate data from a network most sneakily
Insider techniques and creative challenges throughout show you how to extend the hacks and how to write your own exploits.When it comes to offensive security, your ability to create powerful tools on the fly is indispensable. Learn how in *Black Hat Python*.


"

8 reviews2 followers
January 5, 2017
This is a very well laid out book. It reads easily and the python examples are great. Seitz python is simple and effective. You'll get a taste of it early on with his python packet sniffer.
I found of special interest his approach to XSS and Windows post exploitation techniques. Here's what you'll take away from this book: python's capacity to interact with many different api's and programs is what makes it such a powerful tool.
32 reviews
November 9, 2019
This book should definitely be on your shelf if you are a programmer and particularly if you a python programmer. It is a must own text which lays out how to conduct attacks in a very simple manner. I always thought there was so much mystery concerning hacking and cyber security, but he breaks down complex topics at a code level so you can understand them. It is extremely well written and very understandable.
Profile Image for AMAN KAUSHIK.
12 reviews
May 12, 2026
Black Hat Python touches the essence of ethical hacking and penetration testing. It provides hands-on knowledge about networking, building small servers, creating custom hacking tools, and privilege escalation. The book dives deep into scripting for cybersecurity, automation, and exploiting system vulnerabilities, making it a must-read for anyone interested in offensive security. It is an amazing and insightful read.
Profile Image for Steve.
5 reviews
October 19, 2021
The early chapters of this book are great, but once it gets into Windows content, it's just too much work to try to get the libraries installed to even try the code. The authors don't mention the issues of getting some of the libraries (specifically pyWinhook) to actually install, so if you get bogged down there, it's not just you.
46 reviews4 followers
January 21, 2015
Overall, it was a good book. I especially liked the online code. Also, I liked that, being an EFF member, I got a discount.
Displaying 1 - 30 of 36 reviews