How andreashappe/cochise works
Cochise is an autonomous Active Directory penetration-testing agent: a persistent Planner selects attack tasks, short-lived Executors run commands on an attacker VM and return findings, and shared Knowledge carries discoveries between tasks. It also records structured run logs and provides replay, tabular analysis, and graph-based analysis for benchmarking. Runtime relationships are supported by the README and sampled source; some analysis modules were not sampled, so their internal behavior is represented only where the source index or README supports it.
Main entry points: cochise.py Runtime CLI · common_analysis.py Run Log Parser · analyze_json_logs.py Log Analysis CLI · planner.py Planner
Components 21
Planning
- Runtime CLI
src/cochise/cli/cochise.py - Attack Scenario
src/cochise/templates/scenario.md - Planner
src/cochise/planner.py - LLM Interface
src/cochise/common.py
Task Execution
- Executor Factory
src/cochise/executor.py - Task Executor
src/cochise/executor.py - SSH Connection
src/cochise/ssh_connection.py
Shared State
- Knowledge Base
src/cochise/knowledge.py
Run Records
- Run Logger
src/cochise/logger.py - JSON Run Logs
logs
Run Analysis
- Replay CLI
src/cochise/cli/cochise_replay.py - Log Analysis CLI
src/cochise/cli/analyze_json_logs.py - Graph Analysis CLI
src/cochise/cli/analyze_json_graphs.py - Run Log Parser
src/cochise/analysis/common_analysis.py - Round Analysis
src/cochise/analysis/index_rounds.py - Round Token Analysis
src/cochise/analysis/index_rounds_and_tokens.py - Account Analysis
src/cochise/analysis/index_tokens_and_accounts.py - Token Analysis
src/cochise/analysis/show_tokens.py
Other components
- Operator
- LLM Provider
- Attacker VM
Connections 30
- Operator → Runtime CLI: starts run
README.md - Runtime CLI → Attack Scenario: loads scenario
src/cochise/cli/cochise.py - Runtime CLI → SSH Connection: configures SSH
src/cochise/cli/cochise.py - Runtime CLI → Executor Factory: creates factory
src/cochise/cli/cochise.py - Runtime CLI → Planner: starts planning
src/cochise/cli/cochise.py - Planner → LLM Interface: requests plans
README.md - Task Executor → LLM Interface: requests task calls
src/cochise/executor.py - LLM Interface → LLM Provider: sends LLM requests
src/cochise/common.py - Planner → Executor Factory: delegates tasks
README.md - Executor Factory → Task Executor: builds executor
src/cochise/executor.py - Task Executor → SSH Connection: invokes configured tools
README.md - SSH Connection → Attacker VM: executes commands
README.md - Planner → Knowledge Base: aggregates findings
src/cochise/planner.py - Task Executor → Knowledge Base: returns findings
src/cochise/executor.py - Runtime CLI → Run Logger: configures logging
src/cochise/cli/cochise.py - Run Logger → JSON Run Logs: writes events
src/cochise/logger.py - Operator → Replay CLI: replays run
README.md - Replay CLI → JSON Run Logs: reads run
README.md - Operator → Log Analysis CLI: analyzes runs
README.md - Log Analysis CLI → Round Analysis: dispatches analysis
src/cochise/cli/analyze_json_logs.py - Log Analysis CLI → Round Token Analysis: dispatches analysis
src/cochise/cli/analyze_json_logs.py - Log Analysis CLI → Account Analysis: dispatches analysis
src/cochise/cli/analyze_json_logs.py - Log Analysis CLI → Token Analysis: dispatches analysis
src/cochise/cli/analyze_json_logs.py - Round Analysis → Run Log Parser: parses run data
src/cochise/analysis/index_rounds.py - Round Token Analysis → Run Log Parser: parses run data
src/cochise/analysis/index_rounds_and_tokens.py - Account Analysis → Run Log Parser: parses run data
src/cochise/analysis/index_tokens_and_accounts.py - Token Analysis → Run Log Parser: parses run data
src/cochise/analysis/show_tokens.py - Operator → Graph Analysis CLI: graphs run metrics
README.md - Graph Analysis CLI → Run Log Parser: traverses run data
src/cochise/cli/analyze_json_graphs.py - Run Log Parser → JSON Run Logs: reads events
src/cochise/analysis/common_analysis.py