Lion Cipher Lab

Automate a boring task with Python

Why it matters

Reading a log by eye to answer a simple question — how many failed logins were there, how many times did this error show up — is one of the most common, most tedious, and most error-prone chores in security work. A human skimming a thousand lines miscounts; a script counts the same way every time in a fraction of a second. This lab teaches the four moves that sit under almost every automation script you will ever meet: a variable to hold a value, opening a file, a loop to walk through it, and an if to make a decision. Learn those once and you can point them at anything — logs, exports,…

What you'll learn

Steps in this lab

  1. The idea: let the computer read the log so you don't have to
  2. Confirm Python is on your machine - or install it
  3. Two ways to run Python - a live prompt, and a saved script
  4. Make a small log to practise on
  5. Write the script - an event counter in eight lines
  6. Run it, and read every line
  7. Turn it into a reusable command
  8. What you just proved - and where to point it next

Open the full interactive lab →