Legacy Communication Made Easy
[ start | index | login ]
start > Plugin Script

Plugin Script

Created by leo. Last edited by leo, 11 years and 104 days ago. Viewed 19,469 times. #2
[diff] [history] [edit] [rdf]
For those who need to take autmatic actions this plugin is a good start.
The Script plugin MUST be BETWEEN the Telnet or SSH Plugin and the Terminal plugin. The order of plugins in the plugins line is important!
Example: plugins=Status,Socket,Telnet,Script,Terminal

To automate certain processes like login into guest accounts or BBS' the script plugin enables you to write simple scripts of pattern and answer pairs to be sent to the remote host if the pattern was found in the data that came from the remote host.

To use the script simply put it into the plugin list as described in the configuration of the Application or Applet. The script language itself is very basic:

Any number of pattern and text pairs can be given and they will be processed in the order they appear in the script. That means if pattern is not matched pattern_1 will not be processed!

For example the following script would login into some computer:

It first waits for the pattern "login:" and sends the text "leo\n" (\n is a newline). Then it waits for the pattern "password:" and if that appears it sends "mypass\n". Next you could add some pattern that looks like your command prompt and issue a shell command.

If the first pattern is empty, its answer string will be sent on connect. For instance:

Script.script=|connect foo|login:|leo|password:|mypass
will send 'connect foo' upon connect.

Script.scriptThis property contains the script that is used by the plugin. See above for the actual "script language".

no comments | post comment
legacy communication tools for JAVA(tm)

javassh.org | Copyright 1996-2009 Matthias L. Jugel and Marcus Meißner

JAVA is a trademark or registered trademark of Sun Microsystems, Inc. in the United States and other countries.
The JTA - Telnet/SSH Authors (Matthias L. Jugel and Marcus Meißner) are independent of Sun Microsystems, Inc.