diff --git a/Ghidra/Features/Base/certification.manifest b/Ghidra/Features/Base/certification.manifest index 5c4b89797b..3700058546 100644 --- a/Ghidra/Features/Base/certification.manifest +++ b/Ghidra/Features/Base/certification.manifest @@ -516,7 +516,6 @@ src/main/help/help/topics/ScalarSearchPlugin/images/ScalarWindow.png||GHIDRA|||| src/main/help/help/topics/ScalarSearchPlugin/images/SearchAllScalarsDialog.png||GHIDRA||||END| src/main/help/help/topics/Search/Instruction_Mnemonic_Search.htm||GHIDRA||||END| src/main/help/help/topics/Search/Query_Results_Dialog.htm||GHIDRA||||END| -src/main/help/help/topics/Search/Regular_Expressions.htm||GHIDRA||||END| src/main/help/help/topics/Search/Search_Formats.htm||GHIDRA||||END| src/main/help/help/topics/Search/Search_Instruction_Patterns.htm||GHIDRA||||END| src/main/help/help/topics/Search/Search_Memory.htm||GHIDRA||||END| @@ -579,10 +578,6 @@ src/main/help/help/topics/SymbolTreePlugin/SymbolTree.htm||GHIDRA||||END| src/main/help/help/topics/SymbolTreePlugin/images/CreateExternalLocation.png||GHIDRA||||END| src/main/help/help/topics/SymbolTreePlugin/images/EditExternalLocation.png||GHIDRA||||END| src/main/help/help/topics/SymbolTreePlugin/images/SymbolTree.png||GHIDRA||||END| -src/main/help/help/topics/Tables/GhidraTableHeaders.html||GHIDRA||||END| -src/main/help/help/topics/Tables/images/BytesSettingsDialog.png||GHIDRA||reviewed||END| -src/main/help/help/topics/Tables/images/MultipleColumnSortDialog.png||GHIDRA||||END| -src/main/help/help/topics/Tables/images/SelectColumnsDialog.png||GHIDRA||||END| src/main/help/help/topics/Tool/Configure_Tool.htm||GHIDRA||||END| src/main/help/help/topics/Tool/Ghidra_Tool_Administration.htm||GHIDRA||||END| src/main/help/help/topics/Tool/ShowLog.htm||GHIDRA|||References wcbiema in screen snapshot|END| @@ -604,13 +599,6 @@ src/main/help/help/topics/Tool/images/SetToolAssociations.png||GHIDRA||||END| src/main/help/help/topics/Tool/images/ShowLog.png||GHIDRA||||END| src/main/help/help/topics/Tool/images/Tip.png||GHIDRA||||END| src/main/help/help/topics/TranslateStringsPlugin/TranslateStringsPlugin.htm||GHIDRA||||END| -src/main/help/help/topics/Trees/GhidraTreeFilter.html||GHIDRA||||END| -src/main/help/help/topics/Trees/images/Filter.png||GHIDRA||||END| -src/main/help/help/topics/Trees/images/FilterClearButton.png||GHIDRA||||END| -src/main/help/help/topics/Trees/images/FilterOptions.png||GHIDRA||||END| -src/main/help/help/topics/Trees/images/TableColumnFilter.png||GHIDRA||||END| -src/main/help/help/topics/Trees/images/TableColumnFilterAfterFilterApplied.png||GHIDRA||||END| -src/main/help/help/topics/Trees/images/TableColumnFilterDialog.png||GHIDRA||||END| src/main/help/help/topics/VSCodeIntegration/VSCodeIntegration.htm||GHIDRA||||END| src/main/help/help/topics/ValidateProgram/ValidateProgram.html||GHIDRA||||END| src/main/help/help/topics/ValidateProgram/images/ValidateProgram.png||GHIDRA||||END| diff --git a/Ghidra/Features/Base/src/main/help/help/topics/GhidraScriptMgrPlugin/GhidraScriptMgrPlugin.htm b/Ghidra/Features/Base/src/main/help/help/topics/GhidraScriptMgrPlugin/GhidraScriptMgrPlugin.htm index 0a759195eb..e6a80722e5 100644 --- a/Ghidra/Features/Base/src/main/help/help/topics/GhidraScriptMgrPlugin/GhidraScriptMgrPlugin.htm +++ b/Ghidra/Features/Base/src/main/help/help/topics/GhidraScriptMgrPlugin/GhidraScriptMgrPlugin.htm @@ -41,28 +41,52 @@

The script table displays information about the scripts.

-

The first columnn indicates if an action should be created for the - script.  If a script has a menu path or default key binding, then selecting this - column will cause an action to be created with that menu path and/or key binding.  - Selecting this column for a script that has no menu path or key binding set will have no - effect until the script is modified to have a menu path or key binding.  Deselecting - this column will also remove any key bindings that were defined via the script manager - gui.

+

In Tool Column

-

The second columnn indicates the status of the script. A blank field - is a happy field. If the column contains , then - that script contains an error.

+
+

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.

-

The Filename column indicates the filename of 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.

+
-

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

+

Status 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.
-

+
+

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

@@ -72,85 +96,77 @@ 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.

+

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

+

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. -

+

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.

+

-

Script Quick Launch

- -
-

This key binding action will show a dialog to allow you to quickly - select a script to be run. You may type any part of the name of the desired script - in the dialog's text field. An asterisc may be used as a globbing character. -

-

- You may either use the mouse to choose the desired script from the popup list or press the - Enter key to selected the highlighted list element. -

- -

- -

- -
- -

Edit Script Run Last Script

-

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

+

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

-

Refresh

+

This key binding action will show a dialog to allow you to quickly select a + script to be run. You may type any part of the name of the desired script in the dialog's + text field. An asterisc may be used as a globbing character.

+ +

You may either use the mouse to choose the desired script from the popup list or press + the Enter key to selected the highlighted list element.

+ +

+

+
+ +

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.

+ 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 Save

@@ -158,8 +174,8 @@ option is only enabled when changes have been made.

-

Save As...

+

Save As...

Saves the script (with any changes) to a new script file. The default @@ -168,62 +184,71 @@ script in the editor. When selecting Save As..., Ghidra will prompt for a filename.

-

+

-

Undo

+

Undo

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

-

Redo

+

Redo

Redo returns the last edit back into the editor.

-

Select Font

+

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

+

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. 

@@ -236,48 +261,47 @@
-

+

-

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

-

Delete Script

+

Delete Script

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

-

+

-

This is a permanent operation.

+

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. -

+ you will receive a warning dialog.

-

Rename Script

+

Rename Script

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

-

+

-

Create New Script Create New Script

@@ -287,41 +311,42 @@ "../../docs/api/ghidra/app/script/GhidraScriptProvider.html">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

+

Refresh Script List

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

-

Script Directories / Bundle Manager 

+

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.

+

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.

+

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


+
-

Help

+

Help

Opens the Ghidra help viewer on the GhidraScript API.

@@ -334,9 +359,8 @@

Related Topics

 

diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/script/ScriptInfo.java b/Ghidra/Features/Base/src/main/java/ghidra/app/script/ScriptInfo.java index 786666dd45..8b595ef851 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/script/ScriptInfo.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/script/ScriptInfo.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,8 +18,7 @@ package ghidra.app.script; import static ghidra.util.HTMLUtilities.*; import java.io.*; -import java.util.List; -import java.util.StringTokenizer; +import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -65,7 +64,7 @@ public class ScriptInfo { private String[] category = new String[0]; private KeyStroke keyBinding; private String keybindingErrorMessage; - private String[] menupath = new String[0]; + private String[] menupath = null; private String toolbar; private ImageIcon toolbarImage; private String importpackage; @@ -91,7 +90,7 @@ public class ScriptInfo { author = null; category = new String[0]; keyBinding = null; - menupath = new String[0]; + menupath = null; toolbar = null; toolbarImage = null; importpackage = null; @@ -459,9 +458,27 @@ public class ScriptInfo { */ public String[] getMenuPath() { parseHeader(); + if (menupath == null) { + List list = new ArrayList<>(); + list.add("Scripts"); + for (String name : category) { + list.add(name); + } + list.add(getNameNoExtension()); + menupath = list.toArray(new String[list.size()]); + } return menupath; } + private String getNameNoExtension() { + String name = getName(); + int lastIndex = name.lastIndexOf("."); + if (lastIndex > 0) { + name = name.substring(0, lastIndex); + } + return name; + } + /** * Returns the script menu path as a string. * For example,{@literal "Path1->Path2->Path3"}.