Additional Tools Telnet/SSH
3 minute read
Docusnap offers with additional tools to optionally execute commands on a target system and save the results in Docusnap.
The desired additional tool is created via the New button. The name of the program can be freely defined. A description does not have to be entered.
Two templates were created for a quick start. A configuration query is created on a switch (without manufacturer reference). The example is available for the call via Telnet and via SSH. The template can be copied and adapted as desired.
Clicking the Adjust button opens the sequence editor. The sequence of commands to be executed on the target system to obtain the required execution results is called a command sequence. Here, as in a batch processing, the required commands are created and processed. The built-in Test Sequence function can be used within the editor to test the created command sequence on the target system. If a command fails, the user receives feedback as to which command in this sequence caused a problem. However, a syntax check does not take place. In order for the sequence to be tested, the target system must already be inventoried as an SNMP device of type Switch in Docusnap.
Create Command Sequences
Generally, the same commands are used for Telnet and SSH. The main difference between the two protocols is the authentication. In the Telnet version, the handling of user name and password must be entered in the command sequence, but this is not required for SSH.
Currently supported commands
- DelayWait: Creates a pause to give the target system some time to establish a connection or to execute asynchronous commands if necessary. The wait time in milliseconds can be passed as a parameter.
- ResponseStringWait: Waits until a string defined as parameter is displayed in the console. In the examples, # (followed by a space) waits for the console prompt. Using this check between commands increases the stability of the query.
- ResponseRegexWait: Same function as ResponseStringWait but a regex expression is passed instead of the string. An example of the console prompt in regex notation would be .*#\s$
- Command: This command is used to query technical details of the target system (e.g. show running-config). It is also required to control the console behavior. For example, Command is used without parameters when the console is waiting for “any key” input. It is also a good idea to use the command “no page” to disable the page switching of the console. In general it is recommended to run through the command sequence in the console beforehand to detect possible problems in advance.
- ResponseCapture: This command “starts the console output capture for Docusnap”. All previously executed commands are not present in the Docusnap output. It is important to create commands following the capture as a subsequence using the plus sign next to the command. The capture only returns data from commands that are within this command grouping. In the editor, these commands are additionally indented below the capture. It is recommended to check the console prompt as the final command of a capture sequence.
Currently supported optional commands within a capture sequence
The captured output can optionally be edited before it is transferred to Docusnap, e.g. to remove unwanted formatting or security relevant information from the output. For this purpose, the following commands must be created within the capture command grouping.
- ResultCleanString: The command has two parameters “Find” defines the string to be processed, “Replace” the string to be applied. For example, the string “Community Geheim#2021” becomes the string “Community *********”.
- ResultCleanRegex: Works like ResultCleanString and uses regular expressions instead of strings in the parameters. This can be very convenient if, for example, you want to always replace the characters after “password with *****. The regex expression here would be password\s.*.