1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
/*
Unix SMB/CIFS implementation.
SMB torture tester
Copyright (C) Andrew Tridgell 1997-2003
Copyright (C) Jelmer Vernooij 2006
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "includes.h"
#include "auth/credentials/credentials.h"
#include "lib/cmdline/popt_common.h"
#include "librpc/rpc/dcerpc.h"
#include "torture/rpc/rpc.h"
#include "torture/torture.h"
#include "librpc/rpc/dcerpc_table.h"
/* open a rpc connection to the chosen binding string */
_PUBLIC_ NTSTATUS torture_rpc_connection(TALLOC_CTX *parent_ctx,
struct dcerpc_pipe **p,
const struct dcerpc_interface_table *table)
{
NTSTATUS status;
const char *binding = lp_parm_string(-1, "torture", "binding");
if (!binding) {
printf("You must specify a ncacn binding string\n");
return NT_STATUS_INVALID_PARAMETER;
}
status = dcerpc_pipe_connect(parent_ctx,
p, binding, table,
cmdline_credentials, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to remote server: %s %s\n", binding, nt_errstr(status));
}
return status;
}
/* open a rpc connection to a specific transport */
NTSTATUS torture_rpc_connection_transport(TALLOC_CTX *parent_ctx,
struct dcerpc_pipe **p,
const struct dcerpc_interface_table *table,
enum dcerpc_transport_t transport)
{
NTSTATUS status;
const char *binding = lp_parm_string(-1, "torture", "binding");
struct dcerpc_binding *b;
TALLOC_CTX *mem_ctx = talloc_named(parent_ctx, 0, "torture_rpc_connection_smb");
if (!binding) {
printf("You must specify a ncacn binding string\n");
talloc_free(mem_ctx);
return NT_STATUS_INVALID_PARAMETER;
}
status = dcerpc_parse_binding(mem_ctx, binding, &b);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Failed to parse dcerpc binding '%s'\n", binding));
talloc_free(mem_ctx);
return status;
}
b->transport = transport;
status = dcerpc_pipe_connect_b(mem_ctx, p, b, table,
cmdline_credentials, NULL);
if (NT_STATUS_IS_OK(status)) {
*p = talloc_reference(parent_ctx, *p);
} else {
*p = NULL;
}
talloc_free(mem_ctx);
return status;
}
NTSTATUS torture_rpc_init(void)
{
dcerpc_init();
dcerpc_table_init();
register_torture_op("RPC-LSA", torture_rpc_lsa, 0);
register_torture_op("RPC-LSALOOKUP", torture_rpc_lsa_lookup, 0);
register_torture_op("RPC-SECRETS", torture_rpc_lsa_secrets, 0);
register_torture_op("RPC-ECHO", torture_rpc_echo, 0);
register_torture_op("RPC-DFS", torture_rpc_dfs, 0);
register_torture_op("RPC-SPOOLSS", torture_rpc_spoolss, 0);
register_torture_op("RPC-SAMR", torture_rpc_samr, 0);
register_torture_op("RPC-UNIXINFO", torture_rpc_unixinfo, 0);
register_torture_op("RPC-NETLOGON", torture_rpc_netlogon, 0);
register_torture_op("RPC-SAMLOGON", torture_rpc_samlogon, 0);
register_torture_op("RPC-SAMSYNC", torture_rpc_samsync, 0);
register_torture_op("RPC-SCHANNEL", torture_rpc_schannel, 0);
register_torture_op("RPC-WKSSVC", torture_rpc_wkssvc, 0);
register_torture_op("RPC-SRVSVC", torture_rpc_srvsvc, 0);
register_torture_op("RPC-SVCCTL", torture_rpc_svcctl, 0);
register_torture_op("RPC-ATSVC", torture_rpc_atsvc, 0);
register_torture_op("RPC-EVENTLOG", torture_rpc_eventlog, 0);
register_torture_op("RPC-EPMAPPER", torture_rpc_epmapper, 0);
register_torture_op("RPC-WINREG", torture_rpc_winreg, 0);
register_torture_op("RPC-INITSHUTDOWN", torture_rpc_initshutdown, 0);
register_torture_op("RPC-OXIDRESOLVE", torture_rpc_oxidresolve, 0);
register_torture_op("RPC-REMACT", torture_rpc_remact, 0);
register_torture_op("RPC-MGMT", torture_rpc_mgmt, 0);
register_torture_op("RPC-SCANNER", torture_rpc_scanner, 0);
register_torture_op("RPC-AUTOIDL", torture_rpc_autoidl, 0);
register_torture_op("RPC-COUNTCALLS", torture_rpc_countcalls, 0);
register_torture_op("RPC-MULTIBIND", torture_multi_bind, 0);
register_torture_op("RPC-AUTHCONTEXT", torture_bind_authcontext, 0);
register_torture_op("RPC-BINDSAMBA3", torture_bind_samba3, 0);
register_torture_op("RPC-NETLOGSAMBA3", torture_netlogon_samba3, 0);
register_torture_op("RPC-SAMBA3SESSIONKEY", torture_samba3_sessionkey, 0);
register_torture_op("RPC-DRSUAPI", torture_rpc_drsuapi, 0);
register_torture_op("RPC-CRACKNAMES", torture_rpc_drsuapi_cracknames, 0);
register_torture_op("RPC-ROT", torture_rpc_rot, 0);
register_torture_op("RPC-DSSETUP", torture_rpc_dssetup, 0);
register_torture_op("RPC-ALTERCONTEXT", torture_rpc_alter_context, 0);
register_torture_op("RPC-JOIN", torture_rpc_join, 0);
register_torture_op("RPC-DSSYNC", torture_rpc_dssync, 0);
register_torture_op("BENCH-RPC", torture_bench_rpc, 0);
register_torture_op("RPC-ASYNCBIND", torture_async_bind, 0);
return NT_STATUS_OK;
}
|