CINXE.COM
Black Hat Python, 2nd Edition | No Starch Press
<!DOCTYPE html> <html lang="en" dir="ltr" xmlns:og="https://ogp.me/ns#"> <head> <link rel="profile" href="https://www.w3.org/1999/xhtml/vocab" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="shortcut icon" href="https://nostarch.com/sites/default/files/favicon.ico" type="image/vnd.microsoft.icon" /> <meta name="description" content="Explore the stealthier side of programming with Black Hat Python, 2nd Edition – fully updated for Python 3, with all new strategies for your hacking projects!" /> <meta name="generator" content="Drupal 7 (http://drupal.org)" /> <link rel="image_src" href="https://nostarch.com/sites/default/files/BlackHatPython2e_cover.png" /> <link rel="canonical" href="https://nostarch.com/black-hat-python2E" /> <link rel="shortlink" href="https://nostarch.com/node/583" /> <meta property="og:type" content="article" /> <meta property="og:url" content="https://nostarch.com/black-hat-python2E" /> <meta property="og:title" content="Black Hat Python, 2nd Edition" /> <meta property="og:description" content="Explore the stealthier side of programming with Black Hat Python, 2nd Edition – fully updated for Python 3, with all new strategies for your hacking projects!" /> <meta property="og:updated_time" content="2025-03-20T09:16:15-07:00" /> <meta property="og:image:url" content="https://nostarch.com/sites/default/files/BlackHatPython2e_cover.png" /> <meta property="og:image:secure_url" content="https://nostarch.com/sites/default/files/BlackHatPython2e_cover.png" /> <meta name="twitter:card" content="summary" /> <meta name="twitter:site" content="@nostarch" /> <meta name="twitter:url" content="https://nostarch.com/black-hat-python2E" /> <meta name="twitter:title" content="Black Hat Python, 2nd Edition" /> <meta name="twitter:description" content="Explore the stealthier side of programming with Black Hat Python, 2nd Edition – fully updated for Python 3, with all new strategies for your hacking projects!" /> <meta name="twitter:image" content="https://nostarch.com/sites/default/files/BlackHatPython2e_cover.png" /> <meta property="product:price:amount" content="44.99" /> <meta property="product:price:currency" content="USD" /> <meta property="product:isbn" content="9781718501126" /> <meta property="article:published_time" content="2020-07-21T10:50:27-07:00" /> <meta property="article:modified_time" content="2025-03-20T09:16:15-07:00" /> <meta property="product:retailer_part_no" content="BHPython2Ed-combo" /> <meta property="product:mfr_part_no" content="BHPython2Ed-combo" /> <title>Black Hat Python, 2nd Edition | No Starch Press</title> <link type="text/css" rel="stylesheet" href="https://nostarch.com/sites/default/files/css/css_lQaZfjVpwP_oGNqdtWCSpJT1EMqXdMiU84ekLLxQnc4.css" media="all" /> <link type="text/css" rel="stylesheet" href="https://nostarch.com/sites/default/files/css/css_guSWpwqRBCVb2J7ivC8BaNuaPffCXmbkGB5xDBqKKu8.css" media="all" /> <link type="text/css" rel="stylesheet" href="https://nostarch.com/sites/default/files/css/css_Dw0rmhFX_owMmlf1HH5Y-_BnOHcMlkri1yMjYHD4ffs.css" media="all" /> <link type="text/css" rel="stylesheet" href="https://nostarch.com/sites/default/files/css/css_XJm3Wqia1GUjoI4j54duSLNZVR3Kxhbwy0s3UwuhhHg.css" media="all" /> <!-- HTML5 element support for IE6-8 --> <!--[if lt IE 9]> <script src="https://cdn.jsdelivr.net/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script> <![endif]--> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script> <script>window.jQuery || document.write("<script src='/sites/all/modules/contrib/jquery_update/replace/jquery/2.2/jquery.min.js'>\x3C/script>")</script> <script src="https://nostarch.com/misc/jquery-extend-3.4.0.js?v=2.2.4"></script> <script src="https://nostarch.com/misc/jquery-html-prefilter-3.5.0-backport.js?v=2.2.4"></script> <script src="https://nostarch.com/misc/jquery.once.js?v=1.2"></script> <script src="https://nostarch.com/misc/drupal.js?stn5l0"></script> <script src="https://nostarch.com/sites/all/modules/contrib/jquery_update/js/jquery_browser.js?v=0.0.1"></script> <script src="https://nostarch.com/misc/form-single-submit.js?v=7.103"></script> <script src="https://nostarch.com/sites/all/modules/contrib/ubercart/uc_file/uc_file.js?stn5l0"></script> <script src="https://nostarch.com/sites/all/libraries/colorbox/jquery.colorbox-min.js?stn5l0"></script> <script src="https://nostarch.com/sites/all/modules/contrib/colorbox/js/colorbox.js?stn5l0"></script> <script src="https://nostarch.com/sites/all/modules/contrib/colorbox/styles/plain/colorbox_style.js?stn5l0"></script> <script src="https://nostarch.com/sites/all/modules/contrib/colorbox/js/colorbox_load.js?stn5l0"></script> <script src="https://nostarch.com/sites/all/modules/contrib/colorbox/js/colorbox_inline.js?stn5l0"></script> <script src="https://nostarch.com/sites/all/modules/contrib/ubercart/uc_cart/uc_cart_block.js?stn5l0"></script> <script src="https://nostarch.com/sites/all/modules/contrib/google_analytics/googleanalytics.js?stn5l0"></script> <script src="https://www.googletagmanager.com/gtag/js?id=UA-5027625-1"></script> <script>window.google_analytics_uacct = "UA-5027625-1";window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments)};gtag("js", new Date());gtag("set", "developer_id.dMDhkMT", true);gtag("config", "UA-5027625-1", {"groups":"default","anonymize_ip":true});gtag("config", "G-51XGZT9Y4H", {"groups":"default","anonymize_ip":true});</script> <script src="https://nostarch.com/sites/all/themes/nostarch/js/bootstrap.min.js?stn5l0"></script> <script src="https://nostarch.com/sites/all/themes/nostarch/js/main.js?stn5l0"></script> <script src="https://nostarch.com/sites/all/themes/nostarch/js/front_grid_height.js?stn5l0"></script> <script>jQuery.extend(Drupal.settings, {"basePath":"\/","pathPrefix":"","setHasJsCookie":0,"ajaxPageState":{"theme":"nostarch","theme_token":"AcHj6p1Gu7NoOzQL1T_7yHAWCXsuWwHikkli559XTfs","js":{"sites\/all\/modules\/contrib\/addthis\/addthis.js":1,"sites\/all\/libraries\/shariff\/shariff.min.js":1,"sites\/all\/themes\/contrib\/bootstrap\/js\/bootstrap.js":1,"\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/2.2.4\/jquery.min.js":1,"0":1,"misc\/jquery-extend-3.4.0.js":1,"misc\/jquery-html-prefilter-3.5.0-backport.js":1,"misc\/jquery.once.js":1,"misc\/drupal.js":1,"sites\/all\/modules\/contrib\/jquery_update\/js\/jquery_browser.js":1,"misc\/form-single-submit.js":1,"sites\/all\/modules\/contrib\/ubercart\/uc_file\/uc_file.js":1,"sites\/all\/libraries\/colorbox\/jquery.colorbox-min.js":1,"sites\/all\/modules\/contrib\/colorbox\/js\/colorbox.js":1,"sites\/all\/modules\/contrib\/colorbox\/styles\/plain\/colorbox_style.js":1,"sites\/all\/modules\/contrib\/colorbox\/js\/colorbox_load.js":1,"sites\/all\/modules\/contrib\/colorbox\/js\/colorbox_inline.js":1,"sites\/all\/modules\/contrib\/ubercart\/uc_cart\/uc_cart_block.js":1,"sites\/all\/modules\/contrib\/google_analytics\/googleanalytics.js":1,"https:\/\/www.googletagmanager.com\/gtag\/js?id=UA-5027625-1":1,"1":1,"sites\/all\/themes\/nostarch\/js\/bootstrap.min.js":1,"sites\/all\/themes\/nostarch\/js\/main.js":1,"sites\/all\/themes\/nostarch\/js\/front_grid_height.js":1},"css":{"modules\/system\/system.base.css":1,"modules\/field\/theme\/field.css":1,"sites\/all\/modules\/contrib\/logintoboggan\/logintoboggan.css":1,"modules\/node\/node.css":1,"sites\/all\/modules\/contrib\/uc_fedex\/uc_fedex.css":1,"sites\/all\/modules\/contrib\/ubercart\/uc_file\/uc_file.css":1,"sites\/all\/modules\/contrib\/ubercart\/uc_order\/uc_order.css":1,"sites\/all\/modules\/contrib\/ubercart\/uc_product\/uc_product.css":1,"sites\/all\/modules\/contrib\/ubercart\/uc_store\/uc_store.css":1,"sites\/all\/modules\/contrib\/views\/css\/views.css":1,"sites\/all\/modules\/contrib\/ckeditor\/css\/ckeditor.css":1,"sites\/all\/modules\/contrib\/uc_discounts_alt\/uc_discounts\/uc_discounts.css":1,"sites\/all\/modules\/contrib\/colorbox\/styles\/plain\/colorbox_style.css":1,"sites\/all\/modules\/contrib\/ctools\/css\/ctools.css":1,"sites\/all\/modules\/contrib\/ubercart\/uc_cart\/uc_cart_block.css":1,"sites\/all\/libraries\/shariff\/shariff.complete.css":1,"sites\/all\/themes\/nostarch\/css\/en_styles.css":1,"sites\/all\/themes\/nostarch\/css\/custom.css":1,"sites\/all\/themes\/nostarch\/css\/bootstrap-3-vert-offset.css":1,"sites\/all\/themes\/nostarch\/css\/bootstrap-3-autoclear.css":1,"sites\/all\/themes\/nostarch\/css\/glyphicons.css":1}},"colorbox":{"opacity":"0.85","current":"{current} of {total}","previous":"\u00ab Prev","next":"Next \u00bb","close":"Close","maxWidth":"98%","maxHeight":"98%","fixed":true,"mobiledetect":true,"mobiledevicewidth":"480px","file_public_path":"\/sites\/default\/files","specificPagesDefaultValue":"admin*\nimagebrowser*\nimg_assist*\nimce*\nnode\/add\/*\nnode\/*\/edit\nprint\/*\nprintpdf\/*\nsystem\/ajax\nsystem\/ajax\/*"},"better_exposed_filters":{"views":{"topics":{"displays":{"block":{"filters":[]}}},"related_products":{"displays":{"block":{"filters":[]}}}}},"googleanalytics":{"account":["UA-5027625-1","G-51XGZT9Y4H"],"trackOutbound":1,"trackMailto":1,"trackDownload":1,"trackDownloadExtensions":"7z|aac|arc|arj|asf|asx|avi|bin|csv|doc(x|m)?|dot(x|m)?|exe|flv|gif|gz|gzip|hqx|jar|jpe?g|js|mp(2|3|4|e?g)|mov(ie)?|msi|msp|pdf|phps|png|ppt(x|m)?|pot(x|m)?|pps(x|m)?|ppam|sld(x|m)?|thmx|qtm?|ra(m|r)?|sea|sit|tar|tgz|torrent|txt|wav|wma|wmv|wpd|xls(x|m|b)?|xlt(x|m)|xlam|xml|z|zip","trackColorbox":1},"urlIsAjaxTrusted":{"\/black-hat-python2E":true},"bootstrap":{"anchorsFix":"0","anchorsSmoothScrolling":"0","formHasError":1,"popoverEnabled":1,"popoverOptions":{"animation":1,"html":0,"placement":"right","selector":"","trigger":"click","triggerAutoclose":1,"title":"","content":"","delay":0,"container":"body"},"tooltipEnabled":1,"tooltipOptions":{"animation":1,"html":0,"placement":"auto left","selector":"","trigger":"hover focus","delay":0,"container":"body"}}});</script> </head> <body class="html not-front not-logged-in two-sidebars page-node page-node- page-node-583 node-type-product uc-product-node"> <div id="skip-link"> <a href="#main-content" class="element-invisible element-focusable">Skip to main content</a> </div> <header id="" class="header" role="banner" class="navbar navbar-default"> <div class="container"> <div class="row"> <nav role="navigation" class="navbar navbar-default visible-xs"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand text-uppercase" href="/"><img src="https://nostarch.com/sites/all/themes/nostarch/logo.png" alt="Home" class="img-responsive"/></a> </div> <div id="navbar" class="navbar-collapse collapse text-center"> <ul class="menu nav navbar-nav"><li class="first leaf"><a href="/catalog.htm" title="Explore our catalog">Catalog</a></li> <li class="leaf"><a href="https://nostarch.com/merchandise-0" title="Merchandise">Merchandise</a></li> <li class="leaf"><a href="/blog" title="The No Starch Press blog">Blog</a></li> <li class="leaf"><a href="https://nostarch.com/early-access-program" title="Media contact">Early Access</a></li> <li class="leaf"><a href="/writeforus" title="Submit a book proposal">Write for Us</a></li> <li class="leaf"><a href="/about" title="About No Starch Press">About Us</a></li> <li class="last leaf"><a href="/contactus" title="Contact Us">Contact Us</a></li> </ul> <div class="region region-navigation"> <section id="block-uc-cart-cart" class="block block-uc-cart clearfix"> <h2 class="block-title"><a href="/cart"><span class="cart-block-icon-empty" title="View your shopping cart."></span></a><span class="cart-block-title-bar" title="Show/hide shopping cart contents.">Shopping cart<span class="cart-block-arrow arrow-down"></span></span></h2> <p class="cart-block-items collapsed uc-cart-empty">There are no products in your shopping cart.</p><table class="cart-block-summary"><tbody><tr><td class="cart-block-summary-items"><span class="num-items">0</span> Items</td><td class="cart-block-summary-total"><label>Total:</label> <span class="uc-price">$0.00</span></td></tr></tbody></table> </section> <section id="block-search-api-page-site-search" class="block block-search-api-page clearfix"> <form action="/black-hat-python2E" method="post" id="search-api-page-search-form-site-search" accept-charset="UTF-8"><div><div class="form-item form-item-keys-2 form-type-textfield form-group"><input placeholder="Search" class="form-control form-text" type="text" id="edit-keys-2" name="keys_2" value="" size="15" maxlength="128" /> <label class="control-label element-invisible" for="edit-keys-2">Enter your keywords</label> </div><input type="hidden" name="id" value="2" /> <button class="icon glyphicon glyphicon-search btn-primary form-control btn form-submit" type="submit" id="edit-submit-2" name="op" value=""></button> <input type="hidden" name="form_build_id" value="form-1bInfWirCK5fiNRBbSS6jwkA5m31Yvh5_8GcTnoRDZo" /> <input type="hidden" name="form_id" value="search_api_page_search_form_site_search" /> </div></form> </section> </div> </div> </nav> <div class="navbar-header"> <div class="logo-wrapper col-sm-6 hidden-xs"> <a class="logo navbar-btn pull-left" href="/" title="Home"> <img src="https://nostarch.com/sites/all/themes/nostarch/logo.png" alt="Home" class="img-responsive"/> </a> </div> <div class="logo-wrapper col-sm-6 hidden-xs"> <div class="region region-navigation"> <div class="region region-navigation"> <section id="block-uc-cart-cart" class="block block-uc-cart clearfix"> <h2 class="block-title"><a href="/cart"><span class="cart-block-icon-empty" title="View your shopping cart."></span></a><span class="cart-block-title-bar" title="Show/hide shopping cart contents.">Shopping cart<span class="cart-block-arrow arrow-down"></span></span></h2> <p class="cart-block-items collapsed uc-cart-empty">There are no products in your shopping cart.</p><table class="cart-block-summary"><tbody><tr><td class="cart-block-summary-items"><span class="num-items">0</span> Items</td><td class="cart-block-summary-total"><label>Total:</label> <span class="uc-price">$0.00</span></td></tr></tbody></table> </section> <section id="block-search-api-page-site-search" class="block block-search-api-page clearfix"> <form action="/black-hat-python2E" method="post" id="search-api-page-search-form-site-search" accept-charset="UTF-8"><div><div class="form-item form-item-keys-2 form-type-textfield form-group"><input placeholder="Search" class="form-control form-text" type="text" id="edit-keys-2" name="keys_2" value="" size="15" maxlength="128" /> <label class="control-label element-invisible" for="edit-keys-2">Enter your keywords</label> </div><input type="hidden" name="id" value="2" /> <button class="icon glyphicon glyphicon-search btn-primary form-control btn form-submit" type="submit" id="edit-submit-2" name="op" value=""></button> <input type="hidden" name="form_build_id" value="form-1bInfWirCK5fiNRBbSS6jwkA5m31Yvh5_8GcTnoRDZo" /> <input type="hidden" name="form_id" value="search_api_page_search_form_site_search" /> </div></form> </section> </div> </div> </div> </div> </div> </div> <div class="container"> <div class="row"> <div class="navbar-collapse collapse"> <nav role="navigation"> <ul class="menu nav navbar-nav"><ul class="menu nav navbar-nav"><li class="first leaf"><a href="/catalog.htm" title="Explore our catalog">Catalog</a></li> <li class="leaf"><a href="https://nostarch.com/merchandise-0" title="Merchandise">Merchandise</a></li> <li class="leaf"><a href="/blog" title="The No Starch Press blog">Blog</a></li> <li class="leaf"><a href="https://nostarch.com/early-access-program" title="Media contact">Early Access</a></li> <li class="leaf"><a href="/writeforus" title="Submit a book proposal">Write for Us</a></li> <li class="leaf"><a href="/about" title="About No Starch Press">About Us</a></li> <li class="last leaf"><a href="/contactus" title="Contact Us">Contact Us</a></li> </ul></ul> </nav> </div> </div> </div> </header> <div class="main-container container"> <header role="banner" id="page-header"> </header> <!-- /#page-header --> <div class="row"> <aside class="col-sm-3" role="complementary"> <div class="region region-sidebar-first well"> <section id="block-views-topics-block" class="block block-views clearfix"> <button class="btn btn-primary btn-block visible-xs vert-offset-top-2" data-toggle="collapse" data-target="#topics"><span class="glyphicon glyphicon-menu-down pull-left"></span> <span class="btn-text">Topics</span><span class="glyphicon glyphicon-menu-down pull-right"></span></button> <h2 class="block-title hidden-xs">Topics</h2> <div id="topics" class="view-content collapse dont-collapse animateCollapse"> <div class="view view-topics view-id-topics view-display-id-block view-dom-id-92a9f81736dfb9c80eed324c5da722c5"> <div class="view-content"> <div class="item-list"> <ul> <li class="views-row views-row-1 views-row-odd views-row-first"> <div class="views-field views-field-name"> <span class="field-content"><a href="/catalog/art-photography-design">Art & Design</a></span> </div></li> <li class="views-row views-row-2 views-row-even"> <div class="views-field views-field-name"> <span class="field-content"><a href="/catalog/general-computing">General Computing</a></span> </div></li> <li class="views-row views-row-3 views-row-odd"> <div class="views-field views-field-name"> <span class="field-content"><a href="/catalog/security">Hacking & Computer Security</a></span> </div></li> <li class="views-row views-row-4 views-row-even"> <div class="views-field views-field-name"> <span class="field-content"><a href="/catalog/hardware-and-diy">Hardware / DIY</a></span> </div></li> <li class="views-row views-row-5 views-row-odd"> <div class="views-field views-field-name"> <span class="field-content"><a href="/catalog/kids">Kids</a></span> </div></li> <li class="views-row views-row-6 views-row-even"> <div class="views-field views-field-name"> <span class="field-content"><a href="/catalog/lego">LEGO®</a></span> </div></li> <li class="views-row views-row-7 views-row-odd"> <div class="views-field views-field-name"> <span class="field-content"><a href="/catalog/linux-bsd-unix">Linux & BSD</a></span> </div></li> <li class="views-row views-row-8 views-row-even"> <div class="views-field views-field-name"> <span class="field-content"><a href="/catalog/manga">Manga</a></span> </div></li> <li class="views-row views-row-9 views-row-odd"> <div class="views-field views-field-name"> <span class="field-content"><a href="/catalog/programming">Programming</a></span> </div></li> <li class="views-row views-row-10 views-row-even"> <div class="views-field views-field-name"> <span class="field-content"><a href="/catalog/python">Python</a></span> </div></li> <li class="views-row views-row-11 views-row-odd"> <div class="views-field views-field-name"> <span class="field-content"><a href="/catalog/rforall">R for All</a></span> </div></li> <li class="views-row views-row-12 views-row-even"> <div class="views-field views-field-name"> <span class="field-content"><a href="/catalog/science-math">Science & Math</a></span> </div></li> <li class="views-row views-row-13 views-row-odd"> <div class="views-field views-field-name"> <span class="field-content"><a href="/catalog/scratch">Scratch</a></span> </div></li> <li class="views-row views-row-14 views-row-even"> <div class="views-field views-field-name"> <span class="field-content"><a href="/catalog/system-administration">System Administration</a></span> </div></li> <li class="views-row views-row-15 views-row-odd views-row-last"> <div class="views-field views-field-name"> <span class="field-content"><a href="/catalog/early-access">Early Access</a></span> </div></li> </ul></div> </div> <div class="view-footer"> <style> <!--/*--><![CDATA[/* ><!--*/ .view-topics .item-list a {font-weight: bold;} .view-topics ul {padding-left: 20px;} /*--><!]]>*/ </style> </div> </div> </div> </section><section id="block-block-12" class="block block-block clearfix"> <div class="rounded_border_block"><span style="font-family:Arial,Helvetica,sans-serif"><strong><span style="font-size:12px"><span style="color:#c0392b"><a href="https://nostarch.com/about_ebooks.htm">FREE ebook edition with every print book purchased from nostarch.com!</a></span></span></strong></span></div> <p class="rtecenter"><span style="font-size:22px">+</span></p> <div class="rounded_border_block"><span style="font-family:Arial,Helvetica,sans-serif"><strong><span style="font-size:12px"><a href="https://nostarch.com/early-access-program"><span style="color:#c0392b">EARLY ACCESS lets you read full chapters months before a title's release date!</span></a></span></strong></span></div> </section> <section id="block-nostarch-custom-login-block" class="block block-nostarch-customclearfix"> <h2 class="block-title">User login</h2> <ul> <li><a href="/user">Log in</a></a></li> <li><a href="/user/register">Create account</a></a></li> </ul> </section> <section id="block-block-78" class="block block-block clearfix"> <script data-account="eeqOpWOUyZ" src="https://cdn.userway.org/widget.js"></script> </section> </div> </aside> <!-- /#sidebar-first --> <section class="col-sm-6" style=""> <a id="main-content"></a> <div class="region region-content"> <section id="block-system-main" class="block block-system clearfix"> <div class="ds-1col node node-product node-promoted view-mode-full clearfix"> <div class=""> <div class="field field-name-field-image-cache field-type-image field-label-hidden"><div class="field-items"><div class="field-item even"><div class="product-image"><div class="main-product-image"><a href="https://nostarch.com/sites/default/files/styles/uc_product_full/public/BlackHatPython2e_cover.png?itok=t9z_kVDp" title="Black Hat Python, 2nd Edition cover" class="colorbox" rel="uc_image_0"><img class="img-responsive" src="https://nostarch.com/sites/default/files/styles/uc_product/public/BlackHatPython2e_cover.png?itok=aINpYFyr" alt="Black Hat Python, 2nd Edition cover" title="Black Hat Python, 2nd Edition cover" /></a></div></div></div></div></div><div class="field field-name-entity-title field-type-ds field-label-hidden"><div class="field-items"><div class="field-item even"><h1 class="page-header">Black Hat Python, 2nd Edition</h1></div></div></div><div class="field field-name-field-subtitle field-type-text field-label-hidden"><div class="field-items"><div class="field-item even">Python Programming for Hackers and Pentesters</div></div></div><div class="field field-name-field-author field-type-text field-label-hidden"><div class="field-items"><div class="field-item even">by Justin Seitz and Tim Arnold</div></div></div><div class="field field-name-released-date field-type-ds field-label-hidden"><div class="field-items"><div class="field-item even">April 2021, 216 pp.</div></div></div><div class="field field-name-field-isbn13 field-type-text field-label-inline clearfix clearfix"><div class="field-label">ISBN-13: </div><div class="field-items"><div class="field-item even">9781718501126</div></div></div><div class="field field-name-field-special field-type-text field-label-hidden"><div class="field-items"><div class="field-item even">Lay-flat binding</div></div></div><div class="add-to-cart"><form action="/black-hat-python2E" method="post" id="uc-product-add-to-cart-form-583" accept-charset="UTF-8"><div><div id="uc_product_add_to_cart_form-583-attributes" class="attributes"><div class="attribute attribute-1 odd"><div class="form-item form-item-attributes-1 form-type-radios form-group"><div id="edit-attributes-1" class="form-radios"><div class="form-item form-item-attributes-1 form-type-radio radio"> <label class="control-label" for="edit-attributes-1-3"><input type="radio" id="edit-attributes-1-3" name="attributes[1]" value="3" checked="checked" class="form-radio" />Print Book and FREE Ebook, $44.99</label> </div><div class="form-item form-item-attributes-1 form-type-radio radio"> <label class="control-label" for="edit-attributes-1-2"><input type="radio" id="edit-attributes-1-2" name="attributes[1]" value="2" class="form-radio" />Ebook (PDF, Mobi, and ePub), $35.99</label> </div></div></div></div></div><input type="hidden" name="qty" value="1" /> <input type="hidden" name="form_build_id" value="form-4gUmjQpNMJ6JA39frsj4c7pK7ZT8NGTYasHX_EBSNXY" /> <input type="hidden" name="form_id" value="uc_product_add_to_cart_form_583" /> <div class="form-actions form-wrapper form-group" id="edit-actions"><button class="node-add-to-cart btn btn-success form-submit icon-before" type="submit" id="edit-submit-583" name="op" value="Add to cart"><span class="icon glyphicon glyphicon-plus" aria-hidden="true"></span> Add to cart</button> </div></div></form></div><div class="field field-name-product-menu field-type-ds field-label-hidden"><div class="field-items"><div class="field-item even"><div class="menu-wrapper"><ul class="menu nav"><li><a href="#content">Contents</a></li><li><a href="#reviews">Reviews</a></li><li><a href="#updates">Updates</a></li></ul></div></div></div></div><div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p><b>Look Inside!</b></p> <div class="lookinside" style:=""> <a href="/images/BHP_2e_back_green.png" class="colorbox"><img src="/images/BHP_2e_back_green.png" title="Back Cover" alt="Black Hat Python 2nd Edition back" style="border:1px solid; margin:5px; height:102px;" /></a> <a href="/images/BHP2e_34.png" class="colorbox"><img src="/images/BHP2e_34.png" title="Page 34" alt="Black Hat Python 2E Ch 2, Page 34" style="border:1px solid; margin:5px; width:78px; height:102px; object-fit:cover;" /></a> <a href="/images/BHP2e_46.png" class="colorbox"><img src="/images/BHP2e_46.png" title="Chapter 3, Page 46" alt="Black Hat Python 2E Ch 3, Page 46" style="border:1px solid; margin:5px; height:102px;" /></a><a href="/images/BHP2e_90.png" class="colorbox"><img src="/images/BHP2e_90.png" title="Chapter 5, Page 90" alt="Black Hat Python 2E, Ch 5, Page 90" style="border:1px solid; margin:5px; width:78px; height:102px; object-fit:cover;" /></a><a href="/images/BHP2E_176.png" class="colorbox"><img src="/images/BHP2E_176.png" title="Chapter 11, Page 176" alt="Black Hat Python 2E Page 176" style="border:1px solid; margin:5px; height:102px;" /> </a><a href="/images/BHP2e_mockup.png" class="colorbox"><img src="/images/BHP2e_mockup.png" title="Product Image" alt="Black Hat Python 2E" style="border:1px solid; margin:5px; width:78px; height:102px; object-fit:cover;" /></a> </div> <style> <!--/*--><![CDATA[/* ><!--*/ @media (max-width: 767px) { .downloadbutton{ width: 100%; } } /*--><!]]>*/ </style><p><a href="/download/samples/BlackHatPython2E_CH03_SampleN.pdf" target="_blank" class="btn btn-success downloadbutton" style="font-weight: 400;">Download Chapter 3: Writing a Sniffer</a><br /> <br /><br /> <strong><u><a href="/download/BHPCode.zip" target="new">Click here to download all the code and resources for the book.</a></u></strong><br /> <br /></p> <p>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 <i>Black Hat Python</i>, 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.</p> <p>All of the code in this edition has been updated to <b>Python 3.x</b>. 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.</p> <p>You’ll learn how to:</p> <ul> <li>Create a trojan command-and-control server using GitHub </li><li>Detect sandboxing and automate common malware tasks like keylogging and screenshotting </li><li>Extend the Burp Suite web-hacking tool </li><li>Escalate Windows privileges with creative process control </li><li>Use offensive memory forensics tricks to retrieve password hashes and find vulnerabilities on a virtual machine </li><li>Abuse Windows COM automation </li><li>Exfiltrate data from a network undetected </li></ul> <p>When it comes to offensive security, you need to be able to create powerful tools on the fly. Learn how with <i>Black Hat Python</i>.</p> </div></div></div><div class="field field-name-field-author-bio field-type-text-long field-label-abovec"><div class="field-label">Author Bio </div><div class="field-items"><div class="field-item even"><p><b>Justin Seitz</b> is the president and co-founder of Dark River Systems Inc., where he spends his time shipping <a href="https://www.hunch.ly" target="_blank" style="text-decoration:underline;">Hunchly</a>, consulting for hedge funds and doing OSINT research. He is the author of <i>Gray Hat Python</i> (No Starch Press), the first book to cover Python for security analysis.</p> <p><b>Tim Arnold</b> 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.</p> </div></div></div><div class="field field-name-field-toc field-type-text-long field-label-abovec" id="content"><div class="field-label">Table of contents </div><div class="field-items"><div class="field-item even"><p><b>Foreword by Charlie Miller</b><br /> <b>Preface</b><br /> <b>Chapter 1:</b> Setting up Your Python Environment<br /> <b>Chapter 2:</b> Basic Networking Tools<br /> <b>Chapter 3:</b> Writing a Sniffer<br /> <b>Chapter 4:</b> Owning the Network with Scapy<br /> <b>Chapter 5:</b> Web Hackery<br /> <b>Chapter 6:</b> Extending Burp Proxy<br /> <b>Chapter 7:</b> GitHub Command and Control<br /> <b>Chapter 8:</b> Common Trojaning Tasks on Windows<br /> <b>Chapter 9:</b> Fun with Exfiltration<br /> <b>Chapter 10:</b> Windows Privilege Escalation<br /> <b>Chapter 11:</b> Offensive Forensics<br /> <b>Index</b></p> <p><a href="/download/samples/BHP2e_copyrightpage.pdf" target="_blank" style="text-decoration:underline;"><b>View the Copyright Page</b></a><br /> <a href="/download/samples/BHP2e_detailedTOC.pdf" target="_blank" style="text-decoration:underline;"><b>View the detailed Table of Contents</b></a><br /> <a href="/download/samples/BHP2e_index.pdf" target="_blank" style="text-decoration:underline;"><b>View the Index</b></a></p> </div></div></div><div class="field field-name-field-reviews field-type-text-long field-label-abovec" id="reviews"><div class="field-label">Reviews </div><div class="field-items"><div class="field-item even"><p>“<i>Black Hat Python</i> 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.”<br /> (from the foreword)<br /> <b>—Charlie Miller, Security Researcher</b></p> <p>"If you work as a computer security professional and want to code in Python, this is definitely a book that belongs on your bookshelf."<br /> <b>—Craig Mullins, Data and Technology Today</b></p> <p>"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."<br /> <b>—InfoSecNoobs.com</b></p> <p><b>Reviews of the first edition of <i>Black Hat Python:<i></i></i></b></p> <p><b>Selected by <a href="https://www.cyberdefensemagazine.com/top-100-cybersecurity-books/" target="_blank" style="text-decoration:underline;">Cyber Defense Magazine</a> as 1 of 100 Best CyberSecurity Books</b></p> <p>"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."<br /> <b>—Stephen Northcutt, founding president of the SANS Technology Institute</b></p> <p>"A great book using Python for offensive security purposes."<br /> <b>—Andrew Case, Volatility core developer and coauthor of The Art of Memory Forensics</b></p> <p>"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."<br /> <b>—Ethical Hacker</b></p> <p>"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."<br /> <b>—Sandra Henry-Stocker, IT World</b></p> <p>"Definitely a recommended read for the technical security professional with some basic previous exposure to Python."<br /> <b>—Richard Austin, IEEE Cipher</b></p> <p> "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."<br /> <b>—Davin Jackson, <a href="https://alphacybersecurity.tech/books-to-start-your-penetration-testing-journey-2021-edition/" target="_blank" style="text-decoration:underline;">Alpha Cyber Security</a>, Books to Start Your Penetration Testing Journey</b></p> </div></div></div><div class="field field-name-field-extra-stuff field-type-text-long field-label-abovec"><div class="field-label">Extra Stuff </div><div class="field-items"><div class="field-item even"><p><b> First Edition Resources</b></p> <ul class="resources"> <li><u><a href="http://www.nostarch.com/download/BHP-Code.zip">Download the First Edition's resources and code samples.</a></u></li> <li><u><a href="https://www.offensive-security.com/kali-linux-vmware-arm-image-download/">The download location for Kali Linux has changed. You can grab various virtual machines here.</a></u></li> </ul> </div></div></div><div class="field field-name-field-updates field-type-text-long field-label-abovec" id="updates"><div class="field-label">Updates </div><div class="field-items"><div class="field-item even"><p>View the <a href="/download/BlackHatPython2_errata_p4.pdf" target="_blank" style="text-decoration:underline;"><u><b>latest errata</b></u></a>.</p> </div></div></div> </div> </div> </section> <section id="block-shariff-shariff-block" class="block block-shariff clearfix"> <div class="shariff" data-services="["facebook","print","twitter"]" data-theme="colored" data-orientation="horizontal" data-twitter-via="nostarch" data-lang="en"></div> </section> </div> </section> <aside class="col-sm-3" role="complementary"> <div class="region region-sidebar-second"> <section id="block-system-navigation" class="block block-system block-menu clearfix"> <h2 class="block-title">Navigation</h2> <ul class="menu nav"><li class="first last leaf"><a href="/user" title="">My account</a></li> </ul> </section> <section id="block-block-52" class="block block-block clearfix"> <p><a href="/mailchimp/subscribe">Want sweet deals? <br />Sign up for our newsletter.</a></p> </section> <section id="block-views-related-products-block" class="block block-views clearfix"> <h2 class="block-title">You might also like...</h2> <div class="view view-related-products view-id-related_products view-display-id-block auto-clear view-dom-id-a9772f843cc88c97ff7acbf8cf697c22"> <div class="view-content"> <div class="views-row views-row-1 views-row-odd views-row-first col-xs-6 col-sm-6 col-md-12"> <div class="views-field views-field-field-image-cache"> <div class="field-content"><a href="/assembly2.htm"><img class="img-responsive" src="https://nostarch.com/sites/default/files/styles/product/public/assembly2_big.png?itok=0KemrrQV" width="90" height="119" alt="The Art of Assembly Language, 2nd Edition" title="The Art of Assembly Language, 2nd Edition" /></a></div> </div> </div> <div class="views-row views-row-2 views-row-even col-xs-6 col-sm-6 col-md-12"> <div class="views-field views-field-field-image-cache"> <div class="field-content"><a href="/art-mac-malware-volume-1"><img class="img-responsive" src="https://nostarch.com/sites/default/files/styles/product/public/ArtofMacMalware_v1_frontcover.png?itok=zLAba8xC" width="90" height="119" alt="The Art of Mac Malware, Volume 1 Cover" title="The Art of Mac Malware, Volume 1 Cover" /></a></div> </div> </div> <div class="views-row views-row-3 views-row-odd col-xs-6 col-sm-6 col-md-12"> <div class="views-field views-field-field-image-cache"> <div class="field-content"><a href="/crypto-dictionary"><img class="img-responsive" src="https://nostarch.com/sites/default/files/styles/product/public/9781718501409.png?itok=v_q5cyhY" width="90" height="136" alt="Crypto Dictionary cover" title="Crypto Dictionary cover" /></a></div> </div> </div> <div class="views-row views-row-4 views-row-even col-xs-6 col-sm-6 col-md-12"> <div class="views-field views-field-field-image-cache"> <div class="field-content"><a href="/doingmathwithpython"><img class="img-responsive" src="https://nostarch.com/sites/default/files/styles/product/public/pymath_cover-front_new.png?itok=zoJc66H5" width="90" height="119" alt="Doing Math with Python" title="Doing Math with Python" /></a></div> </div> </div> <div class="views-row views-row-5 views-row-odd col-xs-6 col-sm-6 col-md-12"> <div class="views-field views-field-field-image-cache"> <div class="field-content"><a href="/deep-learning-visual-approach"><img class="img-responsive" src="https://nostarch.com/sites/default/files/styles/product/public/deep-learning_cover.png?itok=4efsvQcJ" width="90" height="123" alt="Deep Learning Front Cover" title="Deep Learning Front Cover" /></a></div> </div> </div> <div class="views-row views-row-6 views-row-even views-row-last col-xs-6 col-sm-6 col-md-12"> <div class="views-field views-field-field-image-cache"> <div class="field-content"><a href="/pythononeliners"><img class="img-responsive" src="https://nostarch.com/sites/default/files/styles/product/public/POL_frontcvr_final.png?itok=JJWTvMS7" width="90" height="119" alt="Python One-Liners" title="Python One-Liners" /></a></div> </div> </div> </div> </div> </section> </div> </aside> <!-- /#sidebar-second --> </div> </div> <footer class="footer container"> <div class="region region-footer"> <section id="block-block-16" class="block block-block clearfix"> <div id="footer-links"> <br> <a class="footer-links" href="/about.htm">About Us</a> <span class="footer-divider">|</span> <a class="footer-links" href="/Jobs.htm">Jobs!</a> <span class="footer-divider">|</span> <a class="footer-links" href="/distribution.htm">Sales and Distribution</a> <span class="footer-divider">|</span> <a class="footer-links" href="/rights">Rights</a> <span class="footer-divider">|</span> <a class="footer-links" href="/media.htm">Media</a> <span class="footer-divider">|</span> <a class="footer-links" href="/academic.htm">Academic Requests</a> <span class="footer-divider">|</span> <a class="footer-links" href="/conferences.htm">Conferences</a> <span class="footer-divider">|</span> <a class="footer-links" href="/orderfaq.htm">FAQ</a> <span class="footer-divider">|</span> <a class="footer-links" href="/contactus">Contact Us</a> <span class="footer-divider">|</span> <a class="footer-links" href="/writeforus">Write for Us</a> <span class="footer-divider">|</span> <a class="footer-links" href="/privacypolicy.htm">Privacy</a> </div> </section> <section id="block-nostarch-custom-custom-footer-copyright" class="block block-nostarch-custom clearfix"> <div class="block-block"> <p>Copyright 2025. No Starch Press, Inc</p> </div> </section> </div> </footer> <script src="https://nostarch.com/sites/all/modules/contrib/addthis/addthis.js?stn5l0"></script> <script src="https://nostarch.com/sites/all/libraries/shariff/shariff.min.js?stn5l0"></script> <script src="https://nostarch.com/sites/all/themes/contrib/bootstrap/js/bootstrap.js?stn5l0"></script> <!-- Reddit Pixel --> <script> !function(w,d){if(!w.rdt){var p=w.rdt=function(){p.sendEvent?p.sendEvent.apply(p,arguments):p.callQueue.push(arguments)};p.callQueue=[];var t=d.createElement("script");t.src="https://www.redditstatic.com/ads/pixel.js",t.async=!0;var s=d.getElementsByTagName("script")[0];s.parentNode.insertBefore(t,s)}}(window,document);rdt('init','t2_6acpsf9y');rdt('track', 'PageVisit'); </script> <!-- DO NOT MODIFY UNLESS TO REPLACE A USER IDENTIFIER --> <!-- End Reddit Pixel --> <script>(function(){function c(){var b=a.contentDocument||a.contentWindow.document;if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'92a7ba239e9afdf4',t:'MTc0MzY3NDUxMi4wMDAwMDA='};var a=document.createElement('script');a.nonce='';a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})();</script></body> </html>