mirror of
https://github.com/gentilkiwi/mimikatz
synced 2025-03-02 16:50:24 +00:00
93 lines
9.9 KiB
C
93 lines
9.9 KiB
C
#include "kull_m_rpc_ms-nrpc.h"
|
|
|
|
typedef struct _netlogon_MIDL_TYPE_FORMAT_STRING {
|
|
SHORT Pad;
|
|
UCHAR Format[101];
|
|
} netlogon_MIDL_TYPE_FORMAT_STRING;
|
|
|
|
typedef struct _netlogon_MIDL_PROC_FORMAT_STRING {
|
|
SHORT Pad;
|
|
#if defined(_M_X64) || defined(_M_ARM64) // TODO:ARM64
|
|
CHAR Format[309];
|
|
#elif defined(_M_IX86)
|
|
CHAR Format[301];
|
|
#endif
|
|
} netlogon_MIDL_PROC_FORMAT_STRING;
|
|
|
|
extern const netlogon_MIDL_TYPE_FORMAT_STRING netlogon__MIDL_TypeFormatString;
|
|
extern const netlogon_MIDL_PROC_FORMAT_STRING netlogon__MIDL_ProcFormatString;
|
|
static const RPC_CLIENT_INTERFACE logon___RpcClientInterface = {sizeof(RPC_CLIENT_INTERFACE), {{0x12345678, 0x1234, 0xabcd, {0xef, 0x00, 0x01, 0x23, 0x45, 0x67, 0xcf, 0xfb}}, {1, 0}}, {{0x8a885d04, 0x1ceb, 0x11c9, {0x9f, 0xe8, 0x08, 0x00, 0x2b, 0x10, 0x48, 0x60}}, {2, 0}}, 0, 0, 0, 0, 0, 0x00000000};
|
|
RPC_IF_HANDLE logon_v1_0_c_ifspec = (RPC_IF_HANDLE) &logon___RpcClientInterface;
|
|
handle_t hLogon;
|
|
static const GENERIC_BINDING_ROUTINE_PAIR BindingRoutines[] = {{(GENERIC_BINDING_ROUTINE) LOGONSRV_HANDLE_bind, (GENERIC_UNBIND_ROUTINE) LOGONSRV_HANDLE_unbind}};
|
|
static const MIDL_STUB_DESC logon_StubDesc = {(void *) &logon___RpcClientInterface, MIDL_user_allocate, MIDL_user_free, &hLogon, 0, BindingRoutines, 0, 0, netlogon__MIDL_TypeFormatString.Format, 1, 0x60000, 0, 0x8000253, 0, 0, 0, 0x1, 0, 0, 0};
|
|
|
|
#if defined(_M_X64) || defined(_M_ARM64) // TODO:ARM64
|
|
NTSTATUS NetrServerReqChallenge(IN LOGONSRV_HANDLE PrimaryName, IN wchar_t *ComputerName, IN PNETLOGON_CREDENTIAL ClientChallenge, OUT PNETLOGON_CREDENTIAL ServerChallenge)
|
|
{
|
|
return (NTSTATUS) NdrClientCall2((PMIDL_STUB_DESC) &logon_StubDesc, (PFORMAT_STRING) &netlogon__MIDL_ProcFormatString.Format[0], PrimaryName, ComputerName, ClientChallenge, ServerChallenge).Simple;
|
|
}
|
|
NTSTATUS NetrServerAuthenticate2(IN LOGONSRV_HANDLE PrimaryName, IN wchar_t *AccountName, IN NETLOGON_SECURE_CHANNEL_TYPE SecureChannelType, IN wchar_t *ComputerName, IN PNETLOGON_CREDENTIAL ClientCredential, OUT PNETLOGON_CREDENTIAL ServerCredential, IN OUT ULONG *NegotiateFlags)
|
|
{
|
|
return (NTSTATUS) NdrClientCall2((PMIDL_STUB_DESC) &logon_StubDesc, (PFORMAT_STRING) &netlogon__MIDL_ProcFormatString.Format[62], PrimaryName, AccountName, SecureChannelType, ComputerName, ClientCredential, ServerCredential, NegotiateFlags).Simple;
|
|
}
|
|
NTSTATUS NetrServerPasswordSet2(IN LOGONSRV_HANDLE PrimaryName, IN wchar_t *AccountName, IN NETLOGON_SECURE_CHANNEL_TYPE SecureChannelType, IN wchar_t *ComputerName, IN PNETLOGON_AUTHENTICATOR Authenticator, OUT PNETLOGON_AUTHENTICATOR ReturnAuthenticator, IN PNL_TRUST_PASSWORD ClearNewPassword)
|
|
{
|
|
return (NTSTATUS) NdrClientCall2((PMIDL_STUB_DESC) &logon_StubDesc, (PFORMAT_STRING) &netlogon__MIDL_ProcFormatString.Format[142], PrimaryName, AccountName, SecureChannelType, ComputerName, Authenticator, ReturnAuthenticator, ClearNewPassword).Simple;
|
|
}
|
|
NTSTATUS NetrServerTrustPasswordsGet(IN LOGONSRV_HANDLE TrustedDcName, IN wchar_t *AccountName, IN NETLOGON_SECURE_CHANNEL_TYPE SecureChannelType, IN wchar_t *ComputerName, IN PNETLOGON_AUTHENTICATOR Authenticator, OUT PNETLOGON_AUTHENTICATOR ReturnAuthenticator, OUT PENCRYPTED_NT_OWF_PASSWORD EncryptedNewOwfPassword, OUT PENCRYPTED_NT_OWF_PASSWORD EncryptedOldOwfPassword)
|
|
{
|
|
return (NTSTATUS) NdrClientCall2((PMIDL_STUB_DESC) &logon_StubDesc, (PFORMAT_STRING) &netlogon__MIDL_ProcFormatString.Format[222], TrustedDcName, AccountName, SecureChannelType, ComputerName, Authenticator, ReturnAuthenticator, EncryptedNewOwfPassword, EncryptedOldOwfPassword).Simple;
|
|
}
|
|
|
|
static const netlogon_MIDL_PROC_FORMAT_STRING netlogon__MIDL_ProcFormatString = {0, {
|
|
0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x28, 0x00, 0x31, 0x08, 0x00, 0x00, 0x00, 0x5c, 0x3c, 0x00, 0x44, 0x00, 0x46, 0x05, 0x0a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0b, 0x01, 0x08, 0x00, 0x08, 0x00, 0x0a, 0x01, 0x10, 0x00, 0x14, 0x00, 0x12, 0x21, 0x18, 0x00, 0x14, 0x00, 0x70, 0x00, 0x20, 0x00, 0x08, 0x00, 0x00, 0x48,
|
|
0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x40, 0x00, 0x31, 0x08, 0x00, 0x00, 0x00, 0x5c, 0x5e, 0x00, 0x60, 0x00, 0x46, 0x08, 0x0a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00,
|
|
0x00, 0x00, 0x02, 0x00, 0x0b, 0x01, 0x08, 0x00, 0x08, 0x00, 0x48, 0x00, 0x10, 0x00, 0x0d, 0x00, 0x0b, 0x01, 0x18, 0x00, 0x08, 0x00, 0x0a, 0x01, 0x20, 0x00, 0x14, 0x00, 0x12, 0x21, 0x28, 0x00,
|
|
0x14, 0x00, 0x58, 0x01, 0x30, 0x00, 0x08, 0x00, 0x70, 0x00, 0x38, 0x00, 0x08, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x40, 0x00, 0x31, 0x08, 0x00, 0x00, 0x00, 0x5c, 0x8e, 0x02,
|
|
0x58, 0x00, 0x46, 0x08, 0x0a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0b, 0x01, 0x08, 0x00, 0x08, 0x00, 0x48, 0x00, 0x10, 0x00, 0x0d, 0x00,
|
|
0x0b, 0x01, 0x18, 0x00, 0x08, 0x00, 0x0a, 0x01, 0x20, 0x00, 0x2a, 0x00, 0x12, 0x41, 0x28, 0x00, 0x2a, 0x00, 0x0a, 0x01, 0x30, 0x00, 0x42, 0x00, 0x70, 0x00, 0x38, 0x00, 0x08, 0x00, 0x00, 0x48,
|
|
0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x48, 0x00, 0x31, 0x08, 0x00, 0x00, 0x00, 0x5c, 0x56, 0x00, 0x40, 0x01, 0x46, 0x09, 0x0a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00,
|
|
0x00, 0x00, 0x02, 0x00, 0x0b, 0x01, 0x08, 0x00, 0x08, 0x00, 0x48, 0x00, 0x10, 0x00, 0x0d, 0x00, 0x0b, 0x01, 0x18, 0x00, 0x08, 0x00, 0x0a, 0x01, 0x20, 0x00, 0x2a, 0x00, 0x12, 0x41, 0x28, 0x00,
|
|
0x2a, 0x00, 0x12, 0x41, 0x30, 0x00, 0x5a, 0x00, 0x12, 0x41, 0x38, 0x00, 0x5a, 0x00, 0x70, 0x00, 0x40, 0x00, 0x08, 0x00, 0x00,
|
|
}};
|
|
#elif defined(_M_IX86)
|
|
#pragma optimize("", off)
|
|
NTSTATUS NetrServerReqChallenge(IN LOGONSRV_HANDLE PrimaryName, IN wchar_t *ComputerName, IN PNETLOGON_CREDENTIAL ClientChallenge, OUT PNETLOGON_CREDENTIAL ServerChallenge)
|
|
{
|
|
return (NTSTATUS) NdrClientCall2((PMIDL_STUB_DESC) &logon_StubDesc, (PFORMAT_STRING) &netlogon__MIDL_ProcFormatString.Format[0], (unsigned char *) &PrimaryName).Simple;
|
|
}
|
|
NTSTATUS NetrServerAuthenticate2(IN LOGONSRV_HANDLE PrimaryName, IN wchar_t *AccountName, IN NETLOGON_SECURE_CHANNEL_TYPE SecureChannelType, IN wchar_t *ComputerName, IN PNETLOGON_CREDENTIAL ClientCredential, OUT PNETLOGON_CREDENTIAL ServerCredential, IN OUT ULONG *NegotiateFlags)
|
|
{
|
|
return (NTSTATUS) NdrClientCall2((PMIDL_STUB_DESC) &logon_StubDesc, (PFORMAT_STRING) &netlogon__MIDL_ProcFormatString.Format[60], (unsigned char *) &PrimaryName).Simple;
|
|
}
|
|
NTSTATUS NetrServerPasswordSet2(IN LOGONSRV_HANDLE PrimaryName, IN wchar_t *AccountName, IN NETLOGON_SECURE_CHANNEL_TYPE SecureChannelType, IN wchar_t *ComputerName, IN PNETLOGON_AUTHENTICATOR Authenticator, OUT PNETLOGON_AUTHENTICATOR ReturnAuthenticator, IN PNL_TRUST_PASSWORD ClearNewPassword)
|
|
{
|
|
return (NTSTATUS) NdrClientCall2((PMIDL_STUB_DESC) &logon_StubDesc, (PFORMAT_STRING) &netlogon__MIDL_ProcFormatString.Format[138], (unsigned char *) &PrimaryName).Simple;
|
|
}
|
|
NTSTATUS NetrServerTrustPasswordsGet(IN LOGONSRV_HANDLE TrustedDcName, IN wchar_t *AccountName, IN NETLOGON_SECURE_CHANNEL_TYPE SecureChannelType, IN wchar_t *ComputerName, IN PNETLOGON_AUTHENTICATOR Authenticator, OUT PNETLOGON_AUTHENTICATOR ReturnAuthenticator, OUT PENCRYPTED_NT_OWF_PASSWORD EncryptedNewOwfPassword, OUT PENCRYPTED_NT_OWF_PASSWORD EncryptedOldOwfPassword)
|
|
{
|
|
return (NTSTATUS) NdrClientCall2((PMIDL_STUB_DESC) &logon_StubDesc, (PFORMAT_STRING) &netlogon__MIDL_ProcFormatString.Format[216], (unsigned char *) &TrustedDcName).Simple;
|
|
}
|
|
#pragma optimize("", on)
|
|
static const netlogon_MIDL_PROC_FORMAT_STRING netlogon__MIDL_ProcFormatString = {0, {
|
|
0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x14, 0x00, 0x31, 0x04, 0x00, 0x00, 0x00, 0x5c, 0x3c, 0x00, 0x44, 0x00, 0x46, 0x05, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00,
|
|
0x00, 0x00, 0x02, 0x00, 0x0b, 0x01, 0x04, 0x00, 0x08, 0x00, 0x0a, 0x01, 0x08, 0x00, 0x14, 0x00, 0x12, 0x21, 0x0c, 0x00, 0x14, 0x00, 0x70, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00, 0x48, 0x00, 0x00,
|
|
0x00, 0x00, 0x0f, 0x00, 0x20, 0x00, 0x31, 0x04, 0x00, 0x00, 0x00, 0x5c, 0x5e, 0x00, 0x60, 0x00, 0x46, 0x08, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00,
|
|
0x0b, 0x01, 0x04, 0x00, 0x08, 0x00, 0x48, 0x00, 0x08, 0x00, 0x0d, 0x00, 0x0b, 0x01, 0x0c, 0x00, 0x08, 0x00, 0x0a, 0x01, 0x10, 0x00, 0x14, 0x00, 0x12, 0x21, 0x14, 0x00, 0x14, 0x00, 0x58, 0x01,
|
|
0x18, 0x00, 0x08, 0x00, 0x70, 0x00, 0x1c, 0x00, 0x08, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x20, 0x00, 0x31, 0x04, 0x00, 0x00, 0x00, 0x5c, 0x8e, 0x02, 0x58, 0x00, 0x46, 0x08,
|
|
0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0b, 0x01, 0x04, 0x00, 0x08, 0x00, 0x48, 0x00, 0x08, 0x00, 0x0d, 0x00, 0x0b, 0x01, 0x0c, 0x00, 0x08, 0x00,
|
|
0x0a, 0x01, 0x10, 0x00, 0x2a, 0x00, 0x12, 0x41, 0x14, 0x00, 0x2a, 0x00, 0x0a, 0x01, 0x18, 0x00, 0x42, 0x00, 0x70, 0x00, 0x1c, 0x00, 0x08, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00,
|
|
0x24, 0x00, 0x31, 0x04, 0x00, 0x00, 0x00, 0x5c, 0x56, 0x00, 0x40, 0x01, 0x46, 0x09, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0b, 0x01, 0x04, 0x00,
|
|
0x08, 0x00, 0x48, 0x00, 0x08, 0x00, 0x0d, 0x00, 0x0b, 0x01, 0x0c, 0x00, 0x08, 0x00, 0x0a, 0x01, 0x10, 0x00, 0x2a, 0x00, 0x12, 0x41, 0x14, 0x00, 0x2a, 0x00, 0x12, 0x41, 0x18, 0x00, 0x5a, 0x00,
|
|
0x12, 0x41, 0x1c, 0x00, 0x5a, 0x00, 0x70, 0x00, 0x20, 0x00, 0x08, 0x00, 0x00,
|
|
}};
|
|
#endif
|
|
|
|
static const netlogon_MIDL_TYPE_FORMAT_STRING netlogon__MIDL_TypeFormatString = {0, {
|
|
0x00, 0x00, 0x12, 0x08, 0x25, 0x5c, 0x11, 0x08, 0x25, 0x5c, 0x11, 0x00, 0x08, 0x00, 0x1d, 0x00, 0x08, 0x00, 0x02, 0x5b, 0x15, 0x00, 0x08, 0x00, 0x4c, 0x00, 0xf4, 0xff, 0x5c, 0x5b, 0x11, 0x04,
|
|
0xf4, 0xff, 0x11, 0x08, 0x08, 0x5c, 0x11, 0x00, 0x02, 0x00, 0x15, 0x03, 0x0c, 0x00, 0x4c, 0x00, 0xe4, 0xff, 0x08, 0x5b, 0x11, 0x04, 0xf4, 0xff, 0x11, 0x00, 0x08, 0x00, 0x1d, 0x01, 0x00, 0x02,
|
|
0x05, 0x5b, 0x15, 0x03, 0x04, 0x02, 0x4c, 0x00, 0xf4, 0xff, 0x08, 0x5b, 0x11, 0x04, 0x0c, 0x00, 0x1d, 0x00, 0x10, 0x00, 0x4c, 0x00, 0xbe, 0xff, 0x5c, 0x5b, 0x15, 0x00, 0x10, 0x00, 0x4c, 0x00,
|
|
0xf0, 0xff, 0x5c, 0x5b, 0x00,
|
|
}}; |