Lion Cipher Lab

Catch new open ports: a Python Nmap-diff surface monitor

Why it matters

A single nmap scan is a photograph, and a photograph of a busy host is noise — a wall of open ports you skim once and forget. The thing that actually matters for defence is the CHANGE. A port that is open today and was not open yesterday is, at best, new attack surface nobody told you about (a debug server left running, a container that published a port, a teammate's quick test that never got torn down) and, at worst, the visible tell of a compromise — a backdoor, a reverse shell's listener, a crypto-miner's control port. The signal is the diff, not the scan. But nobody re-runs nmap against…

What you'll learn

Steps in this lab

  1. The idea in one sentence: a scan is noise, the diff is the signal
  2. Authorised targets ONLY — this is the rule, not a footnote
  3. Scan into machine-readable XML — never grep the human output
  4. Write the differ — standard library only, no python-nmap
  5. Run it twice — the first run is the baseline, the second is the diff
  6. Handle the messiness a naive `diff` never survives
  7. Why -sV matters: a service swap on an unchanged port is invisible to a port-only diff
  8. Schedule it and turn the exit code into an alert
  9. When this is enough — and when to reach for a real surface tool instead

Open the full interactive lab →