A terminal AI agent for Kali Linux and security research
The options for a terminal-based AI assistant on Kali Linux — general coding agents, MCP tool servers, and purpose-built harnesses — plus how to install one safely: approval modes, running in a VM or container, scope files, command logging and keeping credentials out of context.
· 8 min read

Kali Linux is where a lot of security work actually happens, and it lives in the terminal. The good news is that the terminal is exactly where AI coding agents have matured: an agent that can run commands, read output, edit files and drive tools fits Kali's workflow naturally. The question isn't whether a good terminal agent exists — several do — but which to pick and, more importantly, how to run one safely when it has a shell on a machine full of offensive tooling.
This guide covers the options, how to install a terminal agent on Kali, and the safe defaults that matter more than the choice of agent: approval modes, isolation, scope files, logging, and keeping credentials out of the model's context.
Everything an agent does on Kali is done under your authorization. Point it only at systems you own or are explicitly authorized to test. A shell-wielding agent can enumerate, scan and exploit in seconds, and it has no idea what's in scope unless you tell it — the entire discipline below is about making your authorization something the agent can't step outside.
The options
There are three shapes of terminal AI assistant for security work, and they're complementary more than competing.
General coding agents in the terminal. Claude Code, OpenAI's Codex CLI (open source, Apache-2.0), and open-source agents like Aider and OpenCode all run in a terminal, run commands, and work fine on Kali. They're excellent at the coding half of security work — writing a parser, a scanner, an exploit script. The catch is policy: mainstream hosted models follow their makers' usage policies and sometimes refuse offensive work, even when it's authorized. Codex CLI and the open agents can point at a local model (--oss, or any OpenAI-compatible endpoint), which sidesteps that if you run your own abliterated weights.
MCP tool servers. The Model Context Protocol lets any agent drive external tools. Servers like HexStrike AI (MIT, exposes 150+ security tools to an agent, as of 2026-11) and framework projects like PentestGPT (MIT, USENIX-published, as of 2026-11) layer security-specific tooling on top of whatever agent you use. These are tool layers, not models — their behaviour still depends on the policy of the model behind the client. They shine when you want an agent to drive the standard Kali arsenal through a structured interface.
Purpose-built security harnesses. A smaller category of agents are built specifically for security work, bundling uncensored models with security tooling. caveira is one (we make it); it's a terminal agent and desktop app whose backend serves uncensored, abliterated open-weight models, with security skills and a Docker box of tools. The trade-off is the mirror of the general agents': no refusals on legitimate offensive work, but open-weight models rather than frontier ones. The best-pentesting-tools comparison lays the categories side by side.
Installing a terminal agent on Kali
Kali is Debian-based, so installation is standard. The general pattern, whichever agent:
-
Node-based agents (Claude Code, Codex CLI) install via
npm/npx; Kali ships Node, or install it from NodeSource. Each has a one-line installer in its docs. -
Python agents (Aider, PentestGPT) install via
pipxto keep them isolated from the system Python Kali relies on:pipx install aider-chat. Usepipx, not a barepip installinto the system interpreter. -
Single-binary agents install with a shell one-liner. caveira, for example:
curl -fsSL https://caveira.app/install.sh | sh # installs `caveira` (and `cav`) into ~/.local/bin cd your/project && caveira # then /login to sign inThe script downloads the release built for your architecture (Linux arm64 or x86-64), checks it against the release checksums, and puts it in
~/.local/bin. (Read anycurl | shinstaller before you run it; this one is public.) -
MCP servers are configured in the agent's MCP config (
~/.caveira/mcp.json, Claude Code'smcpServersshape, or the equivalent), which starts the server with the session and offers its tools to the model.
A note on Node and Python: keep agent installs out of the system interpreters where you can (pipx, nvm, or a single binary), because Kali's tooling depends on the system packages and you don't want an agent's dependency pulling them around.
The safe defaults that matter more than the agent
The choice of agent matters less than how you run it. An agent with an unrestricted shell on Kali is a loaded tool. These defaults are what keep it pointed the right way.
1. Approval modes
Every serious terminal agent has a confirmation mode that makes it ask before running a command or editing a file. Use it, especially while you're learning an agent's behaviour:
- Claude Code has permission modes and an allowlist.
- Codex has sandboxed and approval modes.
- caveira runs unattended by default (it's built to be left with a task) but
--confirmturns on a prompt for every command and file change, with an "always allow this tool" option.
Start in the strictest mode. Relax it per-tool only once you trust what the agent does with a given command. The dangerous moment is an agent that runs nmap, sqlmap or ffuf against a host you didn't mean to touch — approval mode is what stops that before the packet leaves.
2. Run it in a VM or container
Don't give an agent a shell on your host. Kali is often already a VM; keep it that way, snapshot before a session, and revert after. For an extra layer, run the agent's commands in a container:
- Codex and Claude Code have sandbox/container execution options.
- caveira has a per-project bash sandbox (
workspaceconfines writes to the project;containerruns commands in Docker/Podman with only the project mounted) and an optional Docker "box" that runs tools inside a locked-down container (dropped capabilities, no host networking, only the project mounted).
Isolation does two jobs: it limits what a mistaken command can wreck, and it limits what untrusted input — a malicious binary you're analysing, a crafted HTTP response — can do if it turns the tables. Treat the target's output as hostile.
3. A scope file the agent must honour
Write the authorization down where the agent reads it — its project instructions (CLAUDE.md, AGENTS.md or CAVEIRA.md) — and keep a machine-checkable list beside it:
# scope.txt — the only targets in scope for this engagement
10.10.14.0/24
testlab.internal
In the instructions, spell it out in plain terms: the in-scope hosts and ranges, the explicitly out-of-scope ones, the forbidden actions (no DoS, no scanning where it's banned, no touching anything outside scope.txt), and the rate limits. Then make "is this target in scope.txt?" a step the agent takes before it sends traffic. The agent proposes a target; you confirm it's in scope; only then does a packet go out. The bug-bounty guide covers encoding scope in depth — the same discipline applies to any engagement.
4. Log every command it runs
You want a record of everything the agent did, for your own review and for the engagement report. Options, from simple to built-in:
- Run the whole session under
script:script -q -c caveira session.logcaptures the terminal. - Use
teeor shell history with timestamps for the commands you run yourself. - Prefer an agent whose transcript is itself a log. caveira saves every session under
~/.caveira/sessions/with the full record of each turn, and/shareproduces a redacted replay; most agents keep a session transcript you can archive.
A logged session is also how you learn what the agent actually does with your tools, which is how you decide what to allowlist.
5. Keep credentials out of the agent's context
This is the one people get wrong. Anything in the model's context can end up in a hosted request. So:
- Don't paste API keys, passwords, or client secrets into the chat. Reference them by environment variable and let the command read them, not the model:
curl -H "Authorization: Bearer $TOKEN"keeps$TOKENout of the conversation. - Keep secrets out of files the agent reads. A
.envwith live credentials in the working directory can be read into context. Use a secrets manager, or keep them outside the project. - Be careful what tool output you let it summarise. Command output with tokens or hashes in it goes into context the moment the agent reads it.
- Prefer local models when the data truly can't leave the machine. A local open-weight model via Ollama or a local endpoint keeps everything on the box; caveira can also point at a local model server (localhost only) instead of its hosted backend, and those requests never leave the machine.
Which to choose
- Your work passes policy and you want the best coding model: a general agent (Claude Code, Codex CLI), with security-verification access where you qualify.
- You want to drive the full Kali arsenal through an agent: add an MCP tool server (HexStrike, PentestGPT) to whichever agent you like.
- Legitimate offensive work keeps getting refused, and you want it in the terminal without an application: a purpose-built uncensored harness like caveira, or a general open-source agent pointed at a local abliterated model.
caveira fits the last case: it's a terminal client (and desktop app) whose backend serves uncensored, abliterated open-weight models, so it doesn't refuse legitimate security work; it ships security skills (reverse engineering, binary exploitation, web-app testing and more), the rea MCP server, the Docker box of tools, and /lab practice targets (Juice Shop, DVWA, WebGoat); and it speaks MCP, so HexStrike or any server you already use plugs in. There's a free plan to try it on real work, with paid plans from $20/month (pricing, as of 2026-11). Whatever you run, the safe defaults above are what make a terminal agent on Kali an asset instead of a liability.