MagicTree Documentation: Scripts and Samples

Commands Execution | Re-using Queries and Tasks (Using Repositories) >

Commands Execution | Table of Contents | Re-using Queries and Tasks (Using Repositories) >

We have provided several sample scripts that either serve as a wrapper around another tool thta does not output XML or perform some useful task and output XML on their own. In addition to that we also ship a simple perl module that can be used to generate MagicTree XML, should you want to write some scripts of your own.

We call these things "snippets', and they are located in "snippets" directory under mtdir.

  • bannergrabber.pl - A simple banner grabber. On stdin this script expects tab-separated list of port-host pairs. On stderr it produces debugging information and on stdout it dumps XML. It can be used as follows:

perl snippets/bannergrabber.pl < $in > $out.xml

  • medusawrapper.pl - A wrapper for medusa remote password guessing tool. Medusawrapper.pl expects the output of medusa on STDIN and outputs MagicTree XML to STDOUT. It can be used as follows:

medusa -h $host -U usernames.txt -P passwords.txt -M telnet | perl \ snippets/medusawrapper.pl > $out.xml

  • resolver.pl - An IP address to host name and host name to IP address resolver. Receives a list of IP addresses and/or domain names as command line arguments or in a file via -i option. It attempts to resolve them and outputs the results to stdout in human readable form. If -o filename option is specified, outputs a MagicTree XML to the specified file. It can be used as follows:

perl snippets/resolver.pl -i $in -o $out.xml

  • sample.pl - A sample perl script that uses MagicTree XMLWriter module to output MagicTree XML containing one host with port 22/tcp

  • MagicTree XML module (located in mtdir/lib). A simple perl module for outputting MagicTree XML. See sample.pl for usage example.

Commands Execution | Table of Contents | Re-using Queries and Tasks (Using Repositories) >