
Begin this beginner-friendly course on Python for cybersecurity with a learn-by-doing approach, using Raspberry Pi 4, Git and GitHub, and Visual Studio Code to script, debug, and automate cybersecurity tasks.
This lecture introduces the Raspberry Pi, its history and form factors from the standard model to the Raspberry Pi 400 and Pico, highlighting ports, built-in keyboard, and available software.
Discover why Python matters for cybersecurity, rooted in a fun, easy-to-use scripting philosophy inspired by Monty Python's Flying Circus, with demand in AWS, Azure, data science, and AI.
Download the Raspberry Pi OS image from raspberrypi.org, write it to an SD card with Win32diskimager, then complete first time setup: timezone, user password, Wi-Fi, updates, and reboot.
Install Visual Studio Code on a raspberry pi using apt commands, then explore Visual Studio Code features like the explorer, terminal, debugging, source control, extensions, and the Python extension.
Set up a GitHub account, clone the Python for cybersecurity repository from a template, configure git user and email in VS Code, and practice committing, pushing, and pulling changes.
Install Python 3.10, Git, Visual Studio Code, and Postman on Windows in sequence, add Python to the path, and configure GitHub synchronization for cross-system development.
Access python interactively on a Raspberry Pi, verify the version, enter the interpreter, and perform basic math, modulus, and exponent operations, using the print function for results.
Explore Python variables by creating and reassigning numbers and strings in interactive mode, viewing contents with print, and learn how int, float, and string types differ.
Open VS Code, write hello world Python script with a shebang, comments, and print hello world. Run and debug in IDE, then commit changes to Git and push to GitHub.
Explore debugging Python scripts in Visual Studio Code with breakpoints, step over/into, and a guided walkthrough of input, variables, and string formatting using placeholders and f-strings.
Reuse prebuilt Python modules to accomplish tasks and avoid reinventing code. Explore import options such as import math, from math import pi, and aliasing with as to manage namespaces.
Learn to use Python's os module and os.system to ping IP addresses, configure ping with count and timeout, redirect output to /dev/null, and interpret exit codes to determine online status.
Learn to build a Python ping script with os.system to run ping, capture the exit code, and distinguish zero (success) from nonzero (failure) for a target IP.
Learn how conditionals control flow in Python with if, else if, and else. Compare X and Y, distinguish assignment from equality, and rely on indentation and debugging basics.
Learn how loops automate repetitive tasks in Python, using for loops. Use the range function to count and while loops to run until a condition changes, pinging ip addresses.
Extend the ping script to ping multiple targets by looping the final octet of a 192.168.0.x address, producing an ip range scanner for administrators and security professionals.
Define a Python function with def, name it ping address, and pass an IP address. Call the function, return the exit code, and create portable, reusable code across scripts.
Learn to write to files in Python using built-in functions, a file object, and write mode, including newline handling and basic open, write, and close operations.
Load ip addresses from ips.txt with an import addresses function. Ping each address, write to the log, and print online status to monitor availability.
Demonstrates using nmap to perform port scans as an alternative to Python ping, including installation steps, scanning specific ports, and interpreting open or closed ports for security assessment.
Explore the caesar cipher, a simple shift cipher, using the ascii table to map letters to numbers and back in python. Learn to implement shifting, wrap-around, and obfuscation.
Explore rot13 in python, a 13-shift cipher, encrypting and decrypting text by rotating letters, wrapping around, and preserving spaces.
Base64 encoding safely transfers data by encoding to a bytes-like format, though it is not real encryption. The lecture demonstrates Python encode and decode functions with user prompts and debugging.
Avoid creating your own encryption schemes; rely on established cryptography and secure keys, and follow Kerckhoffs principle that attackers may know the system.
Explore how Linux stores passwords in the shadow file, revealing id, salt, and hash components. Learn how hashing with salt (sha-512) produces unique hashes per user, preventing password reuse.
Hash Linux passwords with Python and the crypt library, using sha-512 or sha-256 with salts to generate and compare login hashes, showing the one-way process.
Learn to perform a dictionary attack by hashing top passwords with a known salt and algorithm, then compare results to detect a match in a Python script.
Explore how brute force attacks systematically test every possible password combination, using ranges and hashes with salt to verify matches, and compare this approach to dictionary attacks.
Discover how APIs enable computers to talk and share data in a structured, internet-standard way, with practical Python examples and a basic Postman workflow for requests.
Explore a simple open API that reports how many people are in space and their crafts with no authentication, using GET requests, Postman previews, and Python requests code.
Explore json data from apis, learn to parse it with Python's requests and json modules, inspect dictionaries and lists, and extract astronauts data with loops.
Explore how to access the GitHub REST API with an authentication token, test with curl and Postman, and fetch your repositories in Python using requests and JSON parsing.
learn to securely manage api tokens in python by storing them in an external ini file via configparser, avoiding hard coding and keeping keys outside github.
Learn how to assess password security with the haveibeenpwned API in Postman, by hashing passwords with SHA-1, sending the first five characters, and checking breach counts to choose safer passwords.
Hash a password with sha1 in python, split the hash into the first five characters as prefix and the rest as postfix, then query the api to check the postfix.
Use postman to submit files and view virus scan reports via two api endpoints. Use a get request and set api key and resource id as query parameters.
Develop a Python script to scan files with VirusTotal by hashing with sha-256, checking existing reports via the API key, and uploading when needed while polling results within rate limits.
Python for Cybersecurity is an introductory Python scripting course, designed for individuals who have no prior scripting experience. With a specific focus on cybersecurity topics, several Python scripts are created and reviewed to showcase the power, flexibility, and ease of use for using Python.
This course is designed with a learn by doing approach that focuses on creation of fully functional scripts. Instead of being stuck learning the details of the programming or scripting language to create the "optimal" solution, we focus on "what works" instead. Once complete, we can then extend what we have to build bigger and better solutions
We will introduce the basic concepts of Python and how it can be used to facilitate cybersecurity initiatives. Additionally, we will introduce other tools such as Microsoft Visual Studio Code, Git and GitHub, various Linux commands, and Postman.
Included in this course:
Introduction to Python
Introduction to scripting related tools
Using Python to perform network scans
Using Python for cryptography and encryption
Understanding how passwords are stored and how insecure passwords can be guessed
Introduction to web-based APIs and RESTful transactions
Using APIs with a cybersecurity focus
This course is specifically designed to be completed on the Raspberry PI 4 single board computer. However, it can also be completed on a Windows, Linux, or Apple computer.