You can prepare a text file with list of command lines and play the file via Token2Shell. The connected remote system will see the played file as command lines that were typed and sent by you. Token2Shell also supports a set of wait/send style script commands.
Script Commands
When you create a macro file, its content is interpreted by line. A text line ends with <CR><LF> control characters and Token2Shell removes heading and trailing white spaces.
For each line, if the line starts with a "#" character, Token2Shell tries interpret the line as a macro command and its arguments. If it fails, the line is sent as it is along with line-end characters. The line-end characters are determined from the current session states.
// sends "abc" #send "abc"
If you wish Token2Shell to interpret the line starting with "#" as a normal character, use two "#" characters.
// sends "#send "abc"" and line-end characters ##send "abc"
Token2Shell supports the following commands:
- #sendwait line_send_interval_in_milliseconds
Sets the interval between sending each non-command line text. If line_send_interval_in_milliseconds is preceded with a minus(-) character, the sending is paused until there is no incoming data for line_send_interval_in_milliseconds.
When a macro file is loaded, the sending interval is set to -300 milliseconds, i.e., the next line is sent when there is no incoming data for 300 milliseconds.
- #wait wait_time_in_milliseconds
Pauses the macro processing for wait_time_in_milliseconds.
If wait_time_in_milliseconds is preceded with a minus(-) character, the processing is paused until there is no incoming data for wait_time_in_milliseconds.
// Wait for 3 seconds. #wait 3000 // Wait until there is no incoming data for 2 seconds. #wait -2000
- #send "string"
Sends "string" (without the quotation marks).
Line-end characters are not automatically sent. - #waitfor "string"
Monitors the incoming data stream and waits until the "string" appears.
Token2Shell Escape Sequences
You can use the following escape sequences to insert control or special characters in a "string":
CTRL | DEC | BIN | OCT | HEX | Token2Shell Escape Seq. | |
---|---|---|---|---|---|---|
NUL | ^@ | 0 | 000 0000 | 000 | 00 | |
SOH | ^A | 1 | 000 0001 | 001 | 01 | |
STX | ^B | 2 | 000 0010 | 002 | 02 | |
ETX | ^C | 3 | 000 0011 | 003 | 03 | |
EOT | ^D | 4 | 000 0100 | 004 | 04 | |
ENQ | ^E | 5 | 000 0101 | 005 | 05 | |
ACK | ^F | 6 | 000 0110 | 006 | 06 | |
BEL | ^G | 7 | 000 0111 | 007 | 07 | |
BS | ^H | 8 | 000 1000 | 010 | 08 | \b |
HT | ^I | 9 | 000 1001 | 011 | 09 | \t |
LF | ^J | 10 | 000 1010 | 012 | 0A | \n |
VT | ^K | 11 | 000 1011 | 013 | 0B | |
FF | ^L | 12 | 000 1100 | 014 | 0C | |
CR | ^M | 13 | 000 1101 | 015 | 0D | \r |
SO | ^N | 14 | 000 1110 | 016 | 0E | |
SI | ^O | 15 | 000 1111 | 017 | 0F | |
DLE | ^P | 16 | 001 0000 | 020 | 10 | |
DC1 | ^Q | 17 | 001 0001 | 021 | 11 | |
DC2 | ^R | 18 | 001 0010 | 022 | 12 | |
DC3 | ^S | 19 | 001 0011 | 023 | 13 | |
DC4 | ^T | 20 | 001 0100 | 024 | 14 | |
NAK | ^U | 21 | 001 0101 | 025 | 15 | |
SYN | ^V | 22 | 001 0110 | 026 | 16 | |
ETB | ^W | 23 | 001 0111 | 027 | 17 | |
CAN | ^X | 24 | 001 1000 | 030 | 18 | |
EM | ^Y | 25 | 001 1001 | 031 | 19 | |
SUB | ^Z | 26 | 001 1010 | 032 | 1A | |
ESC | ^[ | 27 | 001 1011 | 033 | 1B | \e |
FS | ^\ | 28 | 001 1100 | 034 | 1C | |
GS | ^] | 29 | 001 1101 | 035 | 1D | |
RS | ^^ | 30 | 001 1110 | 036 | 1E | |
US | ^_ | 31 | 001 1111 | 037 | 1F | |
\ | 92 | 101 1100 | 134 | 5C | \\ | |
DEL | ^? | 127 | 111 1111 | 177 | 7F | |
\x{HEX}
{HEX} is interpreted as a HEX value of the character.Ex.) \x09 denotes <Tab> control character. |