Overview
Impacket provides extensive support for DCE/RPC (Distributed Computing Environment/Remote Procedure Call) interfaces, which are fundamental to Windows network protocols. These interfaces allow you to interact with various Windows services remotely.Available Interfaces
Impacket implements numerous MS-RPC interfaces located inimpacket/dcerpc/v5/. Each interface corresponds to a specific Windows service.
Security Account Manager (SAMR)
Module:impacket.dcerpc.v5.samrUUID:
12345778-1234-ABCD-EF00-0123456789ACProtocol: [MS-SAMR] SAMR provides access to domain user and group information.
hSamrConnect()- Connect to SAM serverhSamrEnumerateDomainsInSamServer()- List domainshSamrEnumerateUsersInDomain()- List usershSamrOpenUser()- Open user objecthSamrQueryInformationUser()- Get user detailshSamrGetMembersInGroup()- List group members
Local Security Authority (LSAD)
Module:impacket.dcerpc.v5.lsadUUID:
12345778-1234-ABCD-EF00-0123456789ABProtocol: [MS-LSAD] LSAD manages local security policies and trusted domain information.
Directory Replication Service (DRSUAPI)
Module:impacket.dcerpc.v5.drsuapiUUID:
E3514235-4B06-11D1-AB04-00C04FC2DCD2Protocol: [MS-DRSR] DRSUAPI enables Active Directory replication and is used for DCSync attacks.
Service Control Manager (SCMR)
Module:impacket.dcerpc.v5.scmrUUID:
367ABB81-9844-35F1-AD32-98F038001003Protocol: [MS-SCMR] SCMR manages Windows services remotely.
Server Service (SRVS)
Module:impacket.dcerpc.v5.srvsUUID:
4B324FC8-1670-01D3-1278-5A47BF6EE188Protocol: [MS-SRVS] SRVS provides information about SMB shares and sessions.
Other Important Interfaces
Task Scheduler (TSCH)
Module:impacket.dcerpc.v5.tschPipe:
\atsvcSchedule remote task execution.
Windows Registry (RRP)
Module:impacket.dcerpc.v5.rrpPipe:
\winregRemote registry access.
Netlogon (NRPC)
Module:impacket.dcerpc.v5.nrpcPipe:
\netlogonNetlogon protocol for authentication.
Event Log (EVEN)
Module:impacket.dcerpc.v5.evenPipe:
\eventlogRemote event log access.
Print Spooler (RPRN)
Module:impacket.dcerpc.v5.rprnPipe:
\spoolssPrint spooler service.
Connection and Binding
Transport Types
Authentication
Helper Functions
Most interfaces provide helper functions (prefixed withh) that simplify common operations:
Error Handling
Best Practices
- Always close handles: Use
hClose()or equivalent functions to release server resources - Use helper functions: They handle structure creation and error checking
- Check permissions: Many operations require specific access rights
- Handle exceptions: DCE/RPC calls can fail with various error codes
- Disconnect properly: Call
dce.disconnect()when finished
References
- [MS-SAMR]: Security Account Manager (SAM) Remote Protocol
- [MS-LSAD]: Local Security Authority (Domain Policy) Remote Protocol
- [MS-DRSR]: Directory Replication Service (DRS) Remote Protocol
- [MS-SCMR]: Service Control Manager Remote Protocol
- [MS-SRVS]: Server Service Remote Protocol