Lion Cipher Lab
Automate a boring task with Python
- Cyber / Security Engineer
- Beginner
- ~30 min
- Free · no account required
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
- Python basics
- reading a file line by line
- variables
- loops
- if-statements
- command-line arguments
- counting events in a log
- turning a script into a reusable command
Steps in this lab
- The idea: let the computer read the log so you don't have to
- Confirm Python is on your machine - or install it
- Two ways to run Python - a live prompt, and a saved script
- Make a small log to practise on
- Write the script - an event counter in eight lines
- Run it, and read every line
- Turn it into a reusable command
- What you just proved - and where to point it next