My take on the examples from the book Violent Python by O`Connor, T.
For the attacker machine, I recommend using Kali Linux - possibly in VirtualBox.
For the target machine, I recommend running Metasploitable 2 in VirtualBox. The Metasploitable virtual machine is an intentionally vulnerable version of Ubuntu Linux designed for testing security tools and demonstrating common vulnerabilities.
The code is written for Python 2.x.
Install the required packages by running:
$ sudo pip install -r requirements.txt
The material that is written by me is released under the Apache License v2; however, any material that is copied from the book's Companion Material website is licensed under its respective license.
Use the programs at your own risk. Some of the programs may be illegal to use, so only use them on machines that you own or are authorized to use.