Class ExtensionUtils

java.lang.Object
ghidra.framework.project.extensions.ExtensionUtils

public class ExtensionUtils extends Object
Utility class for managing Ghidra Extensions.

Extensions are defined as any archive or folder that contains an extension.properties file. This properties file can contain the following attributes:

  • name (required)
  • description
  • author
  • createdOn (format: MM/dd/yyyy)
  • version

Extensions may be installed/uninstalled by users at runtime, using the ExtensionTableProvider. Installation consists of unzipping the extension archive to an installation folder, currently {ghidra user settings dir}/Extensions. To uninstall, the unpacked folder is simply removed.

  • Field Details

    • PROPERTIES_FILE_NAME

      public static String PROPERTIES_FILE_NAME
    • PROPERTIES_FILE_NAME_UNINSTALLED

      public static String PROPERTIES_FILE_NAME_UNINSTALLED
  • Constructor Details

    • ExtensionUtils

      public ExtensionUtils()
  • Method Details

    • initializeExtensions

      public static void initializeExtensions()
      Performs extension maintenance. This should be called at startup, before any plugins or extension points are loaded.
    • getActiveInstalledExtensions

      public static Set<ExtensionDetails> getActiveInstalledExtensions()
      Gets all known extensions that have not been marked for removal.
      Returns:
      set of installed extensions
    • getInstalledExtensions

      public static Set<ExtensionDetails> getInstalledExtensions()
      Returns all installed extensions. These are all the extensions found in ApplicationLayout.getExtensionInstallationDirs().
      Returns:
      set of installed extensions
    • getArchiveExtensions

      public static Set<ExtensionDetails> getArchiveExtensions()
      Returns all archive extensions. These are all the extensions found in ApplicationLayout.getExtensionArchiveDir(). This are added to an installation as part of the build processes.

      Archived extensions may be zip files and directories.

      Returns:
      set of archive extensions
    • install

      public static boolean install(File file)
      Installs the given extension file. This can be either an archive (zip) or a directory that contains an extension.properties file.
      Parameters:
      file - the extension to install
      Returns:
      true if the extension was successfully installed
    • installExtensionFromArchive

      public static boolean installExtensionFromArchive(ExtensionDetails extension)
      Installs the given extension from its declared archive path
      Parameters:
      extension - the extension
      Returns:
      true if successful
    • isExtension

      public static boolean isExtension(File file)
      Returns true if the given file or directory is a valid ghidra extension.

      Note: This means that the zip or directory contains an extension.properties file.

      Parameters:
      file - the zip or directory to inspect
      Returns:
      true if the given file represents a valid extension