EONRaider / blackhat-python3

Source code for the book "Black Hat Python" by Justin Seitz. The code has been fully converted to Python 3, reformatted to comply with PEP8 standards and refactored to eliminate dependency issues involving the implementation of deprecated libraries.
2.02k stars 414 forks source link
blackhat-python blackhat-python-source-code cybersecurity ethical-hacking hacking-tools network-programming network-security python-hacking

Python 3 "Black Hat Python" Source Code

Source code for the book "Black Hat Python" by Justin Seitz. The code has been fully converted to Python 3, reformatted to comply with PEP8 standards and refactored to eliminate dependency issues involving the implementation of deprecated libraries.

Although many optimizations could have been implemented in the source code presented throughout the book, the code was left unaltered as much as possible so that such modifications can be applied by the reader as he sees fit. The code as it is needs some serious refactoring efforts ranging from docstrings to type hinting and exception handling, not to mention enhancements like context managers, but these issues by themselves may come to benefit the reader if he has the intention of implementing them. It also presents many bugs originating from indentation that have been corrected if fatal errors were to be avoided during runtime.

A conversion similar to this one has been made available by myself on the source code of the book "Violent Python", by TJ O'Connor. Check it out here if you haven't done it yet.

Usage

Simply choose a directory (DIR) in which to clone the project using git clone, create a new virtual environment or venv for it (recommended ) and install the requirements using pip install.

user@host:~/DIR$ git clone https://github.com/EONRaider/blackhat-python3
user@host:~/DIR$ python3 -m venv venv
user@host:~/DIR$ source venv/bin/activate
(venv) user@host:~/DIR$ pip install -r requirements.txt

Notes

Refactoring

Critical bug fixes that had to be made in order to properly implement the source code and avoid fatal errors:

Translations

Contributions in other languages can be checked here:

Contributing

As a matter of common sense, first try to discuss the change you wish to make to this repository via an issue.

  1. Ensure the modifications you wish to introduce actually lead to a pull request. The change of one line or two should be requested through an issue instead.
  2. If necessary, update the README.md file with details relative to changes to the project structure.
  3. Make sure the commit messages that include the modifications follow a standard. If you don't know how to proceed, here is a great reference on how to do it.
  4. Your request will be reviewed as soon as possible (usually within 48 hours).