langchain-darkmoon
LangChain tools for Darkmoon, the local, privacy first autonomous AI penetration testing engine. Give a LangChain agent the ability to trigger a Darkmoon pentest against a target you are authorised to assess, pull back the findings, and review the fix pull requests Darkmoon prepares, over your own self-hosted Darkmoon Dashboard API.
Darkmoon runs and validates security tests. It does not, and these tools do not, guarantee that a system is secure. Findings can include false positives and must be reviewed by a qualified human. Only run assessments against systems you own or have explicit written authorisation to test. These tools never merge a pull request; every fix is left for a person to review and merge.
Install
pip install langchain-darkmoon
(Until it is on PyPI, install from source: pip install . in a clone of this repository.)
Tools
| Tool | Purpose |
|---|---|
DarkmoonRunPentestTool |
Start a campaign against an authorised target; optionally wait and return findings and severity stats. |
DarkmoonGetFindingsTool |
Return the vulnerabilities and aggregated stats for a campaign id. |
DarkmoonListCampaignsTool |
List the campaigns visible to the authenticated dashboard user. |
DarkmoonListPullRequestsTool |
List the fix pull requests Darkmoon prepared (read only), optionally scoped and filtered by state. |
DarkmoonToolkit bundles all four with one shared connection.
Connection
Darkmoon is self hosted, so you point the tools at your own Darkmoon Dashboard API (the FastAPI service shipped with Darkmoon, typically on port 8000). There is no public endpoint. The tools log in with POST /api/v1/auth/login to obtain a short lived JWT.
from langchain_darkmoon import DarkmoonToolkit
toolkit = DarkmoonToolkit(
base_url="http://darkmoon.internal:8000",
username="analyst",
password="...", # or wire from your secret store
)
tools = toolkit.get_tools()
# Bind to any tool-calling LLM / agent:
# from langchain.agents import create_agent
# agent = create_agent(model, tools)
Or use a single tool directly:
from langchain_darkmoon import DarkmoonRunPentestTool
pentest = DarkmoonRunPentestTool(
base_url="http://darkmoon.internal:8000", username="analyst", password="..."
)
result = pentest.invoke({"target": "https://staging.example.test", "wait_for_completion": True})
print(result["total"], "findings")
Remediation and secrets (Pro)
Remediation is optional and is a paid Darkmoon Pro feature. The open source Darkmoon focuses on finding, proving and reporting findings locally; the feature that prepares fix pull requests is Pro. When enabled it needs a credential reference, an opaque id of a credential stored in Darkmoon's encrypted vault (created in the dashboard), not a raw token. Raw source control secrets never travel through these tools, and the remediation agent only ever prepares a pull request for human review; it never merges. DarkmoonListPullRequestsTool can read those pull requests through the API regardless of edition.
Privacy
Darkmoon keeps assessment work on your own infrastructure and applies a privacy gateway so the language model works over placeholders rather than your real hosts, IPs and credentials. These tools send data only to the base URL you configure.
Development
pip install -e ".[test]"
pytest -q
The API client (langchain_darkmoon/client.py) is dependency free and transport injected, so its logic and the tool wrappers are unit tested without a network (mock transport). A full end to end run additionally requires a running Darkmoon instance pointed at an authorised target.
Related integrations
Darkmoon also ships maintained integrations for n8n, Activepieces, Dify and GitHub Actions.
License
MIT, see LICENSE. Not affiliated with LangChain; "LangChain" is a trademark of its respective owner.
Release files for langchain-darkmoon 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| langchain_darkmoon-0.1.0.tar.gz | 15.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_darkmoon-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.8 kB
Release files / langchain_darkmoon-0.1.0.tar.gz
| Download URL | langchain_darkmoon-0.1.0.tar.gz |
|---|---|
| Size | 15.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b22d1fb246df4caa7621c6381403be795d4cd6d2f8b98e83d88a4f7e24490a16
|
|
BLAKE2b-256 checksum How to use checksums |
7c9313c9588115e5630904d0b1fb4e89c290031136ccabaab22b8c3f13dee230
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.9
|
Release files / langchain_darkmoon-0.1.0-py3-none-any.whl
| Download URL | langchain_darkmoon-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
47a442efb7727fd3f5cf6e18771aa97ed26484a335634c1b6758818308cf4ea1
|
|
BLAKE2b-256 checksum How to use checksums |
5680b5aca20fc02533029923ec7be5cf00219aba54ad2faccf9eb5f61752cc55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.9
|