SEC573: Automating Information Security with Python

Provided by SANS
GPYC Certification
Qualification level
GPYC Certification
Study type
View Website
View Website

About the course

Python is a simple, user-friendly language that is designed to make automating the tasks that security professionals perform quick and easy. Whether you are new to coding or have been coding for years, SANS SEC573: Automating Information Security with Python will have you creating programs that make your job easier and make your work more efficient. This self-paced course starts from the very beginning, assuming you have no prior experience or knowledge of programming. We cover all of the essentials of the language up front. If you already know the essentials, you will find that the pyWars lab environment allows advanced developers to quickly accelerate to more advanced material in the course.

All security professionals, including Penetration Testers, Forensics Analysts, Network Defenders, Security Administrators, and Incident Responders, have one thing in common: CHANGE. Change is constant. Technology, threats, and tools are constantly evolving. If we don't evolve with them, we'll become ineffective and irrelevant, unable to provide the vital defenses our organizations increasingly require.

Maybe your chosen Operating System has a new feature that creates interesting forensics artifacts that would be invaluable for your investigation, if only you had a tool to access it. Often for new features and forensics artifacts, no such tool has yet been released. You could try moving your case forward without that evidence or hope that someone creates a tool before the case goes cold...or you can write a tool yourself.

Or perhaps an attacker bypassed your defenses and owned your network months ago. If existing tools were able to find the attack, you wouldn't be in this situation. You are bleeding sensitive data and the time-consuming manual process of finding and eradicating the attacker is costing you money and hurting your organization big time. The answer is simple if you have the skills: Write a tool to automate your defenses.

Or, as a Penetration tester, you need to evolve as quickly as the threats you are paid to emulate. What do you do when "off-the-shelf" tools and exploits fall short? If you're good, you write your own tool.

SEC573 is designed to give you the skills you need for tweaking, customizing, or outright developing your own tools. We put you on the path of creating your own tools, empowering you to better automate the daily routine of today's information security professional and to achieve more value in less time. Again and again, organizations serious about security emphasize their need for skilled tool builders. There is a huge demand for people who can understand a problem and then rapidly develop prototype code to attack or defend against it. Join us and learn Python in-depth and fully weaponized.

You Will Learn How To:

  • Leverage Python to perform routine tasks quickly and efficiently
  • Automate log analysis and packet analysis with file operations, regular expressions, and analysis modules to find evil
  • Develop forensics tools to carve binary data and extract new artifacts
  • Read data from databases and the Windows Registry
  • Interact with websites to collect intelligence
  • Develop UDP and TCP client and server applications
  • Automate system processes and process their output


Course Syllabus

SEC573.1: Essentials Workshop with pyWars


The course begins with a brief introduction to Python and the pyWars Capture-the-Flag challenge. We set the stage for students to learn at their own pace in the pyWars lab environment, which is 100 percent hands-on. As more advanced students take on Python-based Capture-the-Flag challenges, students who are new to programming will start from the very beginning with Python essentials.

CPE/CMU Credits: 6


  • Syntax
  • Variables
  • Math Operators
  • Strings
  • Functions
  • Modules
  • Control Statements
  • Introspection

SEC573.2: Essentials Workshop with MORE pyWars


You will never learn to program by staring at PowerPoint slides. This section continues the hands-on, lab-centric approach established at the beginning of the course. It covers data structures and more detailed programming concepts. Next we focus on invaluable tips and trick to make you a better Python programmer and to show you how to debug your code.

CPE/CMU Credits: 6


  • Lists
  • Loops
  • Tuples
  • Dictionaries
  • The Python Debugger
  • Coding Tips
  • Tricks and Shortcuts
  • System Arguments
  • ArgParser Module

SEC573.3: Defensive Python


Overview of SEC573.3 -- SEC573.5

NOTE: Most of this course is focused on expanding your Python skills, leveraging modules, and performing important operations used by all information security professionals. You will learn about file operations, log analysis, database operations, low-level network operations such as Raw sockets and packet parsing, high-level network operations such as HTTP and authentication, object-oriented coding, regular expressions, subprocess execution and automation and much more. All of these skills are common to every security profession and useful to everyone regardless of your discipline. Starting with this third section, the remainder of the course is broken down into three sections themed with defense, forensics, and offense.



In this section we take on the role of a network defender with more logs to examine than there is time in the day. Attackers have penetrated the network and you will have to analyze the logs and packet captures to find them. We will discuss how to analyze network logs and packets to discover where the attackers are coming from and what they are doing. We will build scripts to empower continuous monitoring and disrupt the attackers before they exfiltration your data. Forensicators and offensive security professional won't be left out because reading and writing files and parsing data is also an essential skill they will apply to their craft as well.

CPE/CMU Credits: 6


  • File Operations
  • Python Sets
  • Regular Expressions
  • Log Parsing
  • Data Analysis Tools and Techniques
  • Long-Tail/Short-Tail Analysis
  • Geolocation Acquisition
  • Blacklists and Whitelists
  • Packet Analysis
  • Packet Reassembly
  • Payload Extraction

SEC573.4: Forensics Python


In our forensics-themed section, we will assume the role of a forensics analyst who has to carve evidence from artifacts when no tool exists to do so. Even if you don't do forensics, you will find that the skills covered in this section are foundational to every security role. We will discuss the process required to carve binary images, find appropriate data of interest in them, and extract those data. Once you have the artifact isolated, there is more analysis to be done. You will learn how to extract metadata from image files. Then we will discuss techniques for finding artifacts in other locations such as SQL databases and interacting with web pages.

CPE/CMU Credits: 6


  • Acquiring Images from Disk
  • Memory and the Network
  • File Carving
  • The STRUCT module
  • Raw Network Sockets and Protocols
  • Image Forensics and PIL
  • SQL Queries
  • HTTP Communications with Python Built in Libraries
  • Web Communications with the Requests Module

SEC573.5: Offensive Python


During our offensively themed section we play the role of penetration testers whose normal tricks have failed. Their attempts to establish a foothold have been stopped by modern defenses. To bypass these defenses, you will build an agent to give you access to a remote system. Similar agents can be used for Incident response or systems administration, but our focus will be on offensive operations.

CPE/CMU Credits: 6


  • Network Socket Operations
  • Exception Handling
  • Process Execution
  • Blocking and Non-blocking Sockets
  • Using the Select Module for Asynchronous Operations
  • Python Objects
  • Argument Packing and Unpacking

SEC573.6: Capture the Flag


In this final section you will be placed on a team with other students. You will apply the skills you have mastered in a series of programming challenges. Participants will exercise the new skills and the code they have developed throughout the course in a series of challenges. You will solve programming challenges, exploit vulnerable systems, analyze packets, parse logs, and automate code execution on remote systems. Test your skills! Prove your might!

CPE/CMU Credits: 6

Who Should Attend

  • Security professionals who benefit from automating routine tasks so they can focus on what's most important
  • Forensics analysts who can no longer wait on someone else to develop a commercial tool to analyze artifacts
  • Network defenders who sift through mountains of logs and packets to find evil-doers in their networks
  • Penetration testers who are ready to advance from script kiddie to professional offensive computer operations operator
  • Security professionals who want to evolve from security tool consumer to security solution provider


A basic understanding of any programming or scripting language is highly recommended but not required for this class. SEC573 starts with the most basic fundamentals of Python programming. There is no aspect of programming or Python that must be understood before attending this course. The lab environment is self-paced and this allows students who have had some experience coding advance more quickly than those who have not. You are provided a Virtual Machine that gives you the ability to complete the labs that are in your course book after the live course or your OnDemand access has finished.

Note to Live Classroom Students

SEC573 contains more labs and exercises than even the most skilled programmer can complete in one week. Students who are brand new to the concepts should expect to complete about a third of the labs while in class and take the additional material with them in the Virtual Machine to continue their study and advance their skills. Students who already know some programming will complete a higher percentage of the exercises in class but will still take home additional material to continue learning. In the vast majority of cases, even those students who start the class with a good understanding of how to code in Python will leave with incomplete labs that they can continue to use to develop their skills. SEC573 will meet you where you are and quickly advance your skills. You will leave with new skills you can put to good use when you return to your workplace and with additional material to continue to develop your skills.

What You Will Receive

  • A USB containing a virtual machine filled with sample code and working examples
  • A copy of Violent Python: A Cookbook for Hackers, Forensic Analysts, Penetration Testers and Security Engineers, T.J. O'Connor's critically acclaimed book that shows you how to forge your own weapons using the Python programming language
  • MP3 audio files of the complete course lecture

This Course Will Prepare You To

  • Modify existing open source tools to customize them to meet the needs of your organization.
  • Manipulate log file formats to make them compatible with various log collectors.
  • Write new tools to analyze log files and network packets to identify attackers in your environment.
  • Develop tools that extract otherwise inaccessible forensics artifacts from computer systems of all types.
  • Automate the collection of intelligence information to augment your security from online resources.
  • Automate the extraction of signs of compromise and other forensics data from the Windows Registry and other databases.
  • Write a backdoor that uses exception handling, sockets, process execution, and encryption to provide you with your initial foothold in a target environment. The backdoor will include features such as a port scanner to find an open outbound port, techniques for evading antivirus software and network monitoring, and the ability to embed payload from tools such as Metasploit.

Hands-on Training

  • The Python Essentials Workshop labs: Variables, functions, modules, if/elif/else, for, while , list, dictionaries, sets, and more
  • pyWars labs: A self-paced lab environment that allows students to work through labs and exercise at their own pace. Challenges include reverse engineering malware, malware covert channels, cryptography essentials, advanced regular expressions, advanced network communications, and more.
  • Practical application labs: The application of coding concept is applied to build tools for defenders, forensicators, and penetration testers. The labs cover parsing log files to identify hackers, long-tail/short-tail analysis of logs, capturing and parsing network packets, carving forensics artifacts from binary data, retrieving SQL data, interacting with websites, process execution, exception handling, synchronous and asynchronous network communications, and more. The Python modules and concepts covered in these labs include File Operations, Python Sets, Regular Expressions, gzip, collections module,, Geolite, scapy,, struct, sockets, select, Python Objects, argument packing and unpacking, sqlite3 , urllib,urllib2, cookielib, requests, StringIO, and more.
  • Capture-the-Flag Challenge: Test your ability to apply your new tools and coding skills.

Contact the course provider: