AdPentestAI-Python
Active Directory security-assessment framework, including a read-only, one-command Active Directory inventory in v3.5.2. Existing workflows include Domain Controller detection, parallel tool execution, CVE validation, reporting and SQLite scan history.
v3.5.2 inventory is a separate LDAP-only mode. It makes real network requests in --mode active and supports anonymous blackbox enumeration as well as authenticated directory reads; it does not run exploit tools or prove that inaccessible entries do not exist.
For authorized penetration testing only. Always get explicit written permission before testing any systems.
Table of Contents
- Quick Start
- Active Directory inventory (v3.5.2)
- Domain Controller discovery (v3.5.2)
- Features
- Installation
- Usage
- CVE Scanners
- WAF Detection & Bypass
- Scan History Database
- DC Detection Strategies
- Tool Registry
- Email Protocol Enumeration
- DNS Configuration
- Architecture
- Contributing
- License
Quick Start
Install v3.5.2 from PyPI after the release is published:
python -m pip install --upgrade "adpentest==3.5.2"
For source-only validation before PyPI publication, check out the v3.5.2 release branch and run python -m pip install -e ..
# Preview LDAP inventory: no network calls
adpentest --ad-inventory --target dc.lab.example --mode dry-run
# REAL anonymous blackbox LDAP inventory, requires authorization and LDAPS
adpentest --ad-inventory --target dc.lab.example --ad-bind anonymous --mode active --scope-confirmed --ad-partitions all --ad-output blackbox-ad.json
# Existing broader pentest scan (separate command; may use additional tools)
adpentest --target lab.example --mode dry-run --scope-confirmed
# Existing reporting interfaces
adpentest --history
adpentest --cve-report
For a known Domain Controller use --target; for DNS discovery first, use --ad-domain DOMAIN. Without credentials, inventory collects only anonymously readable objects and can fail at RootDSE or a directory partition. See the coverage report; a result is not proof of a complete forest inventory.
Domain Controller discovery (v3.5.2)
Find AD Domain Controller candidates from a domain name, instead of assuming the public website or bare domain hosts LDAP. This is a separate DNS-only operation and does not scan ports, transfer DNS zones, authenticate, or exploit systems.
# Preview the exact DNS SRV lookups; no network requests
python -m adpentest --discover-dcs --domain lab.example
# Perform authorized DNS SRV discovery using the system DNS resolver
python -m adpentest --discover-dcs --domain lab.example --mode active --scope-confirmed --resolve-addresses
# Use an authorized internal / VPN DNS server for the AD domain
python -m adpentest --discover-dcs --domain lab.example --dns-server 192.0.2.53 --mode active --scope-confirmed --resolve-addresses --dns-output dc-candidates.json
The module queries _ldap._tcp.dc._msdcs.DOMAIN, _ldap._tcp.DOMAIN and _kerberos._tcp.DOMAIN. Only the first is DC-specific; the latter two are service hints, not verified DCs. Results contain hostname, SRV priority/weight/port, optional A/AAAA addresses, configured resolver and per-query status. No fallback to a public DNS server occurs. Public DNS often has no visibility into internal Active Directory DNS zones.
Discover a DC then enumerate readable AD objects
python -m adpentest --ad-inventory --ad-domain lab.example --ad-dns-server 192.0.2.53 --ad-bind anonymous --mode active --scope-confirmed --ad-output discovered-inventory.json
Auto-inventory selects the first in-domain, DC-specific SRV candidate and attempts read-only LDAPS inventory. When DNS supplies an A/AAAA address, it connects directly to that address while checking the advertised hostname's TLS certificate identity. If no in-domain DC-specific record exists, the command fails without any LDAP connection. It does not automatically follow out-of-domain service endpoints. For manual selection, use the discovery JSON to choose a server, then call inventory with --target DC_HOST or --target DC_HOST --ad-connect-ip IP.
The selected DC can still be unreachable, reject anonymous binding, or restrict readable objects. No DNS-only result confirms a live DC. See docs/AD_DC_DISCOVERY.md.
Active Directory inventory (v3.5.2)
Active blackbox scan without credentials
Use this mode for authorized blackbox assessments, with no pre-existing AD account:
python -m adpentest --ad-inventory `
--target dc.lab.example `
--ad-bind anonymous `
--ad-tls ldaps `
--ad-partitions all `
--ad-page-size 500 `
--mode active `
--scope-confirmed `
--ad-output blackbox-ad.json
This is real LDAP communication over TLS, not a simulation. The collector connects directly to the selected DC, reads RootDSE and attempts paged searches on the naming contexts that the server advertises. It does not perform network sweeps, enumerate services through SMB/Kerberos, brute-force accounts, attempt privilege escalation, or exploit vulnerabilities. An anonymous bind often cannot read users, groups or entire partitions in production AD.
DNS NXDOMAIN workaround (v3.5.2)
If DNS returns The DNS query name does not exist (NXDOMAIN), obtain the known DC IP from your authorized lab/network administrator and supply --ad-connect-ip. The connection then uses that literal IP without resolving the --target hostname, while TLS still verifies the certificate against that hostname. This is not a way to bypass authentication or certificate validation.
python -m adpentest --ad-inventory `
--target dc.lab.example `
--ad-connect-ip 192.0.2.15 `
--ad-bind anonymous `
--ad-tls ldaps `
--mode active `
--scope-confirmed `
--ad-output blackbox-ip.json
The DC must have a trusted LDAPS certificate valid for dc.lab.example. If the certificate is signed by an internal CA, provide --ad-ca-file corporate-ca.pem. Both LDAPS and StartTLS support the explicit-IP path. An NXDOMAIN error can also indicate a typo, wrong DNS resolver, or missing VPN connection; investigate the cause rather than inventing an address. --ad-connect-ip requires a hostname in --target, not another IP. Actual inventory still depends on directory access permissions.
Authenticated read-only inventory
With a permitted read-only account, the same command collects all directory objects visible to that account, including users and other entity types:
python -m adpentest --ad-inventory `
--target dc.lab.example `
--ad-user "auditor@lab.example" `
--ad-bind simple `
--mode active `
--scope-confirmed `
--ad-partitions all `
--ad-output ad-inventory.json
A secure password prompt is used by default. For unattended execution, set a secret environment variable outside your command history and pass only its name with --ad-password-env AD_AUDIT_PASSWORD. NTLM binding is also supported using --ad-bind ntlm with a compatible DOMAIN\user identity. Do not put passwords in command-line options or in JSON output.
Discovery, object types and completeness
- Partitions:
--ad-partitions alluses the default domain naming context and additional contexts advertised by RootDSE, such as Configuration, Schema, DomainDnsZones and ForestDnsZones when present and readable.--ad-partitions domainlimits the search to the default domain context. It does not automatically contact other domains or trusts. - Objects: all LDAP entries matching
(objectClass=*)within those contexts are eligible. Common categories include users, computers, managed service accounts, groups, organizational units, GPO containers, trusts, contacts, DNS nodes, AD CS enrollment services and other object types. - Paging: paged LDAP queries default to 500 objects per page.
--ad-page-sizesupports 1–1000, and--ad-max-objectssupports a bounded maximum (100,000 by default); duplicate DNs are removed. The cap can make a result partial. - Encryption: certificate-validated LDAPS on port 636 is the default.
--ad-tls starttlsupgrades port 389 before authentication. Use--ad-ca-file corporate-ca.pemfor an internal CA; verification is not bypassed. - Data minimization: the JSON includes DN, naming context, category and a small allowlist of identifying/configuration fields such as name, objectGUID, objectClass, sAMAccountName, UPN and account-control flags. Passwords, hashes, secrets and full ACLs are not requested.
- Coverage: each queried partition reports
complete,partial/truncatedorerroras applicable. The overall output distinguishescompletefrompartial; counts describe retrieved objects, not the unseen contents of the forest. - Output: by default
--ad-output -writes JSON to stdout. A named output is a new file and is not overwritten automatically. Treat collected usernames and directory structure as sensitive inventory data.
Example (abridged, fabricated):
{
"status": "partial",
"mode": "active",
"method": "ldap-read-only-paged",
"summary": {
"object_count": 3,
"by_category": {"users": 2, "groups": 1},
"truncated": false,
"partition_errors": 1
},
"partitions": [
{"base_dn": "DC=lab,DC=example", "objects": 3, "duplicates_skipped": 0, "status": "complete"},
{"base_dn": "CN=Configuration,DC=lab,DC=example", "objects": 0, "duplicates_skipped": 0, "status": "error", "error_type": "LDAPOperationResult"}
],
"objects": []
}
The objects array is abbreviated above; a real report includes each retrieved entry. Exit codes are 0 for a complete or dry-run report, 1 for partial inventory and 2 for failed active execution or invalid CLI input.
Read docs/AD_INVENTORY.md for a focused reference. AD inventory JSON is not a CVE evidence manifest: independently verified product, patch and prerequisite evidence is still required for confirmed CVE findings.
Confirmed CVE findings
The CVE report, HTML findings, and dashboard show only confirmed findings.
An open port, service banner, signing observation, or high correlation score
does not establish a specific CVE. All built-in heuristic scanners return
assessment: "unverified" until target-specific proof is available. Passive
correlations are retained under passive_cve_scan.observations; matches
contains no unverified candidates. Raw tool observations remain available.
Supply inventory collected from the target with --cve-evidence FILE.json.
The file is an array of proofs keyed by exact CVE and target. Each proof must
include this structure, replacing placeholders with observed facts:
[
{
"cve": "CVE-2025-33073",
"target": "192.0.2.10",
"method": "vendor-version-and-patch-inventory",
"checked_at": "<UTC timestamp of the inventory>",
"vendor": "<exact vendor in the official record>",
"product": "<exact product in the official record>",
"version": "<observed product/build version>",
"platform": "<platform if the official record restricts it>",
"patch_state": "missing",
"prerequisites_verified": true,
"advisory_url": "<vendor advisory listed in the official record>",
"evidence": {
"product_version": {"source": "inventory.json", "sha256": "<SHA-256 of inventory.json bytes>", "value": "<same observed version>"},
"patch_inventory": {"source": "inventory.json", "sha256": "<same file digest>", "value": {"complete": true, "installed": [], "missing": ["<applicable vendor patch>"]}},
"prerequisites": {"source": "inventory.json", "sha256": "<same file digest>", "value": ["<CVE-specific condition verified on this target>"]}
}
}
]
Each source names a local collector export relative to the selected manifest's
directory. An export has collection_method: "authenticated-inventory", the
same cve, target, checked_at, vendor, product, platform, and
advisory_url as its proof, plus an evidence object mapping the three kinds
to their actual values. For example:
{
"collection_method": "authenticated-inventory",
"cve": "CVE-2025-33073",
"target": "192.0.2.10",
"checked_at": "<UTC timestamp of collection>",
"vendor": "<vendor>", "product": "<product>", "platform": "<platform>",
"advisory_url": "<official advisory URL>",
"evidence": {
"product_version": "<observed version>",
"patch_inventory": {"complete": true, "installed": [], "missing": ["<applicable patch>"]},
"prerequisites": ["<verified CVE-specific condition>"]
}
}
The operator must select authentic exports from a trusted authenticated collector, including the applicable vendor patch and prerequisite checks. The verifier checks their bytes, binding, freshness, complete patch inventory, and consistency; a file digest by itself does not prove the truth of a capture. Absolute paths, traversal, and paths outside that directory are rejected. Imported JSON cannot select an evidence manifest or authorize its own files.
The verifier fetches the official CVE List
record, requires PUBLISHED, checks CVE identity, advisory, product, platform,
and affected version range, recomputes SHA-256 over the fetched response bytes,
rejects unexpected redirects, and uses the record's severity. Reserved, rejected,
missing, mismatched, or unverifiable records do not qualify. Inventory and
record verification expire after 24 hours; metadata refreshes at least hourly
when used. Only exact versions and numeric semver ranges without status
changes are currently supported; custom/git/Maven ordering stays unverified. The inventory proof
confirms applicability and missing updates; it does not perform exploitation.
Existing historical rows are retained, and legacy vulnerable=true flags
without this proof are excluded from current reports.
To revalidate history or a saved report, explicitly supply the current local
manifest again. Missing local files, changed bytes, expired inventory, record
changes, and legacy confirmation schema 1 remain unverified. SQLite table
layouts and existing CLI arguments are preserved; JSON adds result_table
and confirmation policy schema 2. Default output remains JSON.
python -m adpentest --history --cve-evidence evidence/proofs.json
python -m adpentest --run-details RUN_ID --cve-evidence evidence/proofs.json --table
python -m adpentest --report-input prior-report.json --cve-evidence evidence/proofs.json --table --html-report report.html
The WebForms dashboard delegates verification to the same Python policy.
Administrators can set absolute AdPentestPythonPath,
AdPentestWorkingDirectory, and AdPentestCveEvidencePath in app settings.
The evidence path is also passed to new scans. Without a configured manifest
or a working verifier, no imported CVE is displayed as confirmed.
Kerberos tickets and all-results tables
Install the optional cross-platform ticket client with
python -m pip install -e '.[kerberos]' from this checkout. --obtain-tickets requests a TGT
for the supplied account and normal TGS only for explicit --ticket-spn
values. Dry-run lists planned requests. Active requests require
--scope-confirmed, the realm/account/KDC, a private output directory, and a
password entered with a secure prompt or read from an explicitly named
environment variable. Passwords are never placed in command arguments.
python -m adpentest --obtain-tickets --ticket-domain lab.example --ticket-user researcher --ticket-kdc dc.lab.example --ticket-spn cifs/server.lab.example --table
python -m adpentest --obtain-tickets --ticket-domain lab.example --ticket-user researcher --ticket-kdc dc.lab.example --ticket-spn cifs/server.lab.example --ticket-output-dir private-tickets --mode active --scope-confirmed --table
python -m adpentest --ticket-inventory --ticket-cache FILE:private-tickets/example.ccache --table
Ticket inventory reads local FILE ccaches, including available and expired
tickets; other cache backends remain explicitly unsupported. Acquisition and
inventory may be combined with --target to include metadata in a scan's
JSON, HTML and SQLite tool results. Credential caches are saved separately
with mode 0600 in a 0700 directory on Unix; use a directory restricted to the
account by ACLs on Windows. Reports include client, service, ticket kind,
encryption type, status and expiry, without passwords, keys or ticket bytes.
--table, HTML and WebForms show all CVE candidates, SMB configuration
observations, tool outcomes and ticket metadata with their status. Unverified
CVEs have informational severity and do not affect CVE risk or active-CVE
counts. Successful Kerberos authentication does not establish a vulnerability.
Features
Core Capabilities
- One-command AD inventory (v3.5.2) — real paged LDAP searches, anonymous blackbox or authenticated read-only enumeration, grouped JSON results and explicit coverage limits
- Auto DC Detection — discovers Domain Controllers via DNS SRV records, LDAP RootDSE probes, port fingerprinting, and subnet sweep (legacy scan workflow)
- Multi-threaded execution — 16 parallel workers for tool execution, 32 workers for port/DNS/credential tasks (10-15x speedup)
- 35+ AD/SMB/Kerberos/ADCS/Email tools — cross-platform binary tools + pure Python implementations
- 7 CVE scanners — automated detection of critical AD vulnerabilities (CVSS 7.5-9.4)
- WAF detection & bypass — identifies WAF/CDN vendors and attempts bypass via HTTP spoofing, raw LDAP/Kerberos, TCP fragmentation
- SQLite scan history — persistent storage of all scan runs, tool results, and CVE findings
- Auto-install — missing tools installed automatically via apt/pip/git
- Safety —
dry-runis the default mode;--scope-confirmedrequired for authorization
Attack Vectors
| Category | Tools | Description |
|---|---|---|
| AD Inventory (v3.5.2) | --ad-inventory using ldap3 |
Read-only LDAP entry collection with optional anonymous blackbox bind; separate from exploitation |
| Reconnaissance | nmap, masscan, enum4linux-ng, rpcdump, bloodhound-python, ldapdomaindump | Network & AD enumeration |
| SMB | smbclient, smbmap, crackmapexec, impacket | Null sessions, share enum, signing detection, credential testing |
| Kerberos | GetUserSPNs, AS-REP roast, Kerberoast, kerbrute | SPN enum, ticket extraction, user enumeration |
| ADCS | certipy (find, shadow, ESC1, ESC3, ESC9) | Certificate template analysis & exploitation |
| SMTP/POP3/IMAP enum & auth testing | User discovery, credential testing, Exchange detection | |
| Privilege Escalation | ACL scanner, GPO abuse, delegation chain, auto privesc | Permission analysis & escalation paths |
| Persistence | Golden/silver ticket, DCshadow, skeleton key, DSRM, SID history | Domain persistence techniques |
| Coercion & Relay | PetitPotam, PrinterBug, NTLM relay | Authentication coercion attacks |
| CVE Scanning | 7 dedicated scanners | Certighost, ResetNightmare, NTLM bypass, RC4, RPC RCE |
Installation
From PyPI
After publication of the 3.5 release:
python -m pip install --upgrade "adpentest==3.5.2"
python -m adpentest --ad-inventory --help
For testing a GitHub branch before publication, install that checkout with python -m pip install -e ..
From Source
git clone https://github.com/netanelcyber/AdPentestAI-Python.git
cd AdPentestAI-Python
pip install -e .
Dependencies
| Package | Version | Purpose |
|---|---|---|
httpx |
>= 0.27 | HTTP client for EWS/web enumeration |
dnspython |
>= 2.4 | DNS resolution with SRV record support |
ldap3 |
>= 2.9 | LDAP inventory (read-only), RootDSE and LDAP operations |
jinja2 |
>= 3.0 | Report templates |
SQLAlchemy |
>= 2.0, < 3 | Diagnostic ORM persistence |
Standard library modules used: smtplib, poplib, imaplib, socket, concurrent.futures, subprocess, sqlite3, json.
Usage
Basic Scans
# Dry-run (check tools, detect DCs, preview commands — no actual execution)
adpentest --target 10.0.0.1 --mode dry-run --scope-confirmed
# Active scan with auto DC detection
adpentest --target corp.local --mode active --scope-confirmed
# Custom timeout and no auto-install of missing tools
adpentest --target 192.168.1.10 --mode active --scope-confirmed --timeout 600 --no-auto-install
# Custom DNS servers
adpentest --target corp.local --mode active --scope-confirmed --dns-server 1.1.1.1,8.8.8.8
# Connect via VPN before scanning
adpentest --target 10.10.10.1 --mode active --scope-confirmed --vpn lab.ovpn
Scan History & Reports
# Show all past scan runs
adpentest --history
# Show last 5 runs
adpentest --history --history-limit 5
# Show all vulnerable CVE findings across all runs
adpentest --cve-report
# Show details for a specific run
adpentest --run-details run-8824073e5124-20260904055457
# Use custom database path
adpentest --history --db-path /path/to/custom.db
HTML Pentest Report Generation
Generate an executive-ready, standalone, and interactive HTML penetration test report (<100KB):
# Generate report during active scan
adpentest --target corp.local --mode active --scope-confirmed --html-report report.html
# Generate report from an existing JSON output file
python -m adpentest.report_generator scan_results.json report.html
- 0.0 - 10.0 Executive Risk Score with CVSS & severity metrics gauge
- Interactive Dark / Light mode toggle & print-optimized layout
- Target architecture & Domain Controller detection breakdown
- Categorized security findings with remediation advice
- Collapsible tool execution logs with timing and duration metrics
Lab Setup
# Interactive lab setup orchestrator
adpentest --setup-labs
Output Format
All scan output is JSON:
{
"status": "completed",
"run_id": "run-abc123-20260901120000",
"db_path": "~/.adpentest/scan_history.db",
"dc_detection": {
"dc_count": 2,
"detected_domain": "corp.local",
"domain_controllers": [...]
},
"execution": {
"result_count": 35,
"completed": 28,
"failed": 7
}
}
See examples/sample-dry-run-output.json for a complete example.
CVE Scanners
The framework includes 7 built-in CVE scanners that run as part of every scan. All scanners are safe and read-only — they use port probes, anonymous LDAP queries, and raw protocol checks only.
| CVE | Name | CVSS | Description |
|---|---|---|---|
| CVE-2026-59270 | Spring LDAP | 9.4 | Hardcoded credentials in Spring Security embedded LDAP (UnboundIdContainer) |
| CVE-2026-54121 | Certighost | 8.8 | AD CS enrollment bypass — certificate enrollment for arbitrary computer accounts |
| CVE-2025-54918 | NTLM LDAP Bypass | 8.1 | NTLM authentication bypass on DC LDAP — privilege escalation to SYSTEM |
| CVE-2026-33826 | AD RPC RCE | 8.0 | Windows AD RPC remote code execution via improper input validation |
| CVE-2026-27912 | ResetNightmare | 8.0 | Kerberos kpasswd password reset bypass via UPN collision — full domain takeover |
| CVE-2026-24294 | NTLM Reflection | 7.8 | NTLM reflection via SMB port multiplexing (Server 2025 / Win 11 24H2) |
| CVE-2026-20833 | Kerberos RC4 | 7.5 | KDC accepts RC4-HMAC encryption — enables Kerberoasting attacks |
What Each Scanner Checks
CVE-2026-59270 — Attempts LDAP bind with known hardcoded credentials (uid=admin,ou=system / secret) on ports 389, 636, 53389, 33389, 10389, 8389. Reports exposed entry count.
CVE-2026-54121 — Queries AD CS Enrollment Services and certificate templates via LDAP. Identifies templates with ENROLLEE_SUPPLIES_SUBJECT flag or risky enrollment configurations.
CVE-2025-54918 — Checks if LDAP accepts NTLM/GSS-SPNEGO authentication without enforced signing. Extracts DC functional level and domain context.
CVE-2026-33826 — Probes RPC endpoint mapper (port 135), confirms AD DC via LDAP, checks for exposed RPC-related ports (135, 593, 445, 139).
CVE-2026-27912 — Checks if kpasswd (port 464) and Kerberos (port 88) are open. Queries ms-DS-MachineAccountQuota to assess exploitation feasibility.
CVE-2026-24294 — Sends SMB2 Negotiate to detect protocol version and signing mode. Checks for alternative SMB ports (8445, 9445, etc.) indicating port multiplexing.
CVE-2026-20833 — Sends raw Kerberos AS-REQ with RC4 (etype 23), AES256 (etype 18), and AES128 (etype 17) to detect which encryption types the KDC accepts.
WAF Detection & Bypass
When scanning targets behind WAF/CDN services, the framework automatically:
- Detects WAF vendor — checks HTTP headers and body content for signatures of 17+ WAF vendors (Incapsula/Imperva, Cloudflare, Akamai, AWS WAF, Azure Front Door, Sucuri, etc.)
- Attempts bypass via 5 technique layers:
- HTTP bypass — header spoofing (X-Forwarded-For, X-Real-IP, CF-Connecting-IP), User-Agent rotation, path obfuscation, verb tampering
- Raw LDAP — BER-encoded LDAPv3 anonymous bind directly to port 389
- Raw Kerberos — AS-REQ with TCP framing to port 88
- TCP fragmentation — 1 byte per TCP segment with TCP_NODELAY
- Email/HTTP — OWA, EWS NTLM handshake, Autodiscover, ActiveSync, MAPI probing
If raw LDAP or Kerberos bypasses the WAF, the framework extracts domain info and adjusts DC detection confidence accordingly.
Scan History Database
All scan data is automatically stored in SQLite at ~/.adpentest/scan_history.db.
Database Schema
scan_runs — One row per scan execution:
run_id,target,mode,started_at,finished_at,statusdc_count,live_hosts,tools_executed,tools_succeeded,tools_failedcves_checked,cves_vulnerable
tool_results — One row per tool execution:
tool,host,is_dc,fqdn,status,duration_sec,output,error
cve_findings — One row per CVE check:
cve_id,target,cvss,severity,vulnerable,impact,details_json
Querying Directly
# Open the database
sqlite3 ~/.adpentest/scan_history.db
# All vulnerable findings
SELECT cve_id, target, cvss, severity, impact FROM cve_findings WHERE vulnerable=1 ORDER BY cvss DESC;
# Scan history summary
SELECT run_id, target, mode, status, tools_executed, cves_vulnerable, started_at FROM scan_runs ORDER BY started_at DESC;
# Tool success rate
SELECT tool, COUNT(*) as runs, SUM(CASE WHEN status='completed' THEN 1 ELSE 0 END) as ok FROM tool_results GROUP BY tool ORDER BY runs DESC;
DC Detection Strategies
The framework uses a multi-strategy pipeline to discover Domain Controllers:
| Strategy | Method | Confidence |
|---|---|---|
| DNS SRV | Queries _ldap._tcp.dc._msdcs.<domain> |
High (0.9) |
| LDAP RootDSE | Anonymous bind to extract domain/forest info | High (0.9) |
| Port fingerprint | Checks Kerberos (88), LDAP (389/636), GC (3268/3269) | Medium (0.7) |
| Subnet sweep | Kerberos port 88 scan on /24 → /23 → /22 | Medium (0.6) |
When WAF is detected blocking ports, the bypass engine runs automatically. If raw LDAP/Kerberos bypasses succeed, confidence is adjusted to 0.7 ("waf-bypassed"); otherwise 0.1 ("waf-blocked").
Tool Registry
Available Tools (35+)
Binary tools: nmap, masscan, enum4linux-ng, rpcdump, smbclient, bloodhound-python, certipy, ldapdomaindump, kerbrute, crackmapexec, smbmap, impacket (secretsdump, psexec)
Windows-native: powershell_ldap_enum, powershell_smb_enum, powershell_ad_recon
Kerberos: GetUserSPNs, AS_REP_roast, kerberoast
ADCS: certipy_shadow, certipy_esc1, certipy_esc3, certipy_esc9
Email: smtp_enum, smtp_auth_test, pop3_auth_test, imap_auth_test, email_server_discovery
Exploitation: ntlm_null_session, auto_privesc, golden_ticket, silver_ticket, delegation_abuse, trust_enumeration, trust_abuse, petitpotam, printerbug, ntlm_relay, acl_scanner, acl_exploit, gpo_abuse, delegation_chain, sid_history, dsrm_backdoor, dcshadow, golden_gmsa, skeleton_key
CVE scanners: cve_2026_59270, cve_2026_54121, cve_2025_54918, cve_2026_33826, cve_2026_27912, cve_2026_24294, cve_2026_20833
SMB protocol version testing
The built-in smb_version_test tool negotiates SMB 2.0.2, 2.1, 3.0, 3.0.2,
and 3.1.1 on TCP 445 and independently checks SMBv1. It uses the current Python
interpreter and is included in the careful active tool set. Dry-run only
previews its command; active execution sends negotiation requests without
authenticating or accessing shares.
The API is also available independently of the full scan workflow:
from adpentest.core import test_smb_versions
result = test_smb_versions("192.0.2.10", timeout=5.0)
Existing result keys are retained. Support and security fields use true for
an observed positive, false for an explicit negative, and null when the
probe is inconclusive. Each entry in dialect_results retains its negotiation
error and status code. max_dialect is the highest successfully observed
dialect; partial failures return completed-with-errors. Signing and encryption
fields describe that dialect. Encryption capability does not establish share
encryption enforcement, and SMBv1 support does not confirm a specific CVE.
Wire formats follow Microsoft's SMB2 NEGOTIATE request and response specifications, including SMB 3.1.1 preauthentication and encryption contexts.
Email Protocol Enumeration
Pure Python email enumeration using standard library (no external dependencies):
- SMTP VRFY — discover valid usernames via VRFY command
- SMTP RCPT TO — validate recipients via RCPT TO
- Credential testing — automatic fallback chain: SMTP → POP3 → IMAP
- Exchange detection — OWA, EWS NTLM handshake (extracts domain/DC/forest from NTLM challenge), Autodiscover, ActiveSync, MAPI
- Parallel testing — 32 concurrent workers for credential testing
Ports scanned: 25, 465, 587 (SMTP), 110, 995 (POP3), 143, 993 (IMAP).
DNS Configuration
Priority Order
- CLI arguments (
--dns-server,--dns-timeout) — highest priority - Environment variables (
DNS_SERVERS,DNS_TIMEOUT) - System default DNS — auto-detected
- Public DNS fallback — Google (8.8.8.8, 8.8.4.4), Cloudflare (1.1.1.1, 1.0.0.1)
# CLI
adpentest --target corp.local --mode active --scope-confirmed --dns-server 192.168.1.1,8.8.8.8 --dns-timeout 5.0
# Environment
export DNS_SERVERS=192.168.1.1,1.1.1.1
export DNS_TIMEOUT=5.0
adpentest --target corp.local --mode active --scope-confirmed
Architecture
Package architecture
The legacy scanner workflow remains in adpentest/core.py. The v3.5.2 inventory collector is isolated in adpentest/ad_inventory.py, reached via the adpentest package CLI in adpentest/__init__.py; it does not import or execute the legacy tool registry. The package also includes separately routed offline and diagnostic modules.
Execution Pipeline
The new inventory mode has a smaller, standalone execution path:
--ad-inventory --target dc.lab.example --mode active --scope-confirmed
-> validate scope and TLS settings
-> bind to selected LDAP server (anonymous or authenticated)
-> read RootDSE naming contexts
-> paged read-only searches and object classification
-> coverage-aware JSON report
The existing broader pentest workflow still uses:
Input: --target 10.0.0.1 --mode active --scope-confirmed
│
├── Scope validation (dry-run vs active)
├── Tool discovery (scan $PATH)
├── SQLite run initialization
│
├── DC Detection (multi-strategy)
│ ├── DNS SRV queries
│ ├── LDAP RootDSE probe
│ ├── Port fingerprint (+ WAF detect/bypass)
│ └── Subnet sweep (/24 → /23 → /22)
│
├── Domain discovery + FQDN resolution
├── Email server discovery (MX + port scan)
│
├── Parallel Tool Execution (ThreadPoolExecutor, 16 workers)
│ ├── AD tools against DCs (prioritized)
│ ├── CVE scanners against all targets
│ └── Results → SQLite (tool_results + cve_findings)
│
└── Output: JSON + SQLite database
Threading Model
| Pool | Workers | Purpose |
|---|---|---|
| Tool execution | 16 | AD diagnostic tools in parallel |
| Port scanning | 32 | Concurrent TCP port checks |
| DNS resolution | 32 | Concurrent DNS queries |
| Credential testing | 32 | SMTP/POP3/IMAP auth testing |
Contributing
Contributions are welcome! See CONTRIBUTING.md for setup instructions and CODE_OF_CONDUCT.md for community guidelines.
Check the open issues for tasks labeled good-first-issue or help-wanted.
Adding a New CVE Scanner
- Add scanner function
scan_cve_YYYY_NNNNN(target, timeout)returning a dict withcve,cvss,severity,vulnerable,impact,remediation - Add tool name
cve_YYYY_NNNNN_short_nametoAD_TOOLSset - Add to
PIP_PACKAGES(empty list for pure Python) - Add to
EXECUTABLES(python3/python/python.exe) - Add
build_ad_commandhandler
Adding a New Tool
- Add tool name to
AD_TOOLSset - Add package mapping to
PIP_PACKAGES/APT_PACKAGES/WINGET_PACKAGES - Add executable names to
EXECUTABLESdict - Implement command building in
build_ad_command()
License
Disclaimer: This tool is designed for authorized penetration testing and security research only. Users are responsible for obtaining proper authorization before testing any systems. The authors assume no liability for misuse.
Metadata
Release files for adpentest 3.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| adpentest-3.5.2.tar.gz | 237.7 kB | Without provenance | Details for adpentest-3.5.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| adpentest-3.5.2-py3-none-any.whl | Python 3 | none | any | Details for adpentest-3.5.2-py3-none-any.whl |
Total release size: 416.8 kB
Release files / adpentest-3.5.2.tar.gz
| Download URL | adpentest-3.5.2.tar.gz |
|---|---|
| Size | 237.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
06573878eff2fd572ea9d683e218cca3af166119f4b89d1ada1201a23c07ab29
|
|
BLAKE2b-256 checksum How to use checksums |
a08dfd0d15225f18fc6335f56e6b6bedc5bf460c80110400d1a64b1f5f24adbe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / adpentest-3.5.2-py3-none-any.whl
| Download URL | adpentest-3.5.2-py3-none-any.whl |
|---|---|
| Size | 179.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
83db2ec4a32575d72603b2015f4b09ff3f4eacf434c785a92c72fdc9fdef819d
|
|
BLAKE2b-256 checksum How to use checksums |
999307aa5cf9d8c39642816969981f65df24d2b4abc32128d703655e84b46d08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for adpentest 3.5.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.