Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:0xSteph Pentest ai agents Handoff Report Generator

From Leeroopedia
Knowledge Sources
Domains Security, Reporting, CLI
Last Updated 2026-10-22 12:00 GMT

Overview

Concrete script for generating cross-session Markdown handoff reports from SQLite engagement data provided by the pentest-ai-agents toolkit.

Description

The handoff.sh script produces a structured Markdown summary of the current engagement state, designed for cross-session continuity. When an operator closes one session and another picks up the engagement, this report gives a complete snapshot: engagement summary, hosts, services, vulnerabilities grouped by severity, credentials, attack chains, recent activity log, and auto-generated suggested next steps.

It sources `db/lib/common.sh` for database access and uses `require_engagement()` to identify the active engagement from the `PENTEST_AI_ENGAGEMENT` environment variable. The script takes no CLI arguments and writes all output to stdout.

Usage

  • End of session: Run `handoff.sh` at the end of a testing session to generate a handoff report for the next operator or session.
  • Progress check: Run mid-engagement to get a structured summary of current findings.
  • Report scaffolding: Use the output as a starting point for the final engagement report.

Code Reference

Source Location

Signature

#!/usr/bin/env bash
# Standalone script - no arguments
# Uses PENTEST_AI_ENGAGEMENT env var for active engagement

# Internal helpers:
section(title: str)   # Prints "## {title}" header
row(text: str)        # Prints a row (used in tables)

# Output sections (all to stdout):
# 1. Engagement Summary (client, type, status, scope, started)
# 2. Hosts (IP, hostname, OS, role, status)
# 3. Services (host, port, protocol, service, version)
# 4. Vulnerabilities (grouped by severity: critical, high, medium, low, info)
# 5. Credentials (username, domain, type, access, source, host)
# 6. Attack Chains (name, score, status, steps, MITRE IDs)
# 7. Recent Activity (last 30 session log entries)
# 8. Suggested Next Steps (auto-generated from unconfirmed vulns, untested creds, incomplete chains)

Import

# Invoke directly (no arguments needed):
handoff.sh > handoff_report.md

# Or pipe to file:
handoff.sh | tee handoff_$(date +%Y%m%d).md

I/O Contract

Inputs

Name Type Required Description
PENTEST_AI_ENGAGEMENT env var Yes Active engagement ID
PENTEST_AI_DB env var No Database path override

Outputs

Name Type Description
Markdown report stdout Full engagement handoff report in Markdown format

Usage Examples

Generate a Handoff Report

# Set active engagement
export PENTEST_AI_ENGAGEMENT="acme-2026-q4"

# Generate and save the handoff report
handoff.sh > handoff_acme_2026q4.md

# Display in terminal
handoff.sh

Auto-Generated Next Steps

# The script automatically generates suggested next steps based on engagement state:
# - Unconfirmed vulnerabilities → "Validate N unconfirmed vulnerabilities (use poc-validator)"
# - Untested credentials → "Test N untested credentials (use credential-tester)"
# - Incomplete chains → "Complete N attack chains (use exploit-chainer)"
# - All clean → "All findings validated. Ready for report generation."

Related Pages

Implements Principles

Requires Environment

Related Implementations

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment