Package rubydragon

Class DragonPlugin

java.lang.Object
ghidra.framework.plugintool.Plugin
ghidra.app.plugin.ProgramPlugin
rubydragon.DragonPlugin
All Implemented Interfaces:
ghidra.app.plugin.core.interpreter.InterpreterConnection, ghidra.framework.plugintool.util.PluginEventListener, ghidra.framework.plugintool.util.ServiceListener, ghidra.util.classfinder.ExtensionPoint
Direct Known Subclasses:
ClojureDragonPlugin, GroovyDragonPlugin, JShellDragonPlugin, KotlinDragonPlugin, RubyDragonPlugin

public abstract class DragonPlugin extends ghidra.app.plugin.ProgramPlugin implements ghidra.app.plugin.core.interpreter.InterpreterConnection
A plugin for RubyDragon that provides an interactive interpreter for a chosen language. This abstract class takes care of a number of boilerplate tasks that should be common across all plugins.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static String
    The name of the auto import manifest data file.
    static String
    The name of the options category used by DragonPlugins.
  • Constructor Summary

    Constructors
    Constructor
    Description
    DragonPlugin(ghidra.framework.plugintool.PluginTool tool, String name)
    Creates a new DragonPlugin.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Runs the provided action for each import in the preload manifest.
    static void
    Runs the provided action for each import in the preload manifest.
    Gets the description of the automatic import option, customized with this instance's name.
    ghidra.util.HelpLocation
    Gets the help location of the automatic import option for this instance.
    Gets the name of the automatic import option, customized with this instance's name.
    List<ghidra.app.plugin.core.console.CodeCompletion>
    Get a list of completions for the given command prefix.
    The icon for this plugin.
    Gives the interpreter currently in use by the plugin.
    The title of the plugin.
    void
    highlightChanged(ghidra.program.util.ProgramSelection sel)
    Called whenever the highlight is changed within the CodeBrowser tool.
    boolean
    Whether or not automatic imports are currently enabled in this plugin.
    void
    locationChanged(ghidra.program.util.ProgramLocation loc)
    Called whenever the location is changed within the CodeBrowser tool.
    void
    programActivated(ghidra.program.model.listing.Program program)
    Called whenever a program is activate within the CodeBrowser tool.
    void
    selectionChanged(ghidra.program.util.ProgramSelection sel)
    Called whenever the selection is changed within the CodeBrowser tool.
    abstract void
    Shows the interpreter console.

    Methods inherited from class ghidra.app.plugin.ProgramPlugin

    getCurrentProgram, getProgramHighlight, getProgramLocation, getProgramSelection, processEvent

    Methods inherited from class ghidra.framework.plugintool.Plugin

    accept, acceptData, dataStateRestoreCompleted, dependsUpon, equals, eventSent, firePluginEvent, getData, getMissingRequiredServices, getName, getPluginDescription, getSupportedDataTypes, getTool, getTransientState, getUndoRedoState, hashCode, hasMissingRequiredService, isDisposed, readConfigState, readDataState, restoreTransientState, restoreUndoRedoState, serviceAdded, serviceRemoved, writeConfigState, writeDataState

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface ghidra.app.plugin.core.interpreter.InterpreterConnection

    getCompletions
  • Field Details

    • AUTO_IMPORT_FILENAME

      public static String AUTO_IMPORT_FILENAME
      The name of the auto import manifest data file.
      Since:
      2.2.0
    • OPTION_CATEGORY_NAME

      public static String OPTION_CATEGORY_NAME
      The name of the options category used by DragonPlugins.
      Since:
      2.2.0
  • Constructor Details

    • DragonPlugin

      public DragonPlugin(ghidra.framework.plugintool.PluginTool tool, String name)
      Creates a new DragonPlugin.
      Parameters:
      tool - The plugin tool that this plugin is added to.
      name - The name of the language provided by the instance.
  • Method Details

    • forEachAutoImport

      public static void forEachAutoImport(Consumer<String> action) throws org.jdom.JDOMException, IOException
      Runs the provided action for each import in the preload manifest.
      Parameters:
      action - The action called for each import listed in the preload manifest, with the argument being the fully qualified class name: the package and class name joined with a '.' character.
      Throws:
      IOException - if the preload manifest file couldn't be opened.
      org.jdom.JDOMException - if the preload manifest xml was malformed.
      Since:
      2.2.0
    • forEachAutoImport

      public static void forEachAutoImport(BiConsumer<String,String> action) throws org.jdom.JDOMException, IOException
      Runs the provided action for each import in the preload manifest.
      Parameters:
      action - The action called for each import listed in the preload manifest, with the arguments being the package name and class name, respectively.
      Throws:
      IOException - if the preload manifest file couldn't be opened.
      org.jdom.JDOMException - if the preload manifest xml was malformed.
      Since:
      2.2.0
    • getAutoImportOptionDescription

      public String getAutoImportOptionDescription()
      Gets the description of the automatic import option, customized with this instance's name.
      Returns:
      The option description.
      Since:
      2.2.0
    • getAutoImportOptionHelpLocation

      public ghidra.util.HelpLocation getAutoImportOptionHelpLocation()
      Gets the help location of the automatic import option for this instance.
      Returns:
      The option help location.
      Since:
      2.2.0
    • getAutoImportOptionName

      public String getAutoImportOptionName()
      Gets the name of the automatic import option, customized with this instance's name.
      Returns:
      The option name.
      Since:
      2.2.0
    • getCompletions

      public List<ghidra.app.plugin.core.console.CodeCompletion> getCompletions(String cmd)
      Get a list of completions for the given command prefix.
      Specified by:
      getCompletions in interface ghidra.app.plugin.core.interpreter.InterpreterConnection
      Parameters:
      cmd - The command to try to complete.
      Returns:
      A list of possible code completions.
    • getIcon

      public ImageIcon getIcon()
      The icon for this plugin.
      Specified by:
      getIcon in interface ghidra.app.plugin.core.interpreter.InterpreterConnection
    • getInterpreter

      public abstract GhidraInterpreter getInterpreter()
      Gives the interpreter currently in use by the plugin.
      Returns:
      The interpreter for this plugin.
    • getTitle

      public String getTitle()
      The title of the plugin.
      Specified by:
      getTitle in interface ghidra.app.plugin.core.interpreter.InterpreterConnection
    • highlightChanged

      public void highlightChanged(ghidra.program.util.ProgramSelection sel)
      Called whenever the highlight is changed within the CodeBrowser tool.
    • isAutoImportEnabled

      public boolean isAutoImportEnabled()
      Whether or not automatic imports are currently enabled in this plugin.
      Returns:
      Whether or not automatic imports are enabled in this plugin.
      Since:
      2.2.0
    • locationChanged

      public void locationChanged(ghidra.program.util.ProgramLocation loc)
      Called whenever the location is changed within the CodeBrowser tool.
    • programActivated

      public void programActivated(ghidra.program.model.listing.Program program)
      Called whenever a program is activate within the CodeBrowser tool.
    • selectionChanged

      public void selectionChanged(ghidra.program.util.ProgramSelection sel)
      Called whenever the selection is changed within the CodeBrowser tool.
    • showConsole

      public abstract void showConsole()
      Shows the interpreter console.