Package rubydragon

Class ScriptableGhidraInterpreter

java.lang.Object
rubydragon.GhidraInterpreter
rubydragon.ScriptableGhidraInterpreter
All Implemented Interfaces:
ghidra.util.Disposable
Direct Known Subclasses:
ClojureGhidraInterpreter, GroovyGhidraInterpreter, KotlinGhidraInterpreter, RubyGhidraInterpreter

public abstract class ScriptableGhidraInterpreter extends GhidraInterpreter
An interpreter that can also run scripts.
  • Constructor Details

    • ScriptableGhidraInterpreter

      public ScriptableGhidraInterpreter()
  • Method Details

    • loadState

      public void loadState(ghidra.app.script.GhidraState state)
      Loads a provided GhidraState into the interpreter.
      Parameters:
      state - The state to load.
    • runScript

      public abstract void runScript(ghidra.app.script.GhidraScript script, String[] scriptArguments, ghidra.app.script.GhidraState scriptState) throws IllegalArgumentException, FileNotFoundException, IOException
      Runs the given script with the arguments and state provided. The provided state is loaded into the interpreter at the beginning of execution, and the values of the globals are then exported back into the state after it completes. If the script cannot be found but the script is not running in headless mode, the user will be prompted to ignore the error, which will cause the function to simply continue instead of throwing an IllegalArgumentException.
      Parameters:
      script - The script to run.
      scriptArguments - The arguments to pass to the script.
      scriptState - The script to load before the script runs, and update after the script finishes.
      Throws:
      IllegalArgumentException - if the script does not exist
      IOException - if the script could not be read
      FileNotFoundException - if the script file wasn't found
    • updateState

      public abstract void updateState(ghidra.app.script.GhidraState scriptState)
      Updates a state with the current selection/location/etc. variables from the interpreter. This is intended to be called after a call to runScript, to make sure that any updates made to these variables during execution are reflected in the end state.
      Parameters:
      scriptState - The state to update.