Categorygithub.com/oiweiwei/go-msrpc
module
1.1.1
Repository: https://github.com/oiweiwei/go-msrpc.git
Documentation: pkg.go.dev

# README

MS-RPC IDL Parser/Codegen for Go / MS-RPC/DCOM Client

The IDL parser for the Microsoft Extension of the C706: DCE/RPC 1.1.

The client stub generator for many MSRPC / DCOM services including (but not limited to - see complete list below) Netlogon, Windows Registry, Eventlog, DCOM (OXID resolver), WMI (query and method exec) support.

Usage

See examples and dcerpc package documentation.

Examples rely on following environment variables:

NameDescriptionExample
USERNAMEThe Domain\Username"MSAD2.COM\User"
PASSWORDThe password"password"
PASSWORD_MD4The password hash (use go run examples/helpers/nt_hash.go -d $PASSWORD to generate the hash)"f077ca4b7d73486a45e75dcdd74cd5bd"
WORKSTATIONThe workstation name"Ubuntu"
SERVERThe server FQDN or IP"192.168.0.22"
SERVER_NAMEThe server NetBIOS name"WIN2019"
SERVER_HOSTThe server FQDN"my-server.win2019.com"
SAM_USERNAMEThe machine account name (see examples/netlogon_sec_channel.go)"COMPUTER$"
SAM_PASSWORDThe machine account password (see examples/netlogon_sec_channel.go)"password"
SAM_WORKSTATIONThe machine account workstation name"COMPUTER"
TARGETThe target name (SPN) for kerberos."host/my-server.win2019.com"
KRB5_CONFIGThe kerberos config path."/path/to/krb5.conf"

For codegeneration, run make all to regenerate all sources, or make nrpc.go.

Features

Connection-oriented DCE/RPC v5 client implementation

The library implements the CO RPC v5 (dcerpc package) with following features:

  • Connection Multiplexing: multiple clients over single connection

  • Multiple Connection per Association Group: ability to use context handles from one connection on another, flexibility in arranging the clients-per-connection-per-association

  • Verification Trailer: ability to add verification trailer to the request payload

  • Kerberos, Netlogon, NTLM, SPNEGO Authentication

  • Endpoint mapper / string binding support

  • DCOM basic support

  • Eventlog BinXML parser

  • WMIO object unmarshaler / marshaler.

MS-RPCE Extensions

The library implements some of the extensions defined in MS-RPCE document:

  • Security Context Multiplexing: ability to create multiple security contexts over the same logical connection.

  • Bind-time Feature Negotiation: (actually not a feature).

  • Header Signing: (legacy thing,

GSS-API / SSP Client Side

The library contains the GSS-API interface definitions. (ssp/gssapi)

The library contains the ssp package which has an implementation for the various security service providers, like Kerberos, NTLM, Netlogon (Secure Channel), SPNEGO.

  • GSSAPI interface implementation including Ex-methods defined in Microsoft documentation

  • Kerberos:

    • Supported Enc Types: RC4-HMAC, AES128-CTS-HMAC-SHA1, AES256-CTS-HMAC-SHA1

    • DCE and non-DCE APReq/APRep style

  • NTLM

    • Supported Versions: NTLMv1, NTLMv2
  • Netlogon:

    • Supported Encryption Types: RC4-HMAC, AES-SHA2
  • SPNEGO:

    • Supported Mech List MIC

    • Supported NegTokenInit2

Generated Stubs

CodeDescriptionPackage
MS-ADTSActive Directory Technical Specification: Claimsgithub.com/oiweiwei/go-msrpc/msrpc/adts
MS-EVEN6-BINXMLBinXml encodes an XML document so that the original XML text can be correctly reproduced from the encoding.github.com/oiweiwei/msrpc/binxml
MS-BKRPBackupKey Remote Protocolgithub.com/oiweiwei/msrpc/bkrp
MS-BPAUBackground Intelligent Transfer Service (BITS) Peer-Caching: Peer Authentication Protocolgithub.com/oiweiwei/msrpc/bpau
MS-BRWSACommon Internet File System (CIFS) Browser Auxiliary Protocolgithub.com/oiweiwei/msrpc/brwsa
MS-CAPRCentral Access Policy Identifier (ID) Retrieval Protocolgithub.com/oiweiwei/msrpc/capr
MS-CMPOMSDTC Connection Manager: OleTx Transports Protocolgithub.com/oiweiwei/msrpc/cmpo
MS-CMRPFailover Cluster: Management API (ClusAPI) Protocolgithub.com/oiweiwei/msrpc/cmrp
MS-DFSNMDistributed File System (DFS): Namespace Management Protocolgithub.com/oiweiwei/msrpc/dfsnm
MS-DHCPMMicrosoft Dynamic Host Configuration Protocol (DHCP) Server Management Protocolgithub.com/oiweiwei/msrpc/dhcpm
MS-DLTMDistributed Link Tracking: Central Manager Protocolgithub.com/oiweiwei/msrpc/dltm
MS-DLTWDistributed Link Tracking: Workstation Protocolgithub.com/oiweiwei/msrpc/dltw
MS-DNSPDomain Name Service (DNS) Server Management ProtocolDomain Name Service (DNS) Server Management Protocolgithub.com/oiweiwei/msrpc/dnsp
MS-DRSRDirectory Replication Service (DRS) Remote Protocolgithub.com/oiweiwei/msrpc/drsr
MS-DSSPDirectory Services Setup Remote Protocolgithub.com/oiweiwei/msrpc/dssp
MS-DTYPWindows Data Typesgithub.com/oiweiwei/msrpc/dtyp
MS-EERRExtendedError Remote Data Structuregithub.com/oiweiwei/msrpc/eerr
MS-RPCE-EPM C706-EPMEndpoint Mappergithub.com/oiweiwei/msrpc/epm
MS-ERREFWindows Error Codesgithub.com/oiweiwei/msrpc/erref
MS-EVENEventLog Remoting Protocolgithub.com/oiweiwei/msrpc/even
MS-EVEN6EventLog Remoting Protocol Version 6.0github.com/oiweiwei/msrpc/even6
MS-FASPFirewall and Advanced Security Protocolgithub.com/oiweiwei/msrpc/fasp
MS-FAXFax Server and Client Remote Protocolgithub.com/oiweiwei/msrpc/fax
MS-ICPRICertPassage Remote Protocolgithub.com/oiweiwei/msrpc/icpr
MS-IRPInternet Information Services (IIS) Inetinfo Remote Protocolgithub.com/oiweiwei/msrpc/irp
MS-LRECLive Remote Event Capture (LREC) Protocolgithub.com/oiweiwei/msrpc/lrec
MS-LSADLocal Security Authority (Domain Policy) Remote Protocolgithub.com/oiweiwei/msrpc/lsad
MS-LSATLocal Security Authority (Translation Methods) Remote Protocolgithub.com/oiweiwei/msrpc/lsat
MS-MQDSMessage Queuing (MSMQ): Directory Service Protocolgithub.com/oiweiwei/msrpc/mqds
MS-MQMPMessage Queuing (MSMQ): Queue Manager Client Protocolgithub.com/oiweiwei/msrpc/mqmp
MS-MQMQMessage Queuing (MSMQ): Data Structuresgithub.com/oiweiwei/msrpc/mqmq
MS-MQMRMessage Queuing (MSMQ): Queue Manager Management Protocolgithub.com/oiweiwei/msrpc/mqmr
MS-MQQPMessage Queuing (MSMQ): Queue Manager to Queue Manager Protocolgithub.com/oiweiwei/msrpc/mqqp
MS-MQRRMessage Queuing (MSMQ): Queue Manager Remote Read Protocolgithub.com/oiweiwei/msrpc/mqrr
MS-MSRPMessenger Service Remote Protocolgithub.com/oiweiwei/msrpc/msrp
MS-NEGOEXSPNEGO Extended Negotiation (NEGOEX) Security Mechanismgithub.com/oiweiwei/msrpc/negoex
MS-NRPCNetlogon Remote Protocolgithub.com/oiweiwei/msrpc/nrpc
MS-NRPC-SECCHANNELSecure Channel Establishment and Maintenancegithub.com/oiweiwei/msrpc/nrpc
MS-NSPIName Service Provider Interface (NSPI) Protocolgithub.com/oiweiwei/msrpc/nspi
MS-OXABREFAddress Book Name Service Provider Interface (NSPI) Referral Protocol
MS-OXCRPCWire Format Protocolgithub.com/oiweiwei/msrpc/oxcrpc
MS-PACPrivilege Attribute Certificate Data Structuregithub.com/oiweiwei/msrpc/pac
MS-PANPrint System Asynchronous Notification Protocolgithub.com/oiweiwei/msrpc/pan
MS-PARPrint System Asynchronous Remote Protocolgithub.com/oiweiwei/msrpc/par
MS-PCQPerformance Counter Query Protocolgithub.com/oiweiwei/msrpc/pcq
MS-RAARemote Authorization API Protocolgithub.com/oiweiwei/msrpc/raa
MS-RAIWRemote Administrative Interface: WINSgithub.com/oiweiwei/msrpc/raiw
MS-RPCLRemote Procedure Call Location Services Extensionsgithub.com/oiweiwei/msrpc/rpcl
MS-RPRNPrint System Remote Protocolgithub.com/oiweiwei/msrpc/rprn
MS-RRPWindows Remote Registry Protocolgithub.com/oiweiwei/msrpc/rrp
MS-RSPRemote Shutdown Protocolgithub.com/oiweiwei/msrpc/rsp
MS-SAMRSecurity Account Manager (SAM) Remote Protocol (Client-to-Server)github.com/oiweiwei/msrpc/samr
MS-SCHTask Scheduler Service Remoting Protocolgithub.com/oiweiwei/msrpc/sch
MS-SCMRService Control Manager Remote Protocolgithub.com/oiweiwei/msrpc/scmr
MS-SRVSServer Service Remote Protocolgithub.com/oiweiwei/msrpc/srvs
MS-SSPSingle Sign-On Protocolgithub.com/oiweiwei/msrpc/ssp
MS-SWNService Witness Protocolgithub.com/oiweiwei/msrpc/swn
MS-TRPTelephony Remote Protocolgithub.com/oiweiwei/msrpc/trp
MS-TSCHTask Scheduler Service Remoting Protocolgithub.com/oiweiwei/msrpc/tsch
MS-TSGUTerminal Services Gateway Server Protocolgithub.com/oiweiwei/msrpc/tsgu
MS-W32TW32Time Remote Protocolgithub.com/oiweiwei/msrpc/w32t
MS-WDSCWindows Deployment Services Control Protocolgithub.com/oiweiwei/msrpc/wdsc
MS-WKSTWorkstation Service Remote Protocolgithub.com/oiweiwei/msrpc/wkst

Generated DCOM Stubs

CodeDescriptionPackage
MS-DCOMDistributed Component Object Model (DCOM) Remote Protocolgithub.com/oiweiwei/msrpc/dcom
MS-ADTGRemote Data Services (RDS) Transport Protocolgithub.com/oiweiwei/msrpc/adtg
MC-CCFGServer Cluster: Configuration (ClusCfg) Protocolgithub.com/oiweiwei/msrpc/ccfg
MS-COMComponent Object Model Plus (COM+) Protocolgithub.com/oiweiwei/msrpc/com
MS-COMAComponent Object Model Plus (COM+) Remote Administration Protocolgithub.com/oiweiwei/msrpc/coma
MS-COMEVComponent Object Model Plus (COM+) Event System Protocolgithub.com/oiweiwei/msrpc/comev
MS-COMTComponent Object Model Plus (COM+) Tracker Service Protocolgithub.com/oiweiwei/msrpc/comt
MS-CSRACertificate Services Remote Administration Protocolgithub.com/oiweiwei/msrpc/csra
MS-CSVPFailover Cluster: Setup and Validation Protocol (ClusPrep)github.com/oiweiwei/msrpc/csvp
MS-DFSRHDFS Replication Helper Protocolgithub.com/oiweiwei/msrpc/dfsrh
MS-DMRPDisk Management Remote Protocolgithub.com/oiweiwei/msrpc/dmrp
MS-FSRMFile Server Resource Manager Protocolgithub.com/oiweiwei/msrpc/fsrm
MC-IISAInternet Information Services (IIS) Application Host COM Protocolgithub.com/oiweiwei/msrpc/iisa
MS-IISSInternet Information Services (IIS) ServiceControl Protocolgithub.com/oiweiwei/msrpc/iiss
MS-IMSAInternet Information Services (IIS) IMSAdminBaseW Remote Protocolgithub.com/oiweiwei/msrpc/imsa
MS-IOIIManagedObject Interface Protocolgithub.com/oiweiwei/msrpc/ioi
MS-OAUTOLE Automation Protocolgithub.com/oiweiwei/msrpc/oaut
MS-OCSPAMicrosoft OCSP Administration Protocolgithub.com/oiweiwei/msrpc/ocspa
MS-PLAPerformance Logs and Alerts Protocolgithub.com/oiweiwei/msrpc/pla
MS-RAIRemote Assistance Initiation Protocolgithub.com/oiweiwei/msrpc/rai
MS-RDPESCRemote Desktop Protocol: Smart Card Virtual Channel Extensiongithub.com/oiweiwei/msrpc/rdpesc
MS-VDSVirtual Disk Service (VDS) Protocolgithub.com/oiweiwei/msrpc/vds
MS-WCCEWindows Client Certificate Enrollment Protocolgithub.com/oiweiwei/msrpc/wcce
MS-WMIWindows Management Instrumentation Remote Protocolgithub.com/oiweiwei/msrpc/wmi
MS-WMIOWindows Management Instrumentation Encoding Version 1.0 Protocolgithub.com/oiweiwei/msrpc/wmio

Documentation

The codegen package also generates the documentation for the generated code pulled from the MSDN portal. (it can be quite inaccurate with determining general comment boundaries vs actual field descriptions, so inaccurate can be an HTML on MSDN side).

Naming

The codegen/go_names contains the ad-hoc naming engine, which sometimes quite sucks (so does the overall naming convention in IDL documents, seriously, how much time the average microsoft developer saves by writing para instead of param), but for most of the situations, provide a way to generate the names that comply with golang naming convention and give more intuition behind this or that field.

Generated Stubs

MIDL Implementation Limitations

  • L.0001: #define statements are applicable only for constant declaration;

  • L.0002: cpp_quote contents are limited only for constant declaration;

  • L.0005: int const declaration is not supported.

  • L.0006: wchar_t, status_error_t are predefined.

TODO

  • Testing (I don't have much time)

  • Handle reserved arguments/structure fields used for switch_is and size_is statements.

  • Derive the type from field name, like ^f[A-Z] -> boolean.

  • Pipes support

  • Callbacks Support / Server-Side Support

  • Static strings

  • Investigate: Association Group ID is not shared across several named pipe connections. (each NP requires dedicated connection).

  • Convenient way to combine SPNEGO and NTLM/KRB5 within connection option.

References

Without these projects, it would be absolutely impossible to implement go-msrpc.

Collaboration

Don't hesitate to raise an issues (and only then raise a PR), the project is quite raw, and I don't have much time, so, a lot of errors and issues are yet to discover.

# Packages

No description provided by the author
No description provided by the author
Package dcerpc implements the DCE/RPC (C706) client with MS-RPCE extensions.
No description provided by the author
No description provided by the author
package msrpc contains various stubs generated by codegen.
package ndr implements the NDR encoding.
No description provided by the author
package ssp contains definitions for security service providers.
No description provided by the author