Metadata-Version: 2.4
Name: nhi-audit
Version: 0.1.3
Summary: Open-source auditor for Non-Human Identities and AI Agent attack surfaces in cloud environments
Author-email: Abhiram Lanka <lankaabhiram16@gmail.com>
License: MIT
Project-URL: Homepage, https://agentsentry.tool
Project-URL: Repository, https://github.com/Abhiram-ops/agent-sentry
Project-URL: Bug Tracker, https://github.com/Abhiram-ops/agent-sentry/issues
Project-URL: Documentation, https://agentsentry.tool/docs
Project-URL: Buy Pro, https://sentryagent.gumroad.com/l/eawugx
Keywords: security,cloud,iam,ai-agents,non-human-identity,attack-graph,nhi
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Developers
Classifier: Topic :: Security
Classifier: Topic :: System :: Systems Administration
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: networkx>=3.2
Requires-Dist: pyvis>=0.3
Requires-Dist: click>=8.1
Requires-Dist: rich>=13.7
Requires-Dist: jinja2>=3.1
Requires-Dist: httpx>=0.27
Requires-Dist: pydantic>=2.6
Requires-Dist: python-dateutil>=2.9
Provides-Extra: aws
Requires-Dist: boto3>=1.34; extra == "aws"
Provides-Extra: azure
Requires-Dist: azure-identity>=1.16; extra == "azure"
Requires-Dist: azure-mgmt-authorization>=4.0; extra == "azure"
Requires-Dist: azure-mgmt-resource>=23.0; extra == "azure"
Provides-Extra: gcp
Requires-Dist: google-auth>=2.28; extra == "gcp"
Requires-Dist: google-api-python-client>=2.120; extra == "gcp"
Provides-Extra: github
Requires-Dist: requests>=2.31; extra == "github"
Provides-Extra: k8s
Requires-Dist: kubernetes>=29.0; extra == "k8s"
Provides-Extra: all
Requires-Dist: nhi-audit[aws]; extra == "all"
Requires-Dist: nhi-audit[azure]; extra == "all"
Requires-Dist: nhi-audit[gcp]; extra == "all"
Requires-Dist: nhi-audit[github]; extra == "all"
Requires-Dist: nhi-audit[k8s]; extra == "all"
Provides-Extra: dashboard
Requires-Dist: streamlit>=1.32; extra == "dashboard"
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: mypy; extra == "dev"

# AgentSentry 🛡️

![CI](https://github.com/Abhiram-ops/agent-sentry/actions/workflows/ci.yml/badge.svg)
[![PyPI](https://img.shields.io/pypi/v/nhi-audit?label=PyPI&color=00cc6a)](https://pypi.org/project/nhi-audit/)
[![PyPI Downloads](https://img.shields.io/pypi/dm/nhi-audit?color=00cc6a)](https://pypi.org/project/nhi-audit/)
![Python](https://img.shields.io/badge/python-3.10%2B-blue)
![License](https://img.shields.io/badge/license-MIT-green)
[![Website](https://img.shields.io/badge/website-agentsentry.tool-brightgreen)](https://agentsentry.tool)

**Open-source auditor for Non-Human Identities and AI Agent attack surfaces in cloud environments.**

> *"45 machine identities for every 1 human. Almost none of them are governed."*

AgentSentry discovers every IAM role, API key, service account, and AI agent in your environment, builds an attack graph of their access relationships, and scores the blast radius if any identity is compromised — including a novel **AI-Amplification Factor** that quantifies how autonomous AI agents multiply attack surface.

---

## Quick start

```bash
pip install nhi-audit
agentsentry scan mock          # demo — no credentials needed
agentsentry scan aws           # requires: aws configure
agentsentry scan github --org myorg
```

---

## Editions

| Feature | Community (free) | Pro ($49 one-time) |
|---|---|---|
| AWS / Azure / GCP / GitHub / K8s scanners | ✅ | ✅ |
| LangChain / CrewAI / AutoGen static analyzer | ✅ | ✅ |
| P×R×E×A risk scoring | ✅ | ✅ |
| MITRE ATT&CK mapping | ✅ | ✅ |
| Blast radius analysis | ✅ | ✅ |
| CLI — local, no accounts needed | ✅ | ✅ |
| MIT license | ✅ | ✅ |
| `--visualize` interactive HTML attack graph | ❌ | ✅ |
| `--enrich` CISA KEV threat intelligence | ❌ | ✅ |
| `--json` machine-readable output | ❌ | ✅ |
| `interactive` guided multi-provider scan | ❌ | ✅ |
| Lifetime license · no subscription | — | ✅ |
| Priority support | — | ✅ |

**[Buy Pro — $49 one-time →](https://sentryagent.gumroad.com/l/eawugx)**

After purchase you'll receive a key by email. Activate it with:

```bash
agentsentry activate AS-XXXX-XXXX-XXXX-XXXX
agentsentry license   # verify activation
```

Validation is fully offline — HMAC-SHA256 embedded in the key, no server call required after activation.

---

## Why AgentSentry?

Modern enterprises have a critical blind spot: **Non-Human Identities (NHIs)**. While security teams focus on human user access, machine identities — CI/CD service accounts, AI agents, API keys, Lambda execution roles — operate with minimal governance, often with excessive permissions, and almost no rotation discipline.

The risk compounds when **AI agents** enter the picture. A compromised LangChain agent with `delete_record` and `send_email` tools isn't just a leaked credential — it's an autonomous actor with tools that can cause cascading damage. No existing NHI security framework accounts for this.

AgentSentry addresses both problems.

---

## Example output

```
⬡  AGENTSENTRY  v0.1.3  ·  NHI & AI Agent Risk Scanner  ·  MIT · free forever

  4 identities found  ·  2 critical  ·  1 high  ·  1 AI agents

  ◉  langchain-crm-agent          ai_agent     ● CRITICAL   150.0    2
  ◉  ml-pipeline-executor         iam_role     ● CRITICAL   112.5    3
  ◉  github-actions-prod-deploy   github_key   ● CRITICAL    90.0    2
  ◎  legacy-reporting-service-key iam_user_key ● HIGH        52.5    2

⚠  langchain-crm-agent — Fully Autonomous AI Agent With Irreversible Tools
   This agent has FULLY_AUTONOMOUS execution with delete_record, send_email.
   AI-Amplification Factor: 10.0x
   Remediation: Implement human-in-the-loop approval for all irreversible tools.
   MITRE: T1651, T1059
```

---

## The Scoring Model

```
NHI Risk Score = P × R × E × A

P = Privilege Score      (1–10)  How powerful are the permissions?
R = Reachability Score   (1–3)   How accessible is this identity to attackers?
E = Exposure Score       (1–5)   How poor is the credential lifecycle?
A = AI-Amplification     (1–60)  How much does agent autonomy multiply blast radius?

Score ≥ 100 → CRITICAL
Score ≥ 50  → HIGH
Score ≥ 20  → MEDIUM
Score < 20  → LOW
```

The **AI-Amplification Factor (A)** is the novel contribution of this project. No existing NHI risk framework accounts for how autonomous AI agents compound the impact of a compromised machine identity.

---

## Providers

| Provider | Install | Requirements |
|---|---|---|
| `mock` | (built-in) | None — demo data |
| `local` | (built-in) | Scans local env vars, SSH keys, .env files |
| `aws` | `pip install nhi-audit[aws]` | `aws configure` |
| `azure` | `pip install nhi-audit[azure]` | `az login` |
| `gcp` | `pip install nhi-audit[gcp]` | `gcloud auth application-default login` |
| `github` | `pip install nhi-audit[github]` | `GITHUB_TOKEN` env var |
| `k8s` | `pip install nhi-audit[k8s]` | `kubectl` configured |
| `agents` | (built-in) | Scans Python code in `--path` |

Install all providers at once: `pip install "nhi-audit[all]"`

---

## Commands

```bash
agentsentry scan <target> [options]   # scan an environment
agentsentry blast <identity-name>     # show blast radius for one NHI
agentsentry providers                 # list ready/missing providers
agentsentry permissions <provider>    # check IAM permissions needed

# Pro
agentsentry interactive               # guided multi-provider scan [Pro]
agentsentry activate <key>            # activate Pro license
agentsentry license                   # show license status
```

**Pro flags for `scan`:**
- `--visualize`  generate interactive HTML attack graph
- `--enrich`     correlate findings with CISA KEV threat feed
- `--json`       output full scan result as JSON

---

## Architecture

```
agentsentry/
├── core/
│   ├── models.py      # Data models (NonHumanIdentity, Resource, Finding)
│   ├── scorer.py      # Risk scoring engine — P × R × E × A
│   └── graph.py       # NHI Attack Graph (NetworkX + Pyvis)
├── scanners/
│   ├── mock.py        # Demo environment — no credentials needed
│   ├── aws.py         # AWS IAM scanner
│   └── langchain_scanner.py  # AI agent static analyzer
├── enrichment/
│   └── cisa_kev.py    # CISA KEV feed correlation [Pro]
├── providers/         # Cloud provider wrappers
└── license.py         # Offline HMAC license validation
```

---

## Changelog

### v0.1.3
- **Pro license tier** — `agentsentry activate <key>` command
- `agentsentry license` command to check activation status
- `--visualize`, `--enrich`, `--json`, and `interactive` are now Pro features
- Banner shows `⚡ PRO` when a valid license is active
- Offline HMAC-SHA256 key validation (no server call after activation)

### v0.1.2
- LangChain / CrewAI static analyzer scanner
- Interactive multi-provider scan mode
- CISA KEV threat intelligence enrichment
- Full AWS IAM, Azure, GCP, GitHub, K8s provider implementations

### v0.1.1
- Interactive HTML attack graph (Pyvis)
- Blast radius analysis
- MITRE ATT&CK mapping

### v0.1.0
- Initial release: mock scanner, P×R×E×A scoring, Rich CLI output

---

## Contributing

Open-source core, forever. Issues and PRs welcome — especially:
- Cloud provider scanner implementations
- Additional AI agent framework support (AutoGen, Semantic Kernel, Dify)
- Threat intelligence enrichment integrations

---

## License

MIT — use it, fork it, build on it.

---

*Built by Abhiram Lanka · [agentsentry.tool](https://agentsentry.tool)*
