# Ghidra Script Manager

The Ghidra Script Manager allows for rapid development of extended Ghidra functionality. Unlike conventional Ghidra plugins that require a full IDE for development, Ghidra scripts can be developed right inside of Ghidra while it is running. You can interactively change your script and immediately re-run it.

See Ghidra Script Development for details on how to write a script.

> ### Script Category Tree

> > The script category tree will organize scripts by category. If you click on a node of the tree it will only display scripts in the table that are in that category or any sub-categories. Each script defines its own category, which is arbitrary and optional. Scripts without explicitly defined categories will appear in the root "Scripts" category.

> ### Script Table

> > The script table displays information about the scripts.

> > #### In Tool Column

> > > The In Tool column provides a checkbox that allows a script to be run directly from the tool instead of just from the script manager window. If a script has a menu path (@menupath) defined in its header's meta data section, then an action will be created at that menu location. Otherwise, a menu item will be created under the tool's Scripts menu and if applicable under any sub-menus corresponding to its category (@category). In either case, that menu item can be used to run the script.

> > > Also, if the script has a key binding (@keybinding) defined in it's header, then selecting the In Tool option will allow the script to be run by pressing that key combination. Similarly, having the toolbar meta data set (@toolbar), will result in a top level toolbar item being created that can be used to run the script.

> > #### Status Column

> > > The Status Column indicates the status of the script. A blank field is a happy field. If the column contains , then that script contains an error.

> > #### Filename Column

> > > The Filename column indicates the filename of the script.

> > #### Description Column

> > > The Description column indicates the description as defined in the meta-data comment of the script.

> > #### Key Binding Column

> > > The Key Binding column indicates the key binding associated to that script. If the field is blank, then a key binding has not been assigned to the script. Setting a key binding will cause an action to get created and therefore the first column will become checked.

> ### Filter

> > The Search Filter allows you to narrow the list of scripts displayed in the table. Only those scripts, whose name or description contains the string that you enter as the filter, will be displayed. As you type, the table is updated to reflect the filter.

> ### Description Panel

> > The Description Panel allows you to view meta data about the selected script in the Script Table, including such things as author, description, key binding, etc.

## Script Manager Actions

> ### Run Script

> > Runs the selected script. If the script source file or any source in its script directory are out of date, then it's all (re)compiled. If the compilation is successful, then the script will be run. If the script does not compile, the compilation errors will be displayed in the Console and an error icon will be displayed in the first column of the table.

> ### Run Last Script

> > Runs the last run script. This action is available as a keybinding from within anywhere in the tool, whether or not the Script Manager is showing. To see the current keybinding for this action, hover over its icon in the toolbar of the Script Manager.

> ### Script Quick Launch

> > This key binding action shows a dialog to quickly find and run scripts. The dialog organizes scripts into two sections:

> > - Recent Scripts - Shows up to 10 of the most recently executed scripts in most-recently-used (MRU) order. This section only appears if you have run scripts before.
> > - All Scripts - Shows all available scripts in alphabetical order.

> > Type any part of a script name or description in the filter field to narrow down the list. The filter wildcard matching using * (any characters) and ? (single character). Use the down arrow keys or mouse to select a script, then press Enter or click OK to run it.

> > The detail pane on the right displays information about the currently selected script, including its description, author, category, and assigned keybinding (if any).

> ### Edit Script

> > Edits the selected script. For more information on script meta data, see Ghidra Script Development

> > #### Refresh

> > > Will load the contents of the current script from the file on the filesystem. This action is useful if you have edited the script outside of Ghidra and would like to have the editor update to show those changes.

> > #### Save

> > > Saves the changed script back to the original file. The Save option is only enabled when changes have been made.

> > #### Save As...

> > > Saves the script (with any changes) to a new script file. The default directory is your home directory, however if additional script directories exist, then you will be prompted to select a directory. This new script file becomes the active script in the editor. When selecting Save As..., Ghidra will prompt for a filename.

> > #### Undo

> > > Undo reverts the editor to the state prior to the last edit. You can undo up to 50 edits.

> > #### Redo

> > > Redo returns the last edit back into the editor.

> > #### Select Font

> > > Changes the font for all open editors. It will also set the default font that will be used for all future editors. The dialog allows you to specify the font type, size, and style.

> ### Edit Script with Eclipse

> > Edits the selected script in Eclipse using the GhidraDev plugin.

> > > Before a script can be edited in Eclipse, an Eclipse installation and workspace directory must be defined in the Tool's Eclipse Integration options.

> > > For more information on developing Ghidra scripts in Eclipse, see Extensions/Eclipse/GhidraDev/GhidraDev_README.html.

> ### Edit Script with Visual Studio Code

> > Edits the selected script in Visual Studio Code.

> > > Before a script can be edited in Visual Studio Code, a Visual Studio Code executable path must be defined in the Tool's Visual Studio Code Integration options if Visual Studio Code is installed in a non-default location.

> ### Assign Key Binding

> > Allows you to assign a key binding the selected script.

> > > 1. Click in the text field and type the key or keystroke combination that you wish to assign to the script.

> > > The script key bindings are stored in the Tool's Key Binding options.

> ### Delete Script

> > Deletes the selected script. You will receive a confirmation dialog.

> > This is a permanent operation.

> > You cannot delete scripts in the system directory, as this may affect other users. If you attempt to delete a system script, you will receive a warning dialog.

> ### Rename Script

> > Renames the selected script. When selecting Rename, Ghidra will prompt for a new filename.

> ### Create New Script

> > Creates a new empty script and displays it in a Script Editor.

> > If more than one `GhidraScriptProvider` exists, then you will have to choose what type of script to create.

> > See `Ghidra Script Development` for details on how to write a script.

> ### Refresh Script List

> > Refreshes the script list by re-scanning the script directories.

> ### Script Directories / Bundle Manager

> > Allows you to add and remove directories to search for scripts and other dependencies for use by scripts. The default directories are your home directory and the various system directories (e.g., `$GHIDRA_HOME/Features/Base/ghidra_scripts`). You can save directories, but ignore them in the Script Manager dialog by selecting/deselecting the "Enable" column checkbox.

> > For more information on Ghidra's dynamic module support, see Ghidra Bundles.

> ### Help

> > Opens the Ghidra help viewer on the GhidraScript API.

Provided by: Ghidra Script Manager Plugin

Related Topics

- Ghidra Bundles
- Key Bindings