mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-01-31 21:41:07 +00:00
Merge remote-tracking branch 'origin/GP-2029_dev747368_fsb_list_supported_fs_impls--SQUASHED'
This commit is contained in:
commit
3704373a71
@ -30,6 +30,16 @@
|
||||
</BLOCKQUOTE>
|
||||
</BLOCKQUOTE>
|
||||
|
||||
<H2>Help Menu Actions</H2>
|
||||
<BLOCKQUOTE>
|
||||
<H3><A name="Display_Supported_File_Systems_and_Loaders"></A>Display Supported File Systems
|
||||
and Loaders</H3>
|
||||
|
||||
<BLOCKQUOTE>
|
||||
<P>Lists the currently supported file systems and loaders.</P>
|
||||
</BLOCKQUOTE>
|
||||
</BLOCKQUOTE>
|
||||
|
||||
<H2>Right-click Context Menu Actions</H2>
|
||||
|
||||
<BLOCKQUOTE>
|
||||
@ -148,13 +158,6 @@
|
||||
<H2>Browser Dialog Actions</H2>
|
||||
|
||||
<BLOCKQUOTE>
|
||||
<H3><A name="FSB_Display_Supported_File_Systems_and_Loaders"></A>Display Supported File Systems
|
||||
and Loaders</H3>
|
||||
|
||||
<BLOCKQUOTE>
|
||||
<P>Lists the currently supported file systems.</P>
|
||||
</BLOCKQUOTE>
|
||||
|
||||
<H3><A name="FSB_Open_File_System_Chooser"></A>Open File System Chooser</H3>
|
||||
|
||||
<BLOCKQUOTE>
|
||||
|
@ -15,9 +15,10 @@
|
||||
*/
|
||||
package ghidra.app.plugin.core.help;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.util.*;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@ -52,9 +53,6 @@ import ghidra.util.SystemUtilities;
|
||||
//@formatter:on
|
||||
public class ProcessorListPlugin extends Plugin implements FrontEndable {
|
||||
|
||||
public final static String PLUGIN_NAME = "ProgramListPlugin";
|
||||
public final static String ACTION_NAME = "Installed Processors";
|
||||
|
||||
private DockingAction processorListAction;
|
||||
|
||||
private ProcessorListDialogProvider dialogProvider;
|
||||
@ -77,7 +75,7 @@ public class ProcessorListPlugin extends Plugin implements FrontEndable {
|
||||
|
||||
private void setupActions() {
|
||||
|
||||
processorListAction = new DockingAction(ACTION_NAME, PLUGIN_NAME) {
|
||||
processorListAction = new DockingAction("Installed Processors", this.getName()) {
|
||||
@Override
|
||||
public void actionPerformed(ActionContext context) {
|
||||
showProcessorList();
|
||||
@ -86,8 +84,8 @@ public class ProcessorListPlugin extends Plugin implements FrontEndable {
|
||||
|
||||
processorListAction.setEnabled(true);
|
||||
|
||||
processorListAction.setMenuBarData(
|
||||
new MenuData(new String[] { ToolConstants.MENU_HELP, ACTION_NAME }, null, "AAAZ"));
|
||||
processorListAction.setMenuBarData(new MenuData(
|
||||
new String[] { ToolConstants.MENU_HELP, processorListAction.getName() }, null, "AAAZ"));
|
||||
|
||||
processorListAction.setHelpLocation(new HelpLocation(HelpTopics.ABOUT, "ProcessorList"));
|
||||
processorListAction.setDescription(getPluginDescription().getDescription());
|
||||
|
@ -16,12 +16,13 @@
|
||||
package ghidra.plugins.fsbrowser;
|
||||
|
||||
import static ghidra.formats.gfilesystem.fileinfo.FileAttributeType.*;
|
||||
import static java.util.Map.*;
|
||||
import static java.util.Map.entry;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@ -39,7 +40,6 @@ import docking.widgets.tree.GTreeNode;
|
||||
import ghidra.app.services.ProgramManager;
|
||||
import ghidra.app.services.TextEditorService;
|
||||
import ghidra.app.util.bin.ByteProvider;
|
||||
import ghidra.app.util.opinion.LoaderService;
|
||||
import ghidra.formats.gfilesystem.*;
|
||||
import ghidra.formats.gfilesystem.crypto.CachedPasswordProvider;
|
||||
import ghidra.formats.gfilesystem.crypto.CryptoProviders;
|
||||
@ -68,7 +68,6 @@ class FSBActionManager {
|
||||
private static final int MAX_TEXT_FILE_LEN = 64 * 1024;
|
||||
|
||||
/* package visibility menu actions */
|
||||
DockingAction actionShowSupportedFileSystemsAndLoaders;
|
||||
DockingAction actionImport;
|
||||
DockingAction actionOpenPrograms;
|
||||
DockingAction actionOpenFileSystemChooser;
|
||||
@ -130,8 +129,6 @@ class FSBActionManager {
|
||||
actions.add((actionExport = createExportAction()));
|
||||
actions.add((actionExportAll = createExportAllAction()));
|
||||
actions.add((actionGetInfo = createGetInfoAction()));
|
||||
actions.add(
|
||||
(actionShowSupportedFileSystemsAndLoaders = createSupportedFileSystemsAction()));
|
||||
actions.add((actionListMountedFileSystems = createListMountedFilesystemsAction()));
|
||||
actions.add((actionClearCachedPasswords = createClearCachedPasswordsAction()));
|
||||
actions.add(createRefreshAction());
|
||||
@ -330,43 +327,9 @@ class FSBActionManager {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a list of supported file system types and loaders.
|
||||
*/
|
||||
private void showSupportedFileSystems() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append(
|
||||
"<html><table><tr><td>Supported File Systems</td><td>Supported Loaders</td></tr>\n");
|
||||
sb.append("<tr valign='top'><td><ul>");
|
||||
for (String fileSystemName : fsService.getAllFilesystemNames()) {
|
||||
sb.append("<li>" + fileSystemName + "\n");
|
||||
}
|
||||
|
||||
sb.append("</ul></td><td><ul>");
|
||||
for (String loaderName : LoaderService.getAllLoaderNames()) {
|
||||
sb.append("<li>" + loaderName + "\n");
|
||||
}
|
||||
sb.append("</ul></td></tr></table>");
|
||||
|
||||
MultiLineMessageDialog.showModalMessageDialog(plugin.getTool().getActiveWindow(),
|
||||
"Supported File Systems and Loaders", "", sb.toString(),
|
||||
MultiLineMessageDialog.INFORMATION_MESSAGE);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// DockingActions
|
||||
//----------------------------------------------------------------------------------
|
||||
private DockingAction createSupportedFileSystemsAction() {
|
||||
return new ActionBuilder("FSB Display Supported File Systems and Loaders", plugin.getName())
|
||||
.description("Display Supported File Systems and Loaders")
|
||||
.withContext(FSBActionContext.class)
|
||||
.enabledWhen(ac -> true)
|
||||
.toolBarIcon(ImageManager.INFO)
|
||||
.onAction(ac -> showSupportedFileSystems())
|
||||
.build();
|
||||
}
|
||||
|
||||
private DockingAction createExportAction() {
|
||||
return new ActionBuilder("FSB Export", plugin.getName())
|
||||
.withContext(FSBActionContext.class)
|
||||
|
@ -15,23 +15,27 @@
|
||||
*/
|
||||
package ghidra.plugins.fsbrowser;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import docking.action.DockingAction;
|
||||
import docking.action.builder.ActionBuilder;
|
||||
import docking.tool.ToolConstants;
|
||||
import docking.widgets.dialogs.MultiLineMessageDialog;
|
||||
import docking.widgets.filechooser.GhidraFileChooser;
|
||||
import docking.widgets.filechooser.GhidraFileChooserMode;
|
||||
import ghidra.app.CorePluginPackage;
|
||||
import ghidra.app.events.ProgramActivatedPluginEvent;
|
||||
import ghidra.app.plugin.PluginCategoryNames;
|
||||
import ghidra.app.services.*;
|
||||
import ghidra.app.util.opinion.LoaderService;
|
||||
import ghidra.formats.gfilesystem.*;
|
||||
import ghidra.framework.main.FrontEndService;
|
||||
import ghidra.framework.main.FrontEndable;
|
||||
@ -70,6 +74,7 @@ public class FileSystemBrowserPlugin extends Plugin implements FrontEndable, Pro
|
||||
FileSystemBrowserService {
|
||||
|
||||
/* package */ DockingAction openFilesystemAction;
|
||||
/* package */ DockingAction showFileSystemImplsAction;
|
||||
private GhidraFileChooser chooserOpen;
|
||||
private FrontEndService frontEndService;
|
||||
private Map<FSRL, FileSystemBrowserComponentProvider> currentBrowsers = new HashMap<>();
|
||||
@ -91,7 +96,26 @@ public class FileSystemBrowserPlugin extends Plugin implements FrontEndable, Pro
|
||||
FSBUtils.getProgramManager(tool, false);
|
||||
}
|
||||
|
||||
setupOpenFileSystemAction();
|
||||
setupActions();
|
||||
}
|
||||
|
||||
private void setupActions() {
|
||||
openFilesystemAction = new ActionBuilder("Open File System", this.getName())
|
||||
.description(getPluginDescription().getDescription())
|
||||
.enabledWhen(ac -> tool.getProject() != null)
|
||||
.menuPath(ToolConstants.MENU_FILE, "Open File System...")
|
||||
.menuGroup("Import", "z")
|
||||
.keyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_I, InputEvent.CTRL_DOWN_MASK))
|
||||
.onAction(ac -> doOpenFileSystem())
|
||||
.buildAndInstall(tool);
|
||||
showFileSystemImplsAction =
|
||||
new ActionBuilder("Display Supported File Systems and Loaders", this.getName())
|
||||
.description("Display Supported File Systems and Loaders")
|
||||
.enabledWhen(ac -> true)
|
||||
.menuPath(ToolConstants.MENU_HELP, "List File Systems")
|
||||
.menuGroup("AAAZ") // this "AAAZ" is from ProcessorListPlugin
|
||||
.onAction(ac -> showSupportedFileSystems())
|
||||
.buildAndInstall(tool);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -194,17 +218,6 @@ public class FileSystemBrowserPlugin extends Plugin implements FrontEndable, Pro
|
||||
// nada
|
||||
}
|
||||
|
||||
private void setupOpenFileSystemAction() {
|
||||
openFilesystemAction = new ActionBuilder("Open File System", this.getName())
|
||||
.description(getPluginDescription().getDescription())
|
||||
.enabledWhen(ac -> tool.getProject() != null)
|
||||
.menuPath("File", "Open File System...")
|
||||
.menuGroup("Import", "z")
|
||||
.keyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_I, InputEvent.CTRL_DOWN_MASK))
|
||||
.onAction(ac -> doOpenFileSystem())
|
||||
.buildAndInstall(tool);
|
||||
}
|
||||
|
||||
private void openChooser(String title, String buttonText, boolean multiSelect) {
|
||||
if (chooserOpen == null) {
|
||||
chooserOpen = new GhidraFileChooser(tool.getActiveWindow());
|
||||
@ -310,4 +323,29 @@ public class FileSystemBrowserPlugin extends Plugin implements FrontEndable, Pro
|
||||
}
|
||||
return provider;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a list of supported file system types and loaders.
|
||||
*/
|
||||
private void showSupportedFileSystems() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append(
|
||||
"<html><table><tr><td>Supported File Systems</td><td>Supported Loaders</td></tr>\n");
|
||||
sb.append("<tr valign='top'><td><ul>");
|
||||
for (String fileSystemName : fsService().getAllFilesystemNames()) {
|
||||
sb.append("<li>" + fileSystemName + "\n");
|
||||
}
|
||||
|
||||
sb.append("</ul></td><td><ul>");
|
||||
for (String loaderName : LoaderService.getAllLoaderNames()) {
|
||||
sb.append("<li>" + loaderName + "\n");
|
||||
}
|
||||
sb.append("</ul></td></tr></table>");
|
||||
|
||||
MultiLineMessageDialog.showModalMessageDialog(getTool().getActiveWindow(),
|
||||
"Supported File Systems and Loaders", "", sb.toString(),
|
||||
MultiLineMessageDialog.INFORMATION_MESSAGE);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user