Skip to content

Back to the Category Index / Back to the Command Index

Finds hosts in a domain, checks SMB sessions and logged-on users, and identifies where specified users have connections.

ItemDetails
Implementationexamples/netview.py
CategoryActive Directory / LDAP / Account Management
Size496 lines
DistributionInstalled as a script through scripts=examples/*.py in setup.py

Check python examples/netview.py -h for the current option definitions.

ArgumentDescription
identity[domain/]username[:password]
-userFilter output by this user.
-usersFile listing users to include in the output.
-targetTarget system to query. If omitted, run in domain mode.
-targetsFile listing target systems to query, one per line. If omitted, run in domain mode.
-noloopStop after the first probe.
-delayDelay in seconds between starting probe batches (default: 10).
-max-connectionsMaximum number of open connections (default: 1000).
-tsAdd timestamps to log output.
-debugEnable debug logging.
-hashesNTLM hashes in LMHASH:NTHASH format.
-no-passSkip the password prompt (useful with -k).
-kUse Kerberos authentication. Read credentials from the ccache (KRB5CCNAME) based on the target; fall back to command-line credentials if none are valid.
-aesKey128- or 256-bit AES key for Kerberos authentication.
-dc-ipDomain controller IP address. Defaults to the domain (FQDN) in target.

The command builds a list of candidate machines from LDAP/RPC or an input target list, then uses worker threads and a queue to connect to each host. It collects sessions and users through WKST/SRVS/SAMR and displays matches for the filter. By default it repeats periodically; -noloop stops after one pass.

The goal is not merely to check whether hosts are alive, but to find where specified users have sessions or logons across machines. It first obtains candidate machines from the domain or reads an explicit -target(s) list, then builds an identity filter from -user(s) separately.

Each worker connects to a target over SMB/RPC and retrieves Server Service session information and Workstation Service logged-on user information. These represent different states: the first covers network sessions; the second covers users recognized by the machine. The command combines the results to display matching hosts, users, and sources, even if permissions allow only one type of query.

The queue, connection limit, delay, and loop manage load and help avoid missed results in large domains. Worker exceptions must not leave queue items unfinished or start new connections after the stop event. -noloop stops after one pass, so distinguish a snapshot from continuous monitoring.

SymbolLocationEntry Point for Tracing Behavior
USERENUM111__init__(), getDomainMachines(), getTargets(), filterUsers(), run(), getSessions(), getLoggedIn(), stop()
checkMachines()76Module function
ModuleMain Names Used
impacket.exampleslogger
impacket.examples.utilsparse_identity
impacketversion
impacket.smbconnectionSessionError
impacket.dcerpc.v5samr, srvs, transport, wkst
impacket.dcerpc.v5.ndrNULL
impacket.dcerpc.v5.rpcrtDCERPCException
impacket.nt_errorsSTATUS_MORE_ENTRIES

Output, Side Effects, and Required Privileges

Section titled “Output, Side Effects, and Required Privileges”
  • Primarily queries and authentication attempts. Repeated runs can affect audit logs, account lockouts, and target load.
  • On failure, use protocol status to determine whether name resolution, connection, authentication, service state, or permissions stopped the operation.
  • stop() handles cleanup. Check that new early returns and exception paths still reach it.

This command depends on smbconnection, dcerpc.v5.wkst / srvs / samr, and threading/queue. USERENUM.stop(), the connection limit, and delay are important controls against excessive connections.