Jump to ratings and reviews
Rate this book

Black Hat Python: Python Programming for Hackers and Pentesters

Rate this book
Fully-updated for Python 3, the second edition of this worldwide bestseller (over 100,000 copies sold) explores the stealthier side of programming and brings you all new strategies for your hacking projects.

When it comes to creating powerful and effective hacking tools, Python is the language of choice for most security analysts. In Black Hat Python, 2nd Edition, you’ll explore the darker side of Python’s capabilities—writing network sniffers, stealing email credentials, brute forcing directories, crafting mutation fuzzers, infecting virtual machines, creating stealthy trojans, and more.

The second edition of this bestselling hacking book contains code updated for the latest version of Python 3, as well as new techniques that reflect current industry best practices. You’ll also find expanded explanations of Python libraries such as ctypes, struct, lxml, and BeautifulSoup, and dig deeper into strategies, from splitting bytes to leveraging computer-vision libraries, that you can apply to future hacking projects.

You’ll learn how
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

When it comes to offensive security, your ability to create powerful tools on the fly is indispensable. Learn how with the second edition of Black Hat Python.

New to this edition:
All Python code has been updated to cover Python 3 and includes updated libraries used in current Python applications. Additionally, there are more in-depth explanations of the code and the programming techniques have been updated to current, common tactics. Examples of new material that you'll learn include how to sniff network traffic, evade anti-virus software, brute-force web applications, and set up a command-and-control (C2) system using GitHub.

192 pages, Kindle Edition

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
273 (43%)
4 stars
207 (33%)
3 stars
95 (15%)
2 stars
32 (5%)
1 star
14 (2%)
Displaying 1 - 30 of 41 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.
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
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 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.
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.
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)
53 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)
56 reviews
Read
June 9, 2026
How Do I Know My Spouse Is Cheating?

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 Wilford Scott.
53 reviews
Read
June 9, 2026
HIRE A HACKER TO HELP YOU SEE ALL YOUR PARTNER SECRETS

Email: HACKERTECHS001@GMAIL.COM
Do you suspect your spouse of cheating? Don’t know how to clarify your doubts? Well, you are not alone. It is natural for a partner to feel insecure about their relationship when their significant other isn’t paying them the attention they once did. You would like to know what’s going on with your spouse or partner. More specifically, you want to know for sure whether your spouse is cheating on you before you end up confronting them. Fortunately, there is a way to do so and be completely discreet about it. All you have to do is to hire this hacker called ( HACKERTECHS ) with good cyber ratings on this forum to help you hack your spouse phone, he’s professional, genuine and reliable. Relay all your problems to him and he’ll help you out I was able to access my cheating partner cellphone in less than 2 hours and it is perfectly setup to ease my insecurities. The monitoring dashboard is so lovely and very easy to use. Only messages him via any of his contacts details below.
Via Telegram - https://t.me/hackertechs001
Text - +1 (626) 244 7310
EMAIL-// HACKERTECHS001 (@) GMAIL (.) COM
72 reviews
Read
June 9, 2026
HACKERTECHS001@GMAIL.COM

Hire a Hacker to Catch a Cheating Spouse

Do you find yourself questioning your wife loyalty or suspecting infidelity? The Hackertechs service provides a comprehensive solution to monitor your husband’s text messages, phone calls, and social media interactions. In this article, we will empower you to uncover the truth and gain peace of mind. With the service of HACKERTECHS, you gain access to your husbands text messages, enabling you to monitor his conversations discreetly. Whether it's SMS or instant messaging platforms like WhatsApp or Facebook Messenger, He will help you gain access to read the content, view timestamps, and track the frequency and duration of conversations. Stay informed and aware of your wife's communication patterns to address any concerns or suspicions you may have.
𝗖𝗼𝗻𝘁𝗮𝗰𝘁 them 𝗳𝗼𝗿 𝘁𝗵𝗲 𝘀𝗼𝗳𝘁𝘄𝗮𝗿𝗲 𝗮𝗽𝗽 via HACKERTECHS001 @ GMAIL COM, 𝗯𝗲𝗰𝗮𝘂𝘀𝗲 𝘁𝗵𝗶𝘀 𝗮𝗽𝗽𝗹𝗶𝗰𝗮𝘁𝗶𝗼𝗻 𝗵𝗮𝘃𝗲 𝗯𝗲𝗲𝗻 𝗵𝗲𝗹𝗽𝗳𝘂𝗹𝗹 𝘁𝗼 𝗺𝗮𝗻𝘆 𝗽𝗲𝗼𝗽𝗹𝗲 𝘁𝗼 𝗿𝗲𝘃𝗲𝗮𝗹 𝗰𝗵𝗲𝗮𝘁𝗶𝗻𝗴 𝘀𝗽𝗼𝘂𝘀𝗲 𝘀𝗲𝗰𝗿𝗲𝘁 and gain access to partners phone without them knowing and you can spy on what texts they talk about. Love their work!
53 reviews
Read
June 9, 2026
( HackerTechs001@Gmail.Com )
Text : +16262447310
Telegram - https://t.me/hackertechs001
HOW TO HACK / SPY OR CLONE A CELLPHONE
Transparency is one of the most important factor in a relationship or marriage, You feel your spouse is cheating/hiding/ieeping secrets from you? If you're looking for a top-quality phone spying solution, HACKERTECHS is the answer. Their innovative application and link works quickly and easily, so you can get started right away. Installation is simple and takes just a few minutes, so you'll be up and running in no time. And their friendly support chat is always available to answer any questions you may have. Catching a cheating partner has become so easy with the help of (HackerTech Team) till now I can’t still believe I am in my husband’s iPhone 16. remotely I monitor everything he does on his phone.They are the best when it comes to any kind of cellphone monitoring services.
( Email- HackerTechs001@Gmail.Com )
53 reviews
June 9, 2026
Hackertechs001@Gmail.Com.
My cheating wife was very smart at hiding her infidelity from me due to some selfish reasons. So I had no proof for weeks while hurting myself during this process. Luckily I was referred to this private investigator and the result was legit and trustworthy. I went on nd hired him through his gmail at HACKERTECHS001@GMAIL.COM He was able to break into his phone and proved me with the access remotely to all my husband’s dirty chats, Facebook, WhatsApp, Instagram, and even phone conversations were directed to my cell phone, if your husband, wife or partner are experts at hiding his or her cheating adventures, work with this legit hacker. You can reach them via

Hackertechs001@Gmail.Com

TELEGRAM - https://t.me/hackertechs001
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.
646 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.
Displaying 1 - 30 of 41 reviews