Create a Prompts file

This topic describes how to create a Prompts file.

The prompts file includes a single section: Conditions.

TPC matches the conditions that you define in this file to the prompts it received from the target machine in order to determine the proceeding state.

To create a Prompts file:

  1. Create a prompts file with the following format:

     
    ##########################################################################
    ###			PROMPTS FILE
    ### 			Version vXX.YYYYMMDD.ZZ
    ##########################################################################
    
    [conditions]

     

     

    You can use the Plugin Generator Utility to create a base for your file. For details, see Plugin Generator Utility

  2. Add a list of conditions. For details, see Conditions.

    Review the Create a Prompts file, Complex prompts, and Expression conditions sections for information on how to best create conditions.

Conditions

A condition is made up of a logical name and value, and has the following structure:

Name=value

Name

The name of the condition

Alpha-numeric

Value

The value of the expected prompt

Depends on the type of condition

The value of the condition can be defined in one of the following ways:

Complex prompts

Complex prompts are prompts that include regular expressions.

A list of regular expressions can be compared in a single conditions using '|' between the regex expressions.

Complex prompts have the following format:

Name=(prompt)Prompt

Or

Name=Prompt

 

Example 1:

Login=Login as:

A prompt condition that is expected at the beginning of the login process.

The condition name is Login. The value is the prompt Login as:, which is a common prompt that is expected when logging in to a remote UNIX machine using SSH.

In this case, the text is matched as is.

 

 

Example 2:

Login=login as:|login:

This is an extension of the previous example. In this example, multiple Linux\Unix are supported by allowing different Login prompts that may be returned from the target.

 

 

Example 3:

NewPassword=Changing password for.*New password:

A prompt that requires sending the new password during a password change. The prompt returned from the target includes the name of the user, so we use the regular expression ".*", which indicates "any text", to represent the user name.

 

 

Example 4:

StandardPrompt=.*\$ ?$|.*\# ?$|.*\> ?$|.*\% ?$|.*\] ?$|.*: ?$

In this example, we want to catch the standard prompt returned. The standard prompt may change from different flavors of Linux\Unix and can also be modified by on specific targets. In this case, we compare the returned prompt to a list of possible standard prompts, all defined as regexes which start with ".*" indicating "any text" and ending with the relevant standard prompt.

Expression conditions

You can use boolean expressions in your prompts. Use the keyword (expression) followed by a Tcl expression.

 

Example 1:

ActionIsVerify=(expression)[string equal -nocase "<action>" "verifypass"]

In this example, we want to check that the action that is current running is Verify. We do so using a string comparison of the built in parameter <action> and the constant string "verifypass".

 

 

Example 2:

IsVerifyLogon=(expression)$VerifyLogon == 1

In this example, we use integer comparison to validate that the variable $VerifyLogon which is previously set to a value using a set command is now set to the value 1.

 

 

Example 3:

TRUE=(expression)true

In this example, we set a condition which is always true using the keyword "true". In the same way, we can create a condition which is always false using the keyword "false".

 

 

Example 4:

 sExtraPassExists=(expression)<pmmaxextrapassindex> == 1

A conditional expression that checks whether or not an additional password is specified.

The condition is IsExtraPassExists. Because the keyword "(expression)" is used at the beginning of this conditional value. The expression is ‘<pmmaxextrapassindex> == 1’ which compares the environment variable pmmaxextrapassindex to 1. This environment variable contains ‘1’ if an extra password is specified or ‘0’ if there is no extra password.

See also: Create a Process file