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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
/*
* Mausezahn - A fast versatile traffic generator
* Copyright (C) 2008 Herbert Haas
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 2 as published by the
* Free Software Foundation.
*
* 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, see http://www.gnu.org/licenses/gpl-2.0.html
*
*/
#ifndef __MAUSEZAHN_CLI__
#define __MAUSEZAHN_CLI__
#include <sys/time.h>
#include <libcli.h>
#include "mops.h"
#define CLI_DEBUG_PACKET 0x0001
#define MZ_MODE_BENCHMARK 1002
#define MZ_MODE_SCAN 1003
#define MZ_MODE_PACKET 1100
#define MZ_MODE_PACKET_ARP 1101
#define MZ_MODE_PACKET_BPDU 1102
#define MZ_MODE_PACKET_CDP 1103
#define MZ_MODE_PACKET_DNS 1104
#define MZ_MODE_PACKET_IP 1105
#define MZ_MODE_PACKET_ICMP 1106
#define MZ_MODE_PACKET_LLDP 1107
#define MZ_MODE_PACKET_RTP 1108
#define MZ_MODE_PACKET_SYSLOG 1109
#define MZ_MODE_PACKET_TCP 1110
#define MZ_MODE_PACKET_UDP 1111
#define MZ_MODE_PACKET_ETH 1112
#define MZ_MODE_PACKET_IGMP 1113
#define MZ_MODE_INTERFACE 1200
#define MZ_MODE_SEQUENCE 1300
#define MZ_DEFAULT_USERNAME "mz"
#define MZ_DEFAULT_PASSWORD "mz"
#define MZ_DEFAULT_ENABLE_PASSWORD "mops"
#define MZ_DEFAULT_PORT 25542 // Towel day and 42
struct cli_def *gcli;
char mz_username[32];
char mz_password[32];
char mz_enable[32];
char mz_listen_addr[16];
int mz_port;
struct mops *clipkt; // actual packet used by CLI thread
int clidev;
// =================================================================
int cli_debug;
// Flags from 0x0000 to 0xFFFF
// cli_debug & 8000 => Developer specific debugs
// cli_debug & 0001 => Packet transmission debugging
// ...
// =================================================================
///////////////////////////////////////////////////////////////////////////////
// Prototypes
void mz_cli_init();
int cli_read_cfg(char *str);
int mz_def16 (char *def, u_int16_t val, char *str256);
int cli();
int debug_all (struct cli_def *cli, const char *command, char *argv[], int argc);
int debug_packet (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_end_to_config(struct cli_def *cli, const char *command, char *argv[], int argc);
int tx_switch(struct cli_def *cli);
int cmd_test(struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_reset_interface (struct cli_def *cli, const char *command, char *argv[], int argc);
int show_system(struct cli_def *cli, const char *command, char *argv[], int argc);
int show_packets(struct cli_def *cli, const char *command, char *argv[], int argc);
int show_set(struct cli_def *cli, const char *command, char *argv[], int argc);
int show_interfaces(struct cli_def *cli, const char *command, char *argv[], int argc);
int show_mops(struct cli_def *cli, const char *command, char *argv[], int argc);
int show_arp (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_set(struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_run_id (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_run_name (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_run_sequence (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_run_all (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_stop (struct cli_def *cli, const char *command, char *argv[], int argc);
int launch_bpdu (struct cli_def *cli, const char *command, char *argv[], int argc);
int launch_synflood (struct cli_def *cli, const char *command, char *argv[], int argc);
int stop_mausezahn(struct cli_def *cli, const char *command, char *argv[], int argc);
int transmit (struct cli_def *cli, const char *command, char *argv[], int argc);
int clear_all(struct cli_def *cli, const char *command, char *argv[], int argc);
int clear_packet(struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_reset_packet(struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_load (struct cli_def *cli, const char *command, char *argv[], int argc);
int enter_interface (struct cli_def *cli, const char *command, char *argv[], int argc);
int conf_ip_address (struct cli_def *cli, const char *command, char *argv[], int argc);
int conf_mac_address (struct cli_def *cli, const char *command, char *argv[], int argc);
int conf_tag_dot1q (struct cli_def *cli, const char *command, char *argv[], int argc);
int conf_tag_mpls (struct cli_def *cli, const char *command, char *argv[], int argc);
int conf_frame_limit (struct cli_def *cli, const char *command, char *argv[], int argc);
int conf_sequence (struct cli_def *cli, const char *command, char *argv[], int argc);
int sequence_add (struct cli_def *cli, const char *command, char *argv[], int argc);
int sequence_delay (struct cli_def *cli, const char *command, char *argv[], int argc);
int sequence_remove (struct cli_def *cli, const char *command, char *argv[], int argc);
int sequence_show (struct cli_def *cli, const char *command, char *argv[], int argc);
int enter_packet (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_packet_type(struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_packet_end(struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_packet_clone (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_packet_name (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_packet_description (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_packet_count (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_packet_delay (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_packet_interval (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_packet_bind (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_packet_mac_address_source (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_packet_mac_address_destination (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_eth_type (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_eth_length (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_eth_llc (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_eth_snap (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_packet_dot1q (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_packet_mpls (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_packet_payload_hex (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_packet_payload_ascii (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_packet_payload_raw (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_port_source (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_port_destination (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_udp_sum (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_udp_len (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_udp_end(struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_tcp_seqnr (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_tcp_acknr (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_tcp_offset (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_tcp_res (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_tcp_flags (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_tcp_cwr (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_tcp_ece (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_tcp_urg (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_tcp_ack (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_tcp_psh (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_tcp_rst (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_tcp_syn (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_tcp_fin (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_tcp_window (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_tcp_sum (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_tcp_urgptr(struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_tcp_options (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_tcp_end(struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_dns_query(struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_dns_answer(struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_dns_ttl(struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_dns_end(struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_arp_hwtype (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_arp_prtype (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_arp_hwaddrsize (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_arp_praddrsize (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_arp_opcode (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_arp_smac (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_arp_sip (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_arp_tmac (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_arp_tip (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_arp_trailer (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_arp_end(struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_bpdu_id (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_bpdu_version (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_bpdu_type (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_bpdu_flags (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_bpdu_rid (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_bpdu_pc (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_bpdu_bid (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_bpdu_pid (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_bpdu_age (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_bpdu_maxage (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_bpdu_hello (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_bpdu_fwd (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_bpdu_mode (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_bpdu_vlan(struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_bpdu_end(struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_igmpv2_genquery (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_igmpv2_specquery (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_igmpv2_report (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_igmpv2_leave (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_igmpv1_query (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_igmpv1_report (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_lldp_conformance (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_lldp_chassis_id (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_lldp_port_id (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_lldp_ttl (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_lldp_vlan (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_lldp_opt_tlv (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_lldp_opt_tlv_bad (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_lldp_opt_org (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_lldp_endtlv (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_lldp_reset (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_ip_address_source (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_ip_address_destination (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_ip_version (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_ip_ttl (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_ip_protocol (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_ip_hlen (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_ip_len (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_ip_id (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_ip_offset (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_ip_sum (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_ip_tos (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_ip_dscp (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_ip_rsv (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_ip_df (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_ip_mf (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_ip_fragsize (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_ip_fragoverlap (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_ip_option (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_ip_delivery (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_ip_end(struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_rtp_version (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_rtp_padding (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_rtp_xten (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_rtp_marker (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_rtp_cc (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_rtp_pt (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_rtp_ssrc (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_rtp_sqnr (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_rtp_time (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_rtp_extension (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_rtp_source (struct cli_def *cli, const char *command, char *argv[], int argc);
int cmd_rtp_cclist (struct cli_def *cli, const char *command, char *argv[], int argc);
#endif
|