Python for Cybersecurity

Automated Cybersecurity for the beginner

Python for Cybersecurity is an introductory book designed to help teach Python scripting, Cybersecurity principles, Linux, and automation. This book is designed for learners who have little or no experience in these areas, and builds on we learn through the book with scripts and activities.

Buy on LeanPub
Buy on Amazon

Description

Python for Cybersecurity is an introductory book designed to help teach Python scripting, Cybersecurity principles, Linux, and automation. This book is designed for learners who have little or no experience in these areas, and builds on we learn through the book with scripts and activities.

Using a learn-by-doing process, the goal of this book is to provide working examples that can be built on and extended. Don't get stuck needing to learn the basics of programming languages before having something useable. Build quickly off what you see.

Table of Contents

  • Introduction

Additional resources

  • Chapter 1: Introduction to Linux and Version Control

Introduction
Introduction to the Raspberry Pi
Introduction to Linux
Common Linux commands to know
Absolute vs. Relative paths
Introduction to Version Control
Working with Git and GitHub
Introduction to Python

  • Chapter 2: Python and IDEs

Introduction
Installing Python
Installing Visual Studio Code
Visual Studio Code and GitHub
Interactive Python
Our first Python Script
Variables
Our Second Python Script
Debugging
Simple Calculator

  • Chapter 3: Ping

Introduction
Importing modules into Python
Pinging devices in a network
Pinging in Python
First Ping
Python Conditionals
Second Ping
Introduction to Python Loops
Third Ping
Python Functions
Fourth Ping

  • Chapter 4: More Ping

Introduction
Reading Files in Interactive mode
Reading Files
Fifth Ping
Writing Files
Last Ping
Scanner Example

  • Chapter 5: Cryptography

Introduction
Introduction to Cryptography
Simple cryptography - Caesar Cipher
Creating your own ASCII table
Rot13.py
Pseudo-Encryption - Encoding Data
Why you shouldn’t create your own encryption scheme
Using Encryption Libraries

  • Chapter 6: Hacking Passwords

Introduction
How Linux passwords work
Hashing passwords for Linux
Creating the same hash twice
Dictionary Attacks
Brute-Force Attacks

  • Chapter 7: Log Files

Introduction
Local web server
Download sample files from Internet
Simple evaluations - read line-by-line
Intro to Regular Expressions
Using Regex to filter Apache logs
Find most frequent client
Find status codes
Finding potential hacking

  • Chapter 8: Intro to APIs

Introduction
Intro to APIs
Using PostMan
Introduction to JSON
First API script
Second API script
HaveIBeenPwned
Automating Passwords
Authenticating to APIs
Viewing GitHub repositories

  • Chapter 9: Cybersecurity APIs

Introduction
VirusTotal
Manually Scanning for Viruses
Scanning for Viruses with Python
Safe browsing on the internet
Scanning URLs with Python

  • Appendix - Using Git

Creating a Personal Access Token
Cloning GitHub locally
Pushing changes to GitHub

About the Author


Ed Goad has been in the IT field for over 20 years and is currently a professor at Green River College in Auburn, WA. He first became interested in scripting and automation when prompted with a task to uninstall software from over 1,000 systems with limited time and resources. He has worked with multiple languages, including PowerShell, VBscript, C#, BASH, and Python.

Code Samples

Browse this book's GitHub repository: https://github.com/edgoadcom/PythonforCybersecurity