Skip to content
10 lessons
10Cybersecurity hands-on · Lesson 10 of 10 · lab

Using an AI agent safely in security work

An agent on your own machine can speed up recon and reports. Give it a written scope and keep your hand on the exploit button.

Roman Urdu: AI agent ko apni machine pe use kro, magar likhi hui scope do aur exploit khud approve kro.

Video transcript

An AI agent runs commands fast, and confidently. In security work, that is a risk, unless the scope is explicit and you approve anything intrusive.

Start with what an agent is good at. Summarising long scan output. Explaining a finding you do not understand yet. Keeping your notes in order, and drafting the report. All of that is reading and writing. None of it touches a target.

Before it does anything else, give it a scope file. It says, in writing, what is in scope: only the practice lab. What is off limits: everything else. And what it must ask you first: anything intrusive. The agent reads this file before every task.

Then keep yourself in the loop. The agent proposes a step. You read it. You approve it, or you say no. And check its claims against the raw output, because an agent can invent a finding that is not there.

So: explicit scope, and you approve. In the lab, you will run an agent inside your machine with a scope file it must follow, and have it summarise your scans. Only ever inside the practice lab, or systems you are allowed to test.

Video file (MP4, 1 min 19 s, 3.1 MB) · Captions (WebVTT)

Rules: Only test systems you own or have written permission to test. Everything in this track runs against practice targets inside your own machine. Scanning or attacking anyone else’s system without permission is a crime in most countries.

Goal

Run an AI coding agent inside your machine with a scope file it must follow, and have it summarise your scans.

Why it matters

Agents run commands fast and confidently. In security that is a risk unless the scope is explicit and you approve anything intrusive.

Your machine · learn-cyber · lab cyber-10

A terminal on your own cyber machine, right in this page. It keeps your files between lessons.

First time: make your course machine from any terminal (Mac, Linux and Windows 10+ all have ssh). Your ssh key is your login; a new key picks a handle and accepts the terms first.

$ ssh -t -p 2200 m.logicpacks.io new cyber --name learn-cyber

After that, come back to the same machine any time. Your files are still there:

$ ssh -t -p 2200 learn-cyber@m.logicpacks.io

To use the terminal in this page, sign this browser in once: run this and open the link it prints.

$ ssh -p 2200 m.logicpacks.io web

All your machines in the browser: logicpacks.io/m. A guest key gets one machine: if you already use it for something else, rm that one or link a free account (3 machines). How machines work, credits and terms: logicpacks.io/machines

Step by step

  1. Install an agent in your machine, for example Claude Code or OpenCode, and sign in with your own account.

    $ curl -fsSL https://claude.ai/install.sh | bash
    $ curl -fsSL https://opencode.ai/install | bash
    Diagram: a scope file lists what is in scope (the practice lab), what is off limits (everything else) and what needs asking first (anything intrusive). The agent proposes a step, and you approve it or say no.
    Give the agent a written scope, approve anything intrusive yourself, and check its claims.
  2. Write the rules it must follow in AGENTS.md (and CLAUDE.md for Claude Code), in your home folder.

    $ cd ~ && printf -- "# Scope\nOnly test: target.lab, dvwa.lab, juice.lab (127.66.0.10-12), all inside this machine.\nNever scan or contact anything else.\nAsk before running any exploit, brute force or sqlmap --dump.\nNever print or store real passwords; redact them in reports.\n" | tee AGENTS.md > CLAUDE.md
  3. Ask it for safe, useful work: "Summarise ~/scans/target.txt as a findings table" or "Review ~/reports/dvwa-sqli.md for missing steps to reproduce".

    $ claude

Check my work

Run this in your machine. It checks your work and prints PASS, or FAIL with a hint about what is missing.

$ lab check cyber-10

Saved in this browser. Use ← and → to move between lessons.