"Fossies" - the Fresh Open Source Software Archive 
As a special service "Fossies" has tried to format the requested text file into HTML format (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
1 xstress version 0.38 beta - xk0derz SMTP Stress Tester
2
3 http://xstress.sourceforge.net
4
5 (c) Amit Singh, amit@xkoder.com
6
7 http://xkoder.com
8
9 This software and related files are licensed under GNU GPL version 2
10 Please visit the following webpage for more details
11 http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
12 or read the accompanying LICENSE file.
13
14 Special thanks to Bob Trower for the base64 utility he made
15 http://base64.sourceforge.net/
16 This utility is licensed under the MIT license
17 please see the b64.c source file for the complete license.
18
19
20
21 Introduction
22 ~~~~~~~~~~~~
23
24 xstress is an SMTP Stress Testing Tool. Essentially xstress
25 creates multiple connections to (your) mail server
26 and sends multiple mails repeatedly over all connections.
27
28 xstress understands only SMTP protocol. No authentication
29 mechanism is supported at the moment.
30
31 xstress may be used to stress test normal SMTP servers,
32 test Anti-Virus and Anti-Spam softwares that accept
33 or filter SMTP connections and the like.
34
35 using xstress you can specify a list of the following
36 to be used for sending mails
37 1) TO address list
38 2) FROM address list
39 3) SUBJECT list
40 4) list of BODY content files/directories
41 5) list of ATTACHMENT content files/directories
42
43 xstress randomly makes a combination from the available list and
44 sends mails to the configured SMTP server.
45
46 Building binary
47 ~~~~~~~~~~~~~~~
48
49 uncompress the source archive using the following command
50
51 $ tar -zxvf xstress-src-n.nn-mmm-YYYYMMDD.tar.gz
52
53 where n.nn-mm-YYYYMMDD are the version and timestamp respectively.
54 example: xstress-src-1.00-stable-20010703.tar.gz
55
56 Now,
57 Switch user to root (using the su command) and type the following
58 command from the directory where you have un-compressed the xstress
59 source archive and run the following command to build the xstress
60 binary.
61
62 # make
63
64 The above command will create the xtress binary in the bin folder
65 and copy the default xstress.conf file to the bin folder. If
66 the file already exists you'll be aksed if you want to over-write it
67 or not.
68
69 The make command also creates the base64 utility used by xstress
70 and copies it to the bin directory
71
72 ** NOTE: base64 utility is required for xstress to send binary
73 attachments properly.
74
75 If you get any error while doing a `make',
76 run the following command befor you do make.
77
78 # make clean
79
80 Alternatively you may run the build shell script by typing
81
82 # ./build
83
84 which runs `make clean' first and then does a `make'
85
86
87 Usage and command line options
88 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
89
90 NOTE: xstress requires GNU GCC C/C++ compiler for source code compilation and
91 libc for execution.
92
93 Most linux distribution (like Fedora Core, Red Hat)
94 bundle these in their disribution, but distros like Ubuntu, normally do not have
95 these packages bundled. You'll need to download and install these packages to
96 compile the xstress source and run it properly.
97
98
99 To build the binary,
100 Move to the bin folder and type ./xstress to invoke the tool.
101
102 Syntax:
103 $ xstress [options]
104
105 Here options are one or more of the following...
106
107 -v, --ver, --version Display xstress version and exit.
108
109 -h, --help Display this help message
110
111 -t <value>, --threads <value> Set number of threads to spawn.
112 Range for value is 1 to 100, inclusive.
113
114 -m <value>, --mails <value> Set number of mails to send per thread.
115 range for value is 0 to 60000, inclusive.
116 * A Value of 0 for mails means unlimited mail.
117
118 -s <IP>, --server <IP> Set the mail server IP
119 IP is in dotted decimal format
120
121 -p <value>, --port <value> Set the mail server port
122 value is the port number of the mail server
123
124 -u <username> You SMTP server username.
125 --username <username>
126
127 -P <password> Password for the username you specified using
128 --password <password> the -u or --username switch.
129
130 * Username and password both have to be provided
131 for authentication to work.
132 If either is not specified, authentication will
133 be skipped.
134
135 -a <type>, --auth-type <type> Authentication mechanism to use.
136 * Currently only PLAIN is supported.
137
138 --timeout <value> Set connection timeout (in seconds)
139 values is a non zero positive integer
140
141 --conf <filename> Configuration file to use, instead of the
142 default file 'xstress.conf'.
143 `filename` is the full path to the alternate
144 configuration file.
145
146 -d, --debug If this switch is specified, verbose debug messages
147 with complete traffic will be printed on screen.
148
149 --logfile <filename> Set alternate log file to use, instead of the
150 default 'xstress.log' file.
151 `filename` is the full path to the alternate
152 log file.
153
154 **Note: command line options always override configuration file settings
155
156
157 Configuration file
158 ~~~~~~~~~~~~~~~~~~
159 By default xstress reads its configuration from the file 'xstress.conf'.
160 This file should be present from where you invoke the xstress program.
161
162 A typical configuration file consists of six sections. Out of these the
163 CONFIG section, TO section, SUBJECT section and FROM section are
164 compulsory.
165
166 COMMENTS start with the hash (#) sign on the 'first column only'.
167 Blank lines are ignored. The parser is not designed to handle extra spaces
168 so don't play with them.
169
170 Var = Value : will NOT work
171 Var=Val : will work!
172 Var=Val : will NOT work
173
174 TO and FROM sections contains list of email addresses, one per line,
175 to be used as recipent address and sender address respectively.
176
177 SUBJECT Section contains list of subject text, one per line,
178 to used for e-mails being sent by xstress.
179
180 BODY Section contains list of (text) files or directory.
181 The content of these files is used as the mail's body text.
182 If a directory is specified, Content of all the files under
183 that directory is used as body text.
184
185 ATTACHMENT Sections contains list of (text) files or directory.
186 The listed files will be attached to the mails being sent out
187 from xstress. If a directory is specified, all files present
188 within that directory are used for attachment.
189
190 The file list or directory name can be prfixed by an optinal
191 FILETYPE tag as follows.
192
193 [ATTACHMENT]
194 path/to/file!type
195 path/to/directory!type
196
197 The exclamation sign (!) separates the attachment file-name/directory
198 from the type.
199
200 Following types ares understood by xstress.
201
202 1) bin - binary files
203 eg: MS Word document, compressed archives, MP3 files etc.
204 ** Whenever in doubt use this type
205 2) plain - Plain text files
206 eg: Source Code, Text files, scripts etc.
207 3) html - HTML source
208 4) image - Image files
209 Any image file, treated as `bin' but disposition is inline.
210
211
212 CONFIG Section contains variables that configure the mail server
213 to be used, number of threads and the like.
214
215
216 Variables understood by xstress are described below
217
218 SERVER - Specify the SMTP Mail Server's IP here.
219 Example: 172.16.0.1
220
221 PORT - Specify the SMTP Mail Server's port number here.
222 This is typically 25.
223
224 USERNMAE - Your SMTP server username.
225 PASSWORD - Password for your username.
226
227 AUTH_TYPE - Authentication mechanism to use.
228 Currently only PLAIN is supported.
229
230 * To skip authentication comment out USERNAME or PASSWORD variable.
231
232 DEBUG - set to true if you want debug messages with complete traffic printed
233 on scree. Default value is false.
234
235 THREADS - Specify number of threads to spwan
236 The value can range from 1 to 60000
237
238 A thread represents one connection to the Mails Server.
239
240 Higher the number of threads, more mails per second
241 can be sent by xstress.
242
243 MAILS_PER_THREAD - Speciy the number of mails to be sent per
244 thread. The value for this can range from
245 0 to 60,000.
246
247 value of ZERO means unlimited number of mails per
248 thread. You have to use ^C (control + C) to quit
249 xstress if you use ZERO for this variable.
250
251 REPORT_AFTER - Specify the number of mails, after which xstress will
252 print a message on screen.
253
254 A Value of ZERO means print no message.
255
256 Message Printed is in the format
257
258 Thread:: <id>: T: <num1>, S: <num2>, F: <num3>
259
260 Where
261 id the thread ID
262 num1 is [T]otal number of mails to be sent for that thread
263 num2 is count of mails [S]ent succesfully
264 num3 is count of mails [F]ailed
265
266 LOG_FILE - Set the log file to be used if you dont want to use the
267 default log file 'xstress.log'. After xstress finishes, a
268 thread by thread report is append to this log file.
269
270 TIMEOUT - Specify connection timeout in seconds after which xstress
271 will give up.
272
273 TIP: If you are specifying ZERO for MAILS_PER_THREAD, put a low
274 value here, as you would not like xstress to wait for too long before
275 it sends a new mail. A low will timeout that session sonner and xstress
276 will try sending a new mail (taking corrective action if possible).
277
278 If you specify some amount of mails, you may like to put a large number
279 for TIMEOUT, so that before calling it quit, xstress will wait to see
280 if the server responds.
281
282 Example attachment and body files
283 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
284 The bin directory contains some example body and attachment files.
285 The default configuration file xstress.conf lists these files to be
286 used as body and attachment for the mail.
287
288 Body Files:
289 body1.txt - Plain Text file
290 body_dir/body2.txt - Plain Text file
291
292 Attachment Files:
293 attach_dir/images_dir/xstress.jpg - Image file
294 attach_dir/attach1.htm - HTML File
295
296
297 * The source code has been tested with GNU C/C++ compiler version 4.1.2 20070502