Scroll to navigation

smssend.scripting(1) General Commands Manual smssend.scripting(1)

NAME

smssend - The sms sender (to GSM)

SYNOPSYS

How to make a script for smssend.

DESCRIPTION

The scripts for Smssend are easy to make, but you'll have to follow some steps. First, I suggest you use a tool like tcpdump or ethereal, to trace the output traffic of your box. So, use your usual navigator and connect to the site you wish to make a script for, and send a sms (do all this while tracing output). With this, you'll have the URL to call, and the parameters to use (even the POST parameters). You are now ready to write your script (see an example at the end of this man page) : The line starting with a # are comments. On the first line, give the site's name. On the second, give the version number of your script (#Version x.xx). This is really important, because smssend uses this line to detect new version of the script. On the third line, give your name and email address. On the following lines, give the error messages that can happen running the script, with their number. Then, give the arguments the script will be waiting for, then aliases, and finnaly the commands.

ARGUMENTS

First, you must give a line with the number of arguments (NbParams x). An argument line starts with a % and must be like this : %Name [Type] : Help message

Here are the different types

Tells this argument is a password and must be hidden.
Tells that this argument must be converted (space are converted to +, and non alphanum are converted to ascii code).
Gives the maximum size are this argument in characters (for message, there is often a max size).

ALIAS

Aliases are very useful, and are used next for dynamic replacement (you'll soon understand). An alias line starts with a $ and must be like this : $Argument alias Argument being the name of an existing argument (case non sensitive) and alias the name to search when replacing <input> tags.

COMMANDS

One command per line. SmsSend defines blocs of commands (or phases) which are GET or POST requests. Each bloc must ABSOLUTELY starts with one of the GetURL or PostURL command, and ends with a GO, and must contain only ONE of these command. Between this two lines, you can add all optional commands as you wish. You can also (and you'll have to anyway) substitution commands (see next chapter).

One and only one of these command per bloc, followed by the url to fetch without parameters and without the '?' (parameters are what is after a '?' in an URL) !!
Gives the parameters associated with the URL to fetch (what is after a '?' in an URL), but without the '?'.
Gives the referer of this url (some pages check if the Referer is correctly set).
Gives data from a form to send (must be used with PostURL).
Tells the soft to make a sleep of delay secondes before sending this request.
Tells the soft not to add the INPUT tag of Name in the RTGetForm command of the same bloc.
Adds a static cookie for Path (not NULL, use / for whole path) in Domain : Name=Value. The cookie will be added starting at Phase (the first one is 1).
Marks the end of a bloc.
Tells the soft to look for text in the response of our sent request. Must be followed be ErrorMsg or PrintMsg. Only ONE Search per bloc (for more searches, use ElseSearch after this one).
Tells the soft that there are more than one search to perform (Do not forget to use a Search before this ElseSearch). Must be followed by ErrorMsg or PrintMsg.
Tells the soft what to do if no search matched. Must be followed by ErrorMsg or PrintMsg.
Tells the soft to display message before exiting with the error code num, if the search matched.
Tells the soft to display message before continuing, if the search matched.

DYNAMIC REPLACEMENTS

Here comes what is the more powerful with SmsSend : dynamic replacements. a Dynamic replacements is defined like this : Name[-param]*% The name must be the name of an argument (no alias in name !), or the name of an internal command. Most internal commands requiere parameters, wich are separated by '-'. If a '-' is specified with an argument name (Arg-x-y%), only the sub string starting at Arg+x of size y chars is copied. Here is the list of these commands :

Replaces the URL which was sent during phase num (the first phase being 1, and automatic redirect being counted).
Replaces the data which was sent during phase num (the first phase being 1, and automatic redirect being counted).
Replaces the hostname which was used during phase num (the first phase being 1, and automatic redirect being counted).
Replaces with URL of link name searched in the result from phase num (the first phase being 1, and automatic redirect being counted).
Replaces with the VALUE field of the INPUT tag of NAME name searched in the result from phase num (the first phase being 1, and automatic redirect being counted).
Replaces with the fields (defined by flags) of the INPUT tag of index idx (the first input being 1) searched in the result from phase num (the first phase being 1, and automatic redirect being counted). Flags : {a:NAME=VALUE}{n:NAME}{v:VALUE}{t:TYPE}. If flags is in upercase, " are added between fields.
Replaces with the NAME and VALUE fields of the INPUT tag of index idx (the first input being 1) of the form ind (the first form being 0) searched in the result from phase num (the first phase being 1, and automatic redirect being counted).
Replaces with the ACTION field of the form ind (the first form being 0) searched in the result from phase num (the first phase being 1, and automatic redirect being counted).
Replaces with ALL INPUTs (NAME=VALUE) of the form ind (the first form being 0) searcged in the result from phase num (the first phase being 1, and automatic redirect being counted). Except for all replacements already made (in the SAME command) if the NAME field of the INPUT tag in found in the replacements done (aliases are very useful here, if the NAME field have an awful name, and we wish to replace it with the Login argument of the script for example). In the same way, all NoAdd values defined in the same bloc are not added.
Replaces with string found juste after textBefore (after removing spaces and string delimiters) searched in the result from phase num.
Replaces with sub th sub part (a sub part is delimited by a /, the first one is just after domain name) searched in the url from phase num.
Replaces with url of frameset of name searched in the result from phase num.
Searches result from phase num using regular expression regex and returns pos match from the gpos run (this means, that the source is matched against regex gpos times starting at the end of previous match). For regular expressions syntax see pcre manpage.

EXAMPLE

Here is a script example of smssend :

## SkySMS provider file - www.kiwee.com ##
# Version 1.03
# by Ze KiLleR <zekiller@-REMOVE-skytech.org>
# Error codes :
#  1 -> Bad Login/Password
#  2 -> Daily message quota exceeded
#  3 -> ASP/SQL timeout
#  4 -> Error sending message
NbParams 5
%Login : Your login from www.kiwee.com
%Password Hidden : Your password
%Pseudo : Kiwee Pseudo of recipient
%Type : Type of sms : 0 (flash sms) or 2 (normal sms)
%Message Size=125 Convert : Your message
# Logging on Kiwee
GetURL http://www.kiwee.com/sms/
GO
PostURL http://www.kiwee.com/Verifmembre.asp
PostData LoginName=Login%&Password=Password%
Search  votre pseudo et/ou votre mot de passe
ErrorMsg 1 Bad login and/or password
GO
GetURL http://www.kiwee.com/sms/
GO
# Sending message
PostURL http://www.kiwee.com/sms/sendsms.asp
Params previous=sms.asp
Referer http://www.kiwee.com/sms/
PostData from=Login%&topseudo=Pseudo%&PhoneNumber=&class=Type%&message=Message%&arandom=2
Search confirmsms.html
PrintMsg Message successfully sent
ElseSearch atteint votre limite d'envoi
ErrorMsg 2 Daily message quota exceeded
ElseSearch Timeout expired
ErrorMsg 3 ASP/SQL timeout
Else
ErrorMsg 4 Error sending message
GO

SEE ALSO

smssend(1)

COPYRIGHTS

Copyright (c) 2000'03 - Christophe "Ze KiLleR" Calmejane <zekiller@-REMOVE-skytech.org>

Distributed under GNU General Public License v2; see COPYING file for more informations.

AUTHORS

Christophe "Ze KiLleR" Calmejane <zekiller@-REMOVE-skytech.org>

april 23th 2002 Version 3.4