WEb Stress Tool (WEST) Command Reference

Submission commands:
urlURL
                                  
getframe
getlink
submitform
redirect

Data manipulation:
adddataDATA
adddefaultDATA
setdataVARIABLE DATA
selectframe FRAMENUMBER
selectlink LINK_NUMBER
selectlink + [-n NAME/ALT TAG] [-l LINK]
selectlink - [-n NAME/ALT TAG] [-l LINK]
selectlink random
selectform regex body PATTERN ACTION
selectform + [-n NAME] [-t TYPE] [-v VALUE]
                                  

Commands to change operating parameters (flags):
post
nopost
get - not implemented
http
https - not implemented
verbose
noverbose
setchild
noproxy
timeout
relax forms
autoredirect

Commands to fake data:
makeform -t TYPE -a URL
makecookie -v VALUE
set_referer URL

Commands to control/create output:
logfile LOGFILENAME
echo "Say this to the user"
dump
parse
showlink - not implemented

Special commands for my laziness:
addsub ORIGVALUE NEWVALUE
savepage PAGENAME
loadpage PAGENAME

Other special commands:
multiply NUMBER
hitfile NUMBER
sleep NUMBER

The Lone Flow Control Command:
exit NUMBER

Reserved variables:
$$the ID (not pid) of the current process
$ARGV1, $ARGV2 ... arguments on the command line after the script name
$CURRENT_TIME_UNIX The current time in seconds since the epoch
$PAGENAMEurlHtml the URL of the saved page PAGENAME, HTML-encoded. As a special case the current page is named "current" (i.e. $currenturlHtml)
$PAGENAMEpageHtml the entirety of the saved page PAGENAME (text and all), HTML-encoded. As a special case the current page is named "current" (i.e. $currentpageHtml)
$PAGENAMEpageFormsHtmlall the forms and their data from the saved page PAGENAME, HTML-encoded. As a special case the current page is named "current" (i.e. $currentpageFormsHtml)
$PAGENAMEpageLinksHtmlthe links from the saved page PAGENAME (text and all), HTML-encoded. As a special case the current page is named "current" (i.e. $currentpageLinksHtml)


url URL
This simply performs a GET on the specified URL and stores it as the current page. It automatically senses https:// being an SSL connection.

getframe
Retrieve the selected frame (selected using selectframe) and make it the current page. This function will fail if there is more than one frame left in the pool. See selectframe for more info.

getlink
Retrieve the selected link (the only left in the pool) and make it the current page. This function will fail if there is more than one link left in the pool. See selectlink for more info.

submitform
Submit a form to the server, complete with any hidden data in that form. Any data added with adddata will also be included. Data that does not have a type of "hidden" or is not specifically included with adddata or setdata will not be submitted to the server. submitform will automatically choose post or get depending on what the form specifies. This can be overridden by using the get or post commands. Again, submitform will fail if more than one form is left in the pool.

redirect
If the current page specifies a Location: header then follow it to its specified destination. If there is no Location: header this command throws a fatal error. Note that the use of this command isn't necessary if you set the autoredirect flag. Also, see information on HTTP redirections. sepcify that the current document has a 300 header and to follow the redirection


adddata
Add data to the next request. Data must be specified in the correct format for the server to interpret it (anything that must be %escaped should be and "+" should be substituted for spaces). Data must be submitted as "name=value&name=value" etc. etc. Do not worry about adding too many or too few ampersands, as those will be corrected before submission.

setdata
Set (add or replace) data for the next request. While adddata always appends data to the current request (potentially creating multiple copies of a data member) setdata will guarantee the value it is adding to the request data is unique. Info about all the "select" functions: When a page is retreived from the server, it is immediately parsed into all its action-inducing elements. All forms are saved together, all the links, etc. Thus there is a pool of forms, links, or frames to choose from. All of the select functions, though, will only work on one item - one form, one link, or one frame. The select functions will either a) take everything currently in the pool and eliminate everything that doesn't match your criteria or b) remove everything that matches your search from the pool, leaving every other element. Assuming all goes well, you should have only one item left by the time you call submitform, getlink, or getframe. If you don't, of course, the program just dies :)

selectframe FRAMENUMBER
select a frame by number. This, of course, is guaranteed to return only one frame. I'm not sure what it'll do if you choose one that doesn't exist, though... the frames are numbered from 1, by the way

a) selectlink LINK_NUMBER
b) selectlink + [-n LINKTEXT_REGEX] [-l LINKURL_REGEX]
c) selectlink - [-n LINKTEXT_REGEX] [-l LINKURL_REGEX]
d) selectlink random
e) selectlink regex body pattern action
modify (narrow) the list of possible links. Once the list has been narrowed to one link then getlink can get it.
See How WEST determines a link's text

selectform NUMBER
selectform match [-n NAME] [-t TYPE] [-v VALUE]
select a from either by number (#ed from 1) or by matching the name, type, and/or value tags of the inputs located within the form.

This form of the selectform command can also be used to "clear" the available forms (for instance, if you want to through out all the forms on the page and make your own using makeform)


post
specify that the next document will be retreived by post

nopost
specify that the next document will be retreived by get

http
specify that the next document will be retreived through HTTP (i.e. not SSL)

https
specify that the next document will be retreived through HTTPS (i.e. with SSL)

verbose
specify more verbosity including telling what commands are being executed.

noverbose
negate an earlier verbose command.


makeform -t TYPE -a URL
creates an HTML form "out of thin air" and adds it to the current page (if there is no current page then it creates a page for the form to be in)

makeform -t post -a https://tstlin02/cat.cgi

would be equivelant to the html

<form type=post method=https://tstlin02/cat.cgi>
</form>


makecookie -v VALUE
creates an HTTP cookie with the sepcified value. The expiration date, domain, and path attributes of the cookie can't be set, since WEST doesn't use them and submission of the cookie doesn't involve them (i.e. neither the server nor WEST cares what those values are).


logfile LOGFILENAME
specify that any further output should go to the logfile LOGFILENAME. This can be used with the multiply command and the built-in $$ substitution to create seperate logfiles for multiple instances...

multiply 5
logfile log.$$

This would create five instances of the scripting engine with the logfiles log.01, log.02, log.03, log.04 and log.05

echo STRING
echo the specified string to the output

dump
Send the current page, completely uninterpreted with its headers still attached to the output.

parse
send a parsed version of the current page to the output. this command will not be affected by the "select" commands.


addsub ORIGVALUE NEWVALUE
Substitute the regular expression ORIGVALUE for NEWVALUE, exactly as in

s/ORIGVALUE/NEWVALUE/g

savepage PAGENAME
save the current state of the program to the variable PAGENAME

loadpage PAGENAME
retreive a program state from the variable PAGENAME


multiply NUMBER
spawn NUMBER processes and start them all at the current place in the script. Used for load testing. This option goes very well with logfile since the output will be unintelligible otherwise. The original process will immediately quit. There is a bug in this function that one of the processes will finish and then start over again right past the multiply statement (i.e. it won't multiply any more but it will go again itself...).

hitfile FILENAME


sleep SECONDS



exit EXIT_CODE