Mastering Python for Networking and Security
Leverage Python scripts and libraries to overcome networking and security issues
Jos Manuel Ortega
BIRMINGHAM - MUMBAI
Mastering Python for Networking and Security
Copyright 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author(s), nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Vijin Boricha
Acquisition Editor: Akshay Jethani
Content Development Editor: Deepti Thore
Technical Editor: Cymon Pereira
Copy Editor: Safis Editing
Project Coordinator: Kinjal Bari
Proofreader: Safis Editing
Indexer: Mariammal Chettiyar
Graphics: Jisha Chirayil
Production Coordinator: Deepika Naik
Production reference: 1270918
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78899-251-0
www.packtpub.com
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Packt.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at customercare@packtpub.com for more details.
At www.packt.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the author
Jos Manuel Ortega is a Software Engineer and he focuses on new technologies, open source, security and testing. His career target from the beginning has been to specialize in Python and security testing projects. In recent years he has developed interest in security development, especially in pentesting with python. Currently he is working as a security tester engineer and his functions in the project are analysis and testing the security of applications both web and mobile environments.
He has taught at university level and collaborated with the official school of computer engineers. He has also been a speaker at various conferences. He is very enthusiastic to learn about new technologies and he loves to share his knowledge with community.
I would like to thank my friends and family for their help in both the professional and personal fields. I would specially like to thank Akshay Jethani (Acquisition Editor at Packt Publishing) and Deepti Thore (Content Development Editor at Packt Publishing) for supporting me during the course of completing this book.
About the reviewer
Daniel Draper is an Australian software developer/entrepreneur and has been working in the software and Infosec field for over 10 years. He is a huge fan of kittens and the colour purple. Dan manages the YouTube channel DrapsTV providing free education for the curious novice to the advanced Jedi.
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Preface
Recently, Python has started to gain a lot of traction, with the latest updates of Python adding numerous packages that can be used to perform critical missions. Our main goal with this book is to help you leverage Pythons packages to detect and exploit vulnerabilities and take care of networking challenges.
This book will start by walking you through the scripts and libraries of Python that are related to networking and security. You will then dive deep into core networking tasks and learn how to take care of networking challenges. Later, this book will teach you how to write security scripts to detect vulnerabilities in your network or website. By the end of this book, you will have learned how to achieve endpoint protection by leveraging Python packages, along with how to write forensics and cryptography scripts.
Who this book is for
This book would be ideal for network engineers, system administrators, and any security professional looking at tackling networking and security challenges. Security researchers and developers interested in going deeper into Python and its networking and security packages also would make the most of this book.
What this book covers
, Working with Python Scripting , introduces you to the Python language, object-oriented programming, data structures, a methodology for developing with Python, and development environments.
, System Programming Packages , teaches you about the main Python modules for system programming, looking at topics inclusing reading and writing files, threads, sockets, multithreading, and concurrency.
, Sockets Programming , gives you some basics on Python networking using the socket module. The socket module exposes all of the necessary pieces to quickly write TCP and UDP clients, as well as servers for writing low-level network applications.
, HTTP Programming , covers the HTTP protocol and the main Python modules, such as the urllib standard library and the requests package. We also cover HTTP authentication mechanisms and how we can manage them with the requests module.
Next page