MagicTree Table View is a powerful interface for querying and analyzing the gathered test data. The results of the queries performed in Table View may be fed to commands (see Commands Execution)
The Table View includes three panels. The topmost panel is the query editor. It allows specifying and executing the queries.
The middle panel shows the query results:
The pannel at the bottom is the task editor. It allows entering a command to run localy or remotely specifying how the data from the table is fed to the command.
Query Editor Panel
Query Editor panel is used for specifying the table queries. The query is specified inside the table. Each row of the query table corresponds to a column in the query results table. When executing a query, MagicTree processes it row by row, ignoring rows with empty expressions. Subsequent rows are executed in the context of previous ones. Standard XPath syntax, ".", can be used to refer to the node returned by the expression in the previous row. Additionally, results of the previous rows can be accessed using $_N syntax, where N is a number of the row, 0 being top one. See Back Reference Variables in XPath Queries for more details.
The first table column is used to specify the query field name, or column name. This name will be used as a column title in the results table. If you use the "Environment" input mode in the task editor, an environment variable with this name will be created for each row of the results table. Because of that the query field names may only contain letters, numbers and underscores ("_" - that's an underscore, not a smiley). Using the type of the node that will be returned by the query expression, usually makes sence here, for example "host", "port", "os", etc.
The second table column is used to specify the XPath expression. See XPath Crash Course for some examples.
The third and fourth table columns are used for setting "Leaf" and "Hidden" flags. They are also described in XPath Crash Course.
To add a row to the query table click on "+" button on the right of the table. To remove a row, click on "-" button. The two arrow buttons move the currently selected row up and down respectively.
To execute the query, click on "Run" button. If the query takes a lot of time to execute, you can stop in by clicking the "Stop" button.
Executed queries are remembered in the query history. You can load and execute previously executed query by clicking on "<Prev" button. "<Prev" and "Next>" buttons allow going through the query history backwards and forwards. Queries can be saved in a repository (see also Using Repositories) for future reuse. To save currently displayed query in the repository, click on "Save" button, fill in the form (see Using Repositories) and click on "Save" button in the form.
To clear the query editor, click on "Clear" button.
Query Results Panel
Query results panel shows the results of the most recently executed query.
"Copy to Clipboard" button copies the currently selected rows in the table to the clipboard. The cell values are separated with "|" (pipe) character. The rows are separated with new line.
"Clear" button clears the contents of the table.
"Table cell click action" radio buttons control what happens when the user selects a cell or cells in the table. When "none" is selected, nothing special happens. When "select" is selected, cells selected in the table are also selected in the tree. When "filter" is selected, the tree view is filtered, so only the items selected in the table are shown in the tree.
The query results table cells have a context menu. It allows setting the status (see also Using Node Status) of the nodes, listing inputting and outputting tasks (see Tracing Data Origin) and invoking the Query Wizard (see Query Wizard).
Task Editor Panel
Task Editor Panel is used for entering the commands to execute and specifying how the data from Query Results Panel will be fed to the command. See Commands Execution for detailed description on how the MagicTree executes the commands and handles input and output.
The task editor allows you to select how to feed the input from the query results table to the command being executed. The radio button group in the upper-right corner allows to select "Environment", "TabSep in $in file" or "None" input mode.
MagicTree can either start a program or script feeding it the whole content of the query results table via a file or start several instances of a program or script, feeding each the contents of one table row via individual command-line parameters.
To feed the contents of the table via a file, select the "TabSep in $in file" input mode in the task editor.
Feeding query results via an input file
To feed the contents of the table via individual parameters select "Environment" input mode. When the "Environment" input mode is used, MagicTree starts one instance of a program or script specified in the common line for each highlighted table row (so you can select which rows you want processed). Before executing the command itcreates an environment variable for each table column and initializes it to the value of the column cell. This way the contents of the table can be used in the command line.
In the example above, the command line contains:
nikto -host $host -port $port
MagicTree will start two instances of nikto:
nikto -host 192.168.1.101 -port 80
nikto -host 192.168.1.100 -port 80
When "None" input mode is selected, no data is fed to the command.
The command combo-box is for specifying the command to be executed. The entered command is executed by BASH shell (using BASH from Cygwin on Windows, bundled with MagicTree), so normal shell syntax must be used.
The User@Host combo-box allows specifying the remote host where the command will be executed. The remote host must have SSH daemon and have basic Unix programs.
Before running a command on a remote host for the first time with MagicTree, click on "Push SSH key" button. For remote execution to work, it is necessary to arrange for MagicTree to be able to log into remote host without a password, for example by generating SSH public/private key pair and placing the public key into .ssh/authorizedÂ keys file on the remote host.
Press "Push SSH Key' button to run a configuration script facilitating this task. When prompted, enter "username@host'. When SSH client asks for a password, enter it. MagicTree will append newly generated key to ~/.ssh/authorizedÂ keys. The keys have a specific comment "Autogenerated by MagicTree', so you can easily identify and remove them later if necessary. Pay attention to error messages generated by the script. If everything went fine it will say "Succeeded!". After this SSH key is pushed to the remote host, you can execute commands there by specifying the same "username@host' as host when launching command. You should specify the same "username@host' to avoid problems.
To execute the command, click on "Run" button.
"Save" button allows to save the current command (method) to the repository. See Using Repositories for more information.