# Final Pentest Report Format

**Outputs**: `processed/intermediate-reports/pentest-final-report.md` → `report/Penetration-Test-Report.docx` (+ optional PDF)

## Generation Commands

**DOCX** (required):
```bash
pandoc processed/intermediate-reports/pentest-final-report.md \
    -o "report/Penetration-Test-Report.docx" \
    --toc --toc-depth=2 --number-sections --highlight-style=tango \
    --metadata title="Penetration Test Report" \
    --metadata subtitle="{Target} Security Assessment" \
    --metadata date="$(date '+%B %Y')" --metadata version="1.0"
```

**PDF** (optional, requires LaTeX):
```bash
pandoc processed/intermediate-reports/pentest-final-report.md \
    -o "report/Penetration-Test-Report.pdf" --pdf-engine=xelatex \
    --toc --toc-depth=2 --number-sections \
    -V geometry:margin=1in -V fontsize=11pt -V colorlinks=true \
    --metadata title="Penetration Test Report" \
    --metadata subtitle="{Target} Security Assessment" \
    --metadata date="$(date '+%B %Y')" --metadata version="1.0"
```

## Styling (Pandoc Auto-Applied)

**Typography**: H1 16pt dark blue (#1F4E78), H2 14pt medium blue (#2E75B5), H3 12pt dark gray, Body 11pt
**Colors**: Critical #C00000, High #ED7D31, Medium #FFC000, Low #70AD47, Code #F5F5F5, Tables #D9E2F3
**Page Breaks**: Add `\newpage` before Executive Summary, Findings, Attack Surface, Testing Coverage, Risk Summary, Remediation, Referenced Files

## Report Structure Template

```markdown
# Penetration Test Report: {Target}

**Engagement**: {name} | **Date**: {start} to {end} | **Scope**: {URLs/domains}

\newpage

## Executive Summary

{2-3 paragraphs: what was tested, what was found, overall risk assessment}

**Key Findings**:
- {Critical finding with business impact}
- {High finding with business impact}

**Overall Risk**: {Critical/High/Medium/Low}

\newpage

## Findings

### 1. {Title} 🔴 CRITICAL

- **Severity**: Critical | **CVSS**: 9.8 | **CWE-XXX**
- **Location**: `{endpoint}`
- **Impact**: {Business impact, compliance violations, financial risk}
- **Details**: {Technical explanation}
- **Proof of Concept**:
  ```
  {Exploit code/steps}
  ```
- **Remediation**: {Fix} | **Effort**: {estimate}
- **Evidence**: `appendix/finding-001/`

### 2. {Title} 🟠 HIGH

- **Severity**: High | **CVSS**: 7.5 | **CWE-XXX**
- **Location**: `{endpoint}`
- **Impact**: {Brief impact}
- **Remediation**: {Fix} | **Effort**: {estimate}
- **Evidence**: `appendix/finding-002/`

### 3. {Title} 🟡 MEDIUM

- **Severity**: Medium | **CVSS**: 5.0 | **CWE-XXX**
- **Location**: `{endpoint}`
- **Impact**: {Brief impact}
- **Remediation**: {Fix} | **Effort**: {estimate}
- **Evidence**: `appendix/finding-003/`

### 4. {Title} 🟢 LOW

- **Severity**: Low | **CVSS**: 3.0 | **CWE-XXX**
- **Location**: `{endpoint}`
- **Impact**: {Brief impact}
- **Remediation**: {Fix} | **Effort**: {estimate}
- **Evidence**: `appendix/finding-004/`

\newpage

## Attack Surface Summary

**Assets**: Domains: {n} subdomains | Web Apps: {n} endpoints | APIs: {n} REST/GraphQL | Network: {n} ports | Cloud: {provider}

**Technology Stack**:
| Component | Technology | Version | Vulnerable |
|-----------|------------|---------|------------|
| Frontend  | {tech}     | {ver}   | {Yes/No}   |
| Backend   | {tech}     | {ver}   | {Yes/No}   |

**Exposure**: Public services, auth endpoints, file upload points, API docs

\newpage

## Testing Coverage

**Tested**: ✅ Injection, Auth, API, File Upload, Business Logic, Network, Cloud | ❌ {Out of scope}
**Stats**: {n} endpoints, {n} parameters, {n} exploits

\newpage

## Risk Summary

| Severity | Count | % |
|----------|-------|---|
| Critical | {n}   | {%}|
| High     | {n}   | {%}|
| Medium   | {n}   | {%}|
| Low      | {n}   | {%}|

**By Category**: Injection: {n}, Auth: {n}, API: {n}, Network: {n}, Cloud: {n}

\newpage

## Remediation Roadmap

**Phase 1 - Immediate (Week 1)**: {Critical findings} | **Effort**: {hrs} | **Cost**: ${amount}
**Phase 2 - High Priority (Weeks 2-3)**: {High findings} | **Effort**: {hrs} | **Cost**: ${amount}
**Phase 3 - Medium (Month 2)**: {Medium findings} | **Effort**: {hrs} | **Cost**: ${amount}
**Phase 4 - Low (Ongoing)**: {Low findings} | **Effort**: {hrs} | **Cost**: ${amount}

**Total**: {timeline} weeks | ${total cost}

\newpage

## Referenced Files

**Evidence**: `appendix/finding-{id}/` (screenshots, HTTP logs, PoC code)
**Reconnaissance**: `appendix/reconnaissance-summary.json`
**Working Files**: `../processed/` (activity logs, raw findings, test frameworks)

## Appendices

**A.** Detailed Findings: `appendix/{finding-id}/`
**B.** Reconnaissance: `appendix/reconnaissance-summary.json`
**C.** Methodology: PTES, OWASP WSTG, MITRE ATT&CK
**D.** Working Files: `../processed/`

---

**Generated**: {timestamp} | **By**: Claude Code Pentester
```

## JSON Export

```json
{
  "engagement": {"name": "{name}", "target": "{target}", "status": "complete"},
  "findings": [{"id": "001", "title": "{title}", "severity": "critical", "cvss": 9.8}],
  "statistics": {"findings": {"critical": {n}, "high": {n}, "medium": {n}, "low": {n}}}
}
```

## Rules

- **Structure**: Critical → High → Medium → Low priority
- **Focus**: Business impact first, technical details in appendices
- **Evidence**: Every finding links to `appendix/finding-{id}/`
- **Deliverables**: `report/Penetration-Test-Report.docx` (required), `.pdf` (optional), `.json`, `README.md`, `appendix/`
- **Clean output**: NO intermediate files in `report/` - all working files go to `../processed/`
