Skip to content

Impacket rpcmap.py

Back to the category index / Back to the command index

Checks which UUIDs, versions, and opnums are available at a specified DCE/RPC endpoint, using the management interface or active probing.

ItemDetails
Implementationexamples/rpcmap.py
CategorySMB / MSRPC / NTLM
Size378 lines
DistributionInstalled as a script through scripts=examples/*.py in setup.py

Run python examples/rpcmap.py -h for the current option definitions.

ArgumentDescription
stringbindingString binding for the MSRPC interface, for example: ncacn_ip_tcp:192.168.0.1[135] ncacn_np:192.168.0.1[\pipe\spoolss] ncacn_http:192.168.0.1[593] ncacn_http:[6001,RpcProxy=exchange.contoso.com:443] ncacn_http:localhost[3388,RpcProxy=rds.contoso:443]
-brute-uuidsBrute-force UUIDs even when the management interface is available.
-brute-opnumsBrute-force opnums for discovered UUIDs.
-brute-versionsBrute-force major versions of discovered UUIDs.
-opnum-maxBrute-force opnums from 0 to N (default: 64).
-version-maxBrute-force versions from 0 to N (default: 64).
-auth-levelMS-RPCE authentication level from 1 to 6 (default: 6, RPC_C_AUTHN_LEVEL_PKT_PRIVACY).
-uuidTest only this UUID.
-debugEnable debug output.
-tsAdd a timestamp to each log message.
-target-ipTarget IP address; if omitted, use the target value. Useful when the target is a NetBIOS name that cannot be resolved.
-portDestination SMB server port (choices: 139, 445; default: 445)
-auth-rpc[domain/]username[:password]
-auth-transport[domain/]username[:password]
-hashes-rpcNTLM hashes in LMHASH:NTHASH format.
-hashes-transportNTLM hashes in LMHASH:NTHASH format.
-no-passDo not prompt for passwords.

The tool configures transport and RPC credentials separately and connects using the specified binding. It normally lists interfaces through the management interface; with the relevant options, it binds to candidate UUIDs and versions, calls candidate opnums, and classifies responses and faults. It looks up discovered tuples in a database of known UUIDs before displaying them.

In addition to listing known endpoints, rpcmap actively probes interfaces over a specified string binding. After connecting through the transport, it gets the interface IDs enumerated by the server if the management interface is available. Otherwise, or when explicitly requested, it binds or calls candidate UUIDs, versions, and opnums and classifies returned faults.

RPC transport authentication and RPC interface authentication have separate settings. For example, with RPC over SMB, SMB session credentials open the named pipe, while the DCE/RPC authentication trailer can use different credentials and an authentication level. This is why set_transport_credentials() and set_rpc_credentials() are separate.

A successful bind indicates that an interface and version exist. An op_rng_error can show that the interface exists but the opnum is out of range, while access denied leaves open the possibility that the opnum exists. Brute-force probing creates network load and logs. Its accuracy depends on managing limits, reconnections, and timeouts without reducing fault codes to simple success or failure.

SymbolLocationWhere to trace its responsibility
RPCMap54__init__(), get_rpc_transport(), set_transport_credentials(), set_rpc_credentials(), set_smb_info(), connect(), disconnect(), do(), bruteforce_versions(), bruteforce_opnums(), bruteforce_uuids(), handle_discovered_tup()
ModuleMain names used
impacket.httpAUTH_BASIC
impacket.exampleslogger, rpcdatabase
impacket.examples.utilsparse_identity
impacketuuid, version
impacket.dcerpc.v5.epmKNOWN_UUIDS
impacket.dcerpc.v5epm, mgmt, rpcrt, transport
impacket.dcerpc.v5.rpcrtDCERPCException
impacket.dcerpc.v5.transportDCERPCStringBinding, SMBTransport
impacket.dcerpc.v5.rpchRPC_PROXY_CONN_A1_0X6BA_ERR, RPC_PROXY_CONN_A1_401_ERR, RPC_PROXY_CONN_A1_404_ERR, RPC_PROXY_HTTP_IN_DATA_401_ERR, RPC_PROXY_INVALID_RPC_PORT_ERR, RPC_PROXY_RPC_OUT_DATA_404_ERR

Output, side effects, and required privileges

Section titled “Output, side effects, and required privileges”
  • The tool primarily makes queries and authentication attempts. Frequent runs can affect audit logs, account lockouts, and target load.
  • On failure, use protocol status codes to determine whether name resolution, connection, authentication, service state, or permissions caused the stop.
  • disconnect() is part of cleanup. Check that new early returns and exception paths still reach it.

The code depends on dcerpc.v5.transport, rpcrt, epm, mgmt, and examples.rpcdatabase. RPCMap keeps transport authentication and RPC authentication as separate states; do not merge them.