Lion Cipher Lab

Classify network traffic with a decision tree

Why it matters

Every network generates a flood of connection records -- who talked to whom, for how long, how many bytes, how many failed logins -- and buried in that flood are the few flows that are an attack. Intrusion detection is the job of separating the two, and it is a textbook classification problem: given the measurements of one flow, output benign or malicious. Machine learning can learn that boundary from labeled examples, which is why it now sits inside real detection tooling. But in security you cannot treat a detector as a magic box that emits verdicts. When your model flags a flow and you cut…

What you'll learn

Steps in this lab

  1. The problem: benign flow or malicious flow
  2. The words you need: dataset, feature, label, and why a tree
  3. Install scikit-learn, pandas, and matplotlib
  4. Get a labeled dataset (generate one so you are never blocked)
  5. Load the data and split it into train and test
  6. Train the decision tree
  7. Evaluate like a defender: precision, recall, confusion matrix
  8. Visualize the tree: read the detection logic as a flowchart
  9. The honest limits: a teaching model, not a production IDS
  10. What you can now do that most people can't

Open the full interactive lab →