PywerView is not limited to its command-line interface. Every enumeration capability is exposed through importable Python classes and a set of helper functions inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/the-useless-one/pywerview/llms.txt
Use this file to discover all available pages before exploring further.
pywerview.cli.helpers, making it straightforward to embed Active Directory queries into your own scripts, automation pipelines, or post-exploitation frameworks. Results are returned as Python objects whose attributes map directly to LDAP attribute names, so you can filter, transform, and output data however your workflow requires — no shell parsing needed.
Core Classes
PywerView’s functionality is organized into four main classes. Each wraps an authenticated LDAP or RPC connection and exposes methods that correspond to CLI subcommands.NetRequester
pywerview.functions.net.NetRequesterThe primary class for LDAP-based AD queries: users, computers, groups, OUs, sites, subnets, domain controllers, trusts, ACLs, and more.GPORequester
pywerview.functions.gpo.GPORequesterHandles Group Policy Object enumeration: GPOs, PSOs, GPO groups, domain policy, and GPO-based admin lookups.Hunting Classes
pywerview.functions.hunting.UserHunter
pywerview.functions.hunting.ProcessHunter
pywerview.functions.hunting.EventHunterHunt for users logged into machines, running processes, and Windows event log entries across the domain.Misc
pywerview.functions.misc.MiscMiscellaneous helpers, including invoke_checklocaladminaccess for testing local admin access on remote hosts.Using Helper Functions
Thepywerview.cli.helpers module provides thin wrapper functions that instantiate the appropriate class and call the correct method in a single call. This is the recommended entry point for most scripting use cases.
Retrieving Group Members
Using NetRequester Directly
For repeated queries against the same domain controller, instantiateNetRequester once and call its methods directly. This avoids the overhead of establishing a new LDAP connection on every call.
Authentication Parameters
All helper functions share a consistent set of authentication parameters. They mirror the CLI flags exactly, so anything that works on the command line translates directly to library calls.| Parameter | Type | Default | Description |
|---|---|---|---|
domain_controller | str | required | IP address or hostname of the Domain Controller |
domain | str | required | UPN domain name (e.g. contoso.com, not CONTOSO) |
user | str | required | Username to authenticate with |
password | str | '' | Password for the user |
lmhash | str | '' | LM hash for pass-the-hash authentication |
nthash | str | '' | NT hash for pass-the-hash authentication |
do_simple | bool | False | Force SIMPLE LDAP bind instead of NTLM/SASL |
do_kerberos | bool | False | Use Kerberos authentication instead of NTLM |
do_tls | bool | False | Force LDAPS (port 636) instead of plain LDAP |
user_cert | str | '' | Path to a PEM certificate file for SChannel auth |
user_key | str | '' | Path to the private key file for SChannel auth |
When
do_kerberos=True, PywerView reads the ccache ticket file pointed to by the KRB5CCNAME environment variable. You must set this variable in your script’s environment before calling any helper function or instantiating a requester class. For example: import os; os.environ['KRB5CCNAME'] = '/tmp/alice.ccache'.