#!/usr/bin/env python3 """Print the NetKingdom security tools index (tools/security-tools.json) for people and agents. Offline and read-only. `--json` prints the index unchanged for machine use. """ from __future__ import annotations import argparse import json import pathlib import sys INDEX = pathlib.Path(__file__).resolve().parent / "security-tools.json" def load() -> dict: return json.loads(INDEX.read_text(encoding="utf-8")) def main(argv: list[str] | None = None) -> int: parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) parser.add_argument("--json", action="store_true") args = parser.parse_args(argv) index = load() if args.json: print(json.dumps(index, indent=2)) return 0 print("NetKingdom security tools. Tool availability is not permission (SECURITY-COMPANION.md section 7).\n") print("Start here:") for item in index["orientation"]: target = item.get("command") or item.get("where") print(f" - {item['what']}: {target}") print("\nTools (agent may run: " + ", ".join(index["agent_may_run_values"]) + "):") for tool in index["tools"]: print(f"\n {tool['id']} [agent may run: {tool['agent_may_run']}]") print(f" answers: {tool['answers']}") print(f" run: {tool['run']}") print(f" test: {tool['test']}") print(f" rules: {tool['standard']}") if tool.get("note"): print(f" note: {tool['note']}") return 0 if __name__ == "__main__": sys.exit(main())