Integrated Scripts
Extend the functionality
of Unsniff
by adding your Ruby or VBScript tools to Unsniff. This
article
explains how you can attach scripts to the Unsniff user interface. This
is a powerful technique that allows you to write interactive tools that
have access to the current user selection contexts and the currently
open capture files.
Integrated scripts allow you to add custom functionality to the Unsniff
Network Analyzer application. You can attach custom scripts to various
menu items in Unsniff which are triggered when the user selects the
corresponding menu item.
In action
Lets see an example of an integrated script in action. In the figure
shown below, a user has written a custom RTP analysis script and
attached it to the packets sheet context menu. The RTP analysis script
will be run when the menu item is selected. The current document and
the selection contexts will be available to the script.
Object Model
Integrated scripts use the same object model described in the Unsniff
Scripting Guide. In addition you get access to the following objects
that enables you to write interactive scripts.
- The currently active capture document (CurrentDocument)
- The current selection context for packets, PDUs, streams,
user objects (SelectedXXX
objects)
- A powerful scripting console that allows you to
output formatted text (CurrentDocument.Console)
Script integration points
You can attach custom scripts to the following menus in Unsniff.
Capture
Menu |
You
can add a menu item under a new top-level menu – or merge
with an
existing top-level menu such as (Tools, Plugins, Edit).
Use this menu if your scripts work on the entire capture file
independent of the user selection.
|
Packet
sheet context menu |
You
can add a menu item to the packet sheet context menu. This context
menu is shown when the user right clicks on the packets sheet. Use this
is your script needs to work on selected packets. |
PDU
sheet context menu |
Add
a menu item to the PDU sheet context menu. Use this method if your
script needs to work with selected PDUs.
|
Streams
sheet context menu |
Add
a menu item to the Streams sheet context menu. This works on entire
streams. Use this method if your script needs to work with selected
streams. |
User
Objects sheet context menu |
Add
a menu item to the User Objects sheet context menu. Use this method if
you want to work with selected user
objects. |
|