Python programming for Security professionals

Live Classroom
Duration: 4 days
Live Virtual Classroom
Duration: 4 days
Pattern figure


The Python programming for security professionals is a course targeted towards experienced security professionals introducing participants to beginner level concepts such as writing and running Python scripts to advanced level features such as file operations, regular expressions and binary data. The course involves hands-on exercises as well as engaging lectures to ensure participants get a thorough understanding of the concepts learnt in the course. The course enables participants to be able to use Python functionality for security-related tasks like log manipulation and forensics. The course also explores secure coding practices to perform security reviews and auditing Python applications.

What You'll Learn

  • Create working Python scripts following best practices
  • Use Python data types appropriately
  • Read and write files with both text and binary data
  • Search and replace text with regular expressions
  • Get familiar with the standard library and its work-saving modules
  • Use lesser-known but powerful Python data types
  • Create ‘real-world’, professional Python applications
  • Work with dates, times and calendars
  • Learn to use collections like lists, dictionaries and sets
  • Understand Pythonic features like comprehensions and iterators
  • Write robust code using exception handling
  • Working with RESTful services


  • What is python?
  • 1 — An overview of Python
  • What is python?
  • Python Timeline
  • Advantages/Disadvantages of Python
  • Getting help with pydoc

  • Starting Python
  • Using the interpreter
  • Running a Python script
  • Python scripts on Unix/Windows
  • Editors and IDEs

  • Using variables
  • Builtin functions
  • Strings
  • Numbers
  • Converting among types
  • Writing to the screen
  • Command line parameters

  • About flow control
  • White space
  • Conditional expressions
  • Relational and Boolean operators
  • While loops
  • Alternate loop exits

  • About sequences
  • Lists and list methods
  • Tuples
  • Indexing and slicing
  • Iterating through a sequence
  • Sequence functions, keywords, and operators
  • List comprehensions
  • Generator Expressions
  • Nested sequences

  • File overview
  • Opening a text file
  • Reading a text file
  • Writing to a text file
  • Reading and writing raw (binary) data
  • Converting binary data with struct

  • About dictionaries
  • Creating dictionaries
  • Iterating through a dictionary
  • About sets
  • Creating sets
  • Working with sets
    • Defining functions
    • Parameters
    • Global and local scope
    • Nested functions

    • The sorted() function
    • Alternate keys
    • Lambda functions
    • Sorting collections

    • Syntax errors
    • Exceptions
    • Using try/catch/else/finally
    • Handling multiple exceptions
    • Ignoring exceptions

    • The import statement
    • Module search path
    • Creating modules and Using packages
    • Function and Module aliases

    • About o-o programming
    • Defining classes
    • Constructors
    • Methods
    • Instance data
    • Properties
    • Class methods and data

    • RE syntax overview
    • RE Objects
    • Searching and matching
    • Compilation flags
    • Groups and special groups
    • Replacing text
    • Splitting strings

    • The sys module
    • Launching external programs
    • The string module
    • Reading CSV data

    • Working with dates and times
    • Translating timestamps
    • Parsing dates from text

    • Paths, directories, and filenames
    • Checking for existence
    • Permissions and other file attributes
    • Walking directory trees
    • Creating filters with fileinput
    • Security and File Access

    • Grabbing web content
    • Detecting Malformed Input

      • Parsing command-line options
      • Getting help with pydoc
      • Safely handling untrusted data
      • Managing eval() permissions
      • Potential insecure packages
      • Embedding code snippets in Python
      • Embedding authentication data in Python
      • Potentially dangerous operations:
        • File access
        • Operating system access
        • Calls to external services
        • Called to external data sources
      • Static analysis tools such as Bandit

      • Raw log file manipulation
      • Fail2Ban
      • Customizing Fail2Ban with Python

      • SQL-Injection Detection
      • ModSecurity CRS filtering

      Packet Sniffing in Python

      • Security Logging and Analytics
      • Attack Detection and Defense
      • Python and Spark High-Level Overview

      • What is Flask?
      • Developing a Flask Web service
      • Mapping resources using URLs
      • Mapping resources using HTTP
      • Negotiating data content
      Ripple wave

      Who should attend

      The course is highly recommended for –
      • Security analysts
      • Web site administrators
      • System administrators
      • Security engineers
      • Other security professionals


      Participants need to have basic programming experience as well as basic development experience in any programming language. Along with this, participants also need to have working, user-level knowledge of Unix/Linux, Mac or Windows.

      Interested in this Course?

        Ready to recode your DNA for GenAI?
        Discover how Cognixia can help.

        Get in Touch
        Pattern figure
        Ripple wave