Skip to main content

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 in impacket/dcerpc/v5/. Each interface corresponds to a specific Windows service.

Security Account Manager (SAMR)

Module: impacket.dcerpc.v5.samr
UUID: 12345778-1234-ABCD-EF00-0123456789AC
Protocol: [MS-SAMR]
SAMR provides access to domain user and group information.
Key Functions:
  • hSamrConnect() - Connect to SAM server
  • hSamrEnumerateDomainsInSamServer() - List domains
  • hSamrEnumerateUsersInDomain() - List users
  • hSamrOpenUser() - Open user object
  • hSamrQueryInformationUser() - Get user details
  • hSamrGetMembersInGroup() - List group members

Local Security Authority (LSAD)

Module: impacket.dcerpc.v5.lsad
UUID: 12345778-1234-ABCD-EF00-0123456789AB
Protocol: [MS-LSAD]
LSAD manages local security policies and trusted domain information.

Directory Replication Service (DRSUAPI)

Module: impacket.dcerpc.v5.drsuapi
UUID: E3514235-4B06-11D1-AB04-00C04FC2DCD2
Protocol: [MS-DRSR]
DRSUAPI enables Active Directory replication and is used for DCSync attacks.

Service Control Manager (SCMR)

Module: impacket.dcerpc.v5.scmr
UUID: 367ABB81-9844-35F1-AD32-98F038001003
Protocol: [MS-SCMR]
SCMR manages Windows services remotely.

Server Service (SRVS)

Module: impacket.dcerpc.v5.srvs
UUID: 4B324FC8-1670-01D3-1278-5A47BF6EE188
Protocol: [MS-SRVS]
SRVS provides information about SMB shares and sessions.

Other Important Interfaces

Task Scheduler (TSCH)

Module: impacket.dcerpc.v5.tsch
Pipe: \atsvc
Schedule remote task execution.

Windows Registry (RRP)

Module: impacket.dcerpc.v5.rrp
Pipe: \winreg
Remote registry access.

Netlogon (NRPC)

Module: impacket.dcerpc.v5.nrpc
Pipe: \netlogon
Netlogon protocol for authentication.

Event Log (EVEN)

Module: impacket.dcerpc.v5.even
Pipe: \eventlog
Remote event log access.
Module: impacket.dcerpc.v5.rprn
Pipe: \spoolss
Print spooler service.

Connection and Binding

Transport Types

Authentication

Helper Functions

Most interfaces provide helper functions (prefixed with h) that simplify common operations:

Error Handling

Best Practices

  1. Always close handles: Use hClose() or equivalent functions to release server resources
  2. Use helper functions: They handle structure creation and error checking
  3. Check permissions: Many operations require specific access rights
  4. Handle exceptions: DCE/RPC calls can fail with various error codes
  5. 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
For complete interface documentation, see the protocol specifications at Microsoft’s Open Specifications.