- The Ghidra Pyhidra Interpreter provides a full general-purpose Python interactive shell
+ The Ghidra PyGhidra Interpreter provides a full general-purpose Python interactive shell
and allows you to interact with your current Ghidra session by exposing Ghidra's powerful Java
API through the magic of Jpype.
@@ -18,7 +18,7 @@
Environment
- The Ghidra Pyhidra Interpreter is configured to run in a similar context as a Ghidra
+ The Ghidra PyGhidra Interpreter is configured to run in a similar context as a Ghidra
script. Therefore, you immediately have access to variables such as currentProgram,
currentSelection, currentAddress, etc without needing to import them.
These variables exist as Java objects behind the scenes, but Jpype allows you to interact with
@@ -78,7 +78,7 @@
Keybindings
- The Ghidra Pyhidra Interpreter supports the following hard-coded keybindings:
+ The Ghidra PyGhidra Interpreter supports the following hard-coded keybindings:
(up): Move backward in command stack
(down): Move forward in command stack
@@ -100,7 +100,7 @@
Copy/Paste
- Copy and paste from within the Ghidra Pyhidra Interpreter should work as expected for
+ Copy and paste from within the Ghidra PyGhidra Interpreter should work as expected for
your given environment:
Windows: CTRL+C / CTRL+V
@@ -113,7 +113,7 @@
API Documentation
- The built-in help() Python function has been altered by the Ghidra Pyhidra Interpreter
+ The built-in help() Python function has been altered by the Ghidra PyGhidra Interpreter
to add support for displaying Ghidra's Javadoc (where available) for a given Ghidra class, method,
or variable. For example, to see Ghidra's Javadoc on the state variable, simply do:
@@ -156,7 +156,7 @@
-
Provided by: PyhidraPlugin
+
Provided by: PyGhidraPlugin
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/PyhidraPlugin.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/PyGhidraPlugin.java
similarity index 73%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/PyhidraPlugin.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/PyGhidraPlugin.java
index 0705de835c..1bb2b7deb7 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/PyhidraPlugin.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/PyGhidraPlugin.java
@@ -1,11 +1,11 @@
-package ghidra.pyhidra;
+package ghidra.pyghidra;
import java.util.function.Consumer;
import ghidra.app.CorePluginPackage;
import ghidra.app.plugin.PluginCategoryNames;
import ghidra.app.plugin.ProgramPlugin;
-import ghidra.app.plugin.core.interpreter.*;
+import ghidra.app.plugin.core.interpreter.InterpreterPanelService;
import ghidra.app.script.GhidraState;
import ghidra.framework.plugintool.PluginInfo;
import ghidra.framework.plugintool.PluginTool;
@@ -13,8 +13,8 @@ import ghidra.framework.plugintool.util.PluginStatus;
import ghidra.program.model.listing.Program;
import ghidra.program.util.ProgramLocation;
import ghidra.program.util.ProgramSelection;
-import ghidra.pyhidra.interpreter.InterpreterGhidraScript;
-import ghidra.pyhidra.interpreter.PyhidraInterpreter;
+import ghidra.pyghidra.interpreter.InterpreterGhidraScript;
+import ghidra.pyghidra.interpreter.PyGhidraInterpreter;
import ghidra.util.exception.AssertException;
/**
@@ -25,20 +25,20 @@ import ghidra.util.exception.AssertException;
status = PluginStatus.RELEASED,
packageName = CorePluginPackage.NAME,
category = PluginCategoryNames.COMMON,
- shortDescription = "Pyhidra Interpreter",
+ shortDescription = "PyGhidra Interpreter",
description = "Provides an interactive Python Interpreter that is tightly integrated with a loaded Ghidra program.",
servicesRequired = { InterpreterPanelService.class }
)
//@formatter:on
-public class PyhidraPlugin extends ProgramPlugin {
+public class PyGhidraPlugin extends ProgramPlugin {
- public static final String TITLE = "Pyhidra";
- private static Consumer initializer = null;
+ public static final String TITLE = "PyGhidra";
+ private static Consumer initializer = null;
public final InterpreterGhidraScript script = new InterpreterGhidraScript();
- public PyhidraInterpreter interpreter;
+ public PyGhidraInterpreter interpreter;
- public PyhidraPlugin(PluginTool tool) {
+ public PyGhidraPlugin(PluginTool tool) {
super(tool);
GhidraState state = new GhidraState(tool, tool.getProject(), null, null, null, null);
// use the copy constructor so this state doesn't fire plugin events
@@ -54,16 +54,16 @@ public class PyhidraPlugin extends ProgramPlugin {
* @param initializer the Python side initializer
* @throws AssertException if the code completer has already been set
*/
- public static void setInitializer(Consumer initializer) {
- if (PyhidraPlugin.initializer != null) {
- throw new AssertException("PyhidraPlugin initializer has already been set");
+ public static void setInitializer(Consumer initializer) {
+ if (PyGhidraPlugin.initializer != null) {
+ throw new AssertException("PyGhidraPlugin initializer has already been set");
}
- PyhidraPlugin.initializer = initializer;
+ PyGhidraPlugin.initializer = initializer;
}
@Override
public void init() {
- interpreter = new PyhidraInterpreter(this, PyhidraPlugin.initializer != null);
+ interpreter = new PyGhidraInterpreter(this, PyGhidraPlugin.initializer != null);
if (initializer != null) {
initializer.accept(this);
}
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/PyhidraScriptProvider.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/PyGhidraScriptProvider.java
similarity index 78%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/PyhidraScriptProvider.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/PyGhidraScriptProvider.java
index 8ba0669e54..6669885e38 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/PyhidraScriptProvider.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/PyGhidraScriptProvider.java
@@ -1,6 +1,6 @@
-package ghidra.pyhidra;
+package ghidra.pyghidra;
-import java.io.*;
+import java.io.PrintWriter;
import java.lang.invoke.MethodHandles;
import java.util.List;
import java.util.function.Consumer;
@@ -12,15 +12,15 @@ import ghidra.program.model.address.Address;
import ghidra.program.model.listing.Program;
import ghidra.program.util.ProgramLocation;
import ghidra.program.util.ProgramSelection;
-import ghidra.pyhidra.PythonFieldExposer.ExposedFields;
-import ghidra.util.exception.AssertException;
+import ghidra.pyghidra.PythonFieldExposer.ExposedFields;
import ghidra.util.SystemUtilities;
+import ghidra.util.exception.AssertException;
import ghidra.util.task.TaskMonitor;
/**
* {@link GhidraScript} provider for native python3 scripts
*/
-public final class PyhidraScriptProvider extends AbstractPythonScriptProvider {
+public final class PyGhidraScriptProvider extends AbstractPythonScriptProvider {
private static Consumer scriptRunner = null;
@@ -34,37 +34,37 @@ public final class PyhidraScriptProvider extends AbstractPythonScriptProvider {
* @throws AssertException if the script runner has already been set
*/
public static void setScriptRunner(Consumer scriptRunner) {
- if (PyhidraScriptProvider.scriptRunner != null) {
+ if (PyGhidraScriptProvider.scriptRunner != null) {
throw new AssertException("scriptRunner has already been set");
}
- PyhidraScriptProvider.scriptRunner = scriptRunner;
+ PyGhidraScriptProvider.scriptRunner = scriptRunner;
}
@Override
public String getDescription() {
- return PyhidraPlugin.TITLE;
+ return PyGhidraPlugin.TITLE;
}
@Override
public String getRuntimeEnvironmentName() {
- return PyhidraPlugin.TITLE;
+ return PyGhidraPlugin.TITLE;
}
@Override
public GhidraScript getScriptInstance(ResourceFile sourceFile, PrintWriter writer)
throws GhidraScriptLoadException {
if (scriptRunner == null) {
- String msg = "Ghidra was not started with pyhidra. Python is not available";
+ String msg = "Ghidra was not started with PyGhidra. Python is not available";
throw new GhidraScriptLoadException(msg);
}
- GhidraScript script = SystemUtilities.isInHeadlessMode() ? new PyhidraHeadlessScript()
- : new PyhidraGhidraScript();
+ GhidraScript script = SystemUtilities.isInHeadlessMode() ? new PyGhidraHeadlessScript()
+ : new PyGhidraGhidraScript();
script.setSourceFile(sourceFile);
return script;
}
@ExposedFields(
- exposer = PyhidraGhidraScript.ExposedField.class,
+ exposer = PyGhidraGhidraScript.ExposedField.class,
names = {
"currentAddress", "currentLocation", "currentSelection",
"currentHighlight", "currentProgram", "monitor",
@@ -78,7 +78,7 @@ public final class PyhidraScriptProvider extends AbstractPythonScriptProvider {
ResourceFile.class, GhidraState.class, PrintWriter.class
}
)
- final static class PyhidraGhidraScript extends GhidraScript
+ final static class PyGhidraGhidraScript extends GhidraScript
implements PythonFieldExposer {
@Override
@@ -92,13 +92,13 @@ public final class PyhidraScriptProvider extends AbstractPythonScriptProvider {
*/
private static class ExposedField extends PythonFieldExposer.ExposedField {
public ExposedField(String name, Class> type) {
- super(MethodHandles.lookup().in(PyhidraGhidraScript.class), name, type);
+ super(MethodHandles.lookup().in(PyGhidraGhidraScript.class), name, type);
}
}
}
@ExposedFields(
- exposer = PyhidraHeadlessScript.ExposedField.class,
+ exposer = PyGhidraHeadlessScript.ExposedField.class,
names = {
"currentAddress", "currentLocation", "currentSelection",
"currentHighlight", "currentProgram", "monitor",
@@ -112,7 +112,7 @@ public final class PyhidraScriptProvider extends AbstractPythonScriptProvider {
ResourceFile.class, GhidraState.class, PrintWriter.class
}
)
- final static class PyhidraHeadlessScript extends HeadlessScript
+ final static class PyGhidraHeadlessScript extends HeadlessScript
implements PythonFieldExposer {
@Override
@@ -126,7 +126,7 @@ public final class PyhidraScriptProvider extends AbstractPythonScriptProvider {
*/
private static class ExposedField extends PythonFieldExposer.ExposedField {
public ExposedField(String name, Class> type) {
- super(MethodHandles.lookup().in(PyhidraHeadlessScript.class), name, type);
+ super(MethodHandles.lookup().in(PyGhidraHeadlessScript.class), name, type);
}
}
}
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/PythonFieldExposer.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/PythonFieldExposer.java
similarity index 96%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/PythonFieldExposer.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/PythonFieldExposer.java
index 945bf97706..9df5c064f1 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/PythonFieldExposer.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/PythonFieldExposer.java
@@ -1,4 +1,4 @@
-package ghidra.pyhidra;
+package ghidra.pyghidra;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -21,8 +21,8 @@ import ghidra.util.exception.AssertException;
* This interface is for internal use only and is only public so it can be
* visible to Python to apply the Jpype class customizations.
*/
-public sealed interface PythonFieldExposer permits PyhidraScriptProvider.PyhidraGhidraScript,
- PyhidraScriptProvider.PyhidraHeadlessScript {
+public sealed interface PythonFieldExposer permits PyGhidraScriptProvider.PyGhidraGhidraScript,
+ PyGhidraScriptProvider.PyGhidraHeadlessScript {
/**
* Gets a mapping of all the explicitly exposed fields of a class.
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/interpreter/CancelAction.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/interpreter/CancelAction.java
similarity index 72%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/interpreter/CancelAction.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/interpreter/CancelAction.java
index 6e9f672863..58967c32a0 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/interpreter/CancelAction.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/interpreter/CancelAction.java
@@ -1,13 +1,13 @@
-package ghidra.pyhidra.interpreter;
+package ghidra.pyghidra.interpreter;
import java.awt.event.KeyEvent;
import javax.swing.ImageIcon;
-import ghidra.pyhidra.PyhidraPlugin;
import docking.ActionContext;
import docking.action.KeyBindingData;
import docking.action.DockingAction;
import docking.action.ToolBarData;
+import ghidra.pyghidra.PyGhidraPlugin;
import ghidra.util.HelpLocation;
import resources.ResourceManager;
@@ -15,10 +15,10 @@ import static docking.DockingUtils.CONTROL_KEY_MODIFIER_MASK;
final class CancelAction extends DockingAction {
- private final PyhidraConsole console;
+ private final PyGhidraConsole console;
- CancelAction(PyhidraConsole console) {
- super("Cancel", PyhidraPlugin.class.getSimpleName());
+ CancelAction(PyGhidraConsole console) {
+ super("Cancel", PyGhidraPlugin.class.getSimpleName());
this.console = console;
setDescription("Interrupt the interpreter");
ImageIcon image = ResourceManager.loadImage("images/dialog-cancel.png");
@@ -26,7 +26,7 @@ final class CancelAction extends DockingAction {
setEnabled(true);
KeyBindingData key = new KeyBindingData(KeyEvent.VK_I, CONTROL_KEY_MODIFIER_MASK);
setKeyBindingData(key);
- setHelpLocation(new HelpLocation(PyhidraPlugin.TITLE, "Interrupt_Interpreter"));
+ setHelpLocation(new HelpLocation(PyGhidraPlugin.TITLE, "Interrupt_Interpreter"));
}
@Override
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/interpreter/InterpreterGhidraScript.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/interpreter/InterpreterGhidraScript.java
similarity index 90%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/interpreter/InterpreterGhidraScript.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/interpreter/InterpreterGhidraScript.java
index 043db5534a..fe06dcc208 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/interpreter/InterpreterGhidraScript.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/interpreter/InterpreterGhidraScript.java
@@ -1,4 +1,4 @@
-package ghidra.pyhidra.interpreter;
+package ghidra.pyghidra.interpreter;
import java.io.PrintWriter;
@@ -10,11 +10,11 @@ import ghidra.program.util.ProgramLocation;
import ghidra.program.util.ProgramSelection;
/**
- * Custom {@link GhidraScript} only for use with the pyhidra interpreter console
+ * Custom {@link GhidraScript} only for use with the PyGhidra interpreter console
*/
public final class InterpreterGhidraScript extends GhidraScript {
- // public default constructor for use by PyhidraPlugin
+ // public default constructor for use by PyGhidraPlugin
// the default constructor for FlatProgramAPI has protected visibility
public InterpreterGhidraScript() {
}
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/interpreter/InterpreterTaskMonitor.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/interpreter/InterpreterTaskMonitor.java
similarity index 76%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/interpreter/InterpreterTaskMonitor.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/interpreter/InterpreterTaskMonitor.java
index ff432d7905..5fb1df0003 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/interpreter/InterpreterTaskMonitor.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/interpreter/InterpreterTaskMonitor.java
@@ -1,4 +1,4 @@
-package ghidra.pyhidra.interpreter;
+package ghidra.pyghidra.interpreter;
import java.io.PrintWriter;
@@ -14,6 +14,6 @@ final class InterpreterTaskMonitor extends TaskMonitorAdapter {
@Override
public void setMessage(String message) {
- output.println(": " + message);
+ output.println(": " + message);
}
}
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/interpreter/PyhidraConsole.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/interpreter/PyGhidraConsole.java
similarity index 79%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/interpreter/PyhidraConsole.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/interpreter/PyGhidraConsole.java
index 37944dd669..e8296fded5 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/interpreter/PyhidraConsole.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/interpreter/PyGhidraConsole.java
@@ -1,4 +1,4 @@
-package ghidra.pyhidra.interpreter;
+package ghidra.pyghidra.interpreter;
import java.util.List;
@@ -12,10 +12,10 @@ import ghidra.util.Disposable;
* This interface is for internal use only and is only public so it can be
* implemented in Python.
*/
-public interface PyhidraConsole extends Disposable {
+public interface PyGhidraConsole extends Disposable {
/**
- * Generates code completions for the pyhidra interpreter
+ * Generates code completions for the PyGhidra interpreter
*
* @param cmd The command to get code completions for
* @param caretPos The position of the caret in the input string 'cmd'.
@@ -26,12 +26,12 @@ public interface PyhidraConsole extends Disposable {
List getCompletions(String cmd, int caretPos);
/**
- * Restarts the pyhidra console
+ * Restarts the PyGhidra console
*/
void restart();
/**
- * Interrupts the code running in the pyhidra console
+ * Interrupts the code running in the PyGhidra console
*/
void interrupt();
}
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/interpreter/PyhidraInterpreter.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/interpreter/PyGhidraInterpreter.java
similarity index 64%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/interpreter/PyhidraInterpreter.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/interpreter/PyGhidraInterpreter.java
index b85f5a41db..ec4363c705 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/interpreter/PyhidraInterpreter.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/interpreter/PyGhidraInterpreter.java
@@ -1,4 +1,4 @@
-package ghidra.pyhidra.interpreter;
+package ghidra.pyghidra.interpreter;
import java.io.PrintWriter;
import java.util.List;
@@ -8,20 +8,20 @@ import ghidra.app.plugin.core.console.CodeCompletion;
import ghidra.app.plugin.core.interpreter.InterpreterConnection;
import ghidra.app.plugin.core.interpreter.InterpreterConsole;
import ghidra.app.plugin.core.interpreter.InterpreterPanelService;
-import ghidra.pyhidra.PyhidraPlugin;
+import ghidra.pyghidra.PyGhidraPlugin;
import ghidra.util.Disposable;
import ghidra.util.exception.AssertException;
import resources.ResourceManager;
/**
- * The pyhidra interpreter connection
+ * The PyGhidra interpreter connection
*/
-public final class PyhidraInterpreter implements Disposable, InterpreterConnection {
+public final class PyGhidraInterpreter implements Disposable, InterpreterConnection {
- private PyhidraConsole pyhidraConsole = null;
+ private PyGhidraConsole pyghidraConsole = null;
public final InterpreterConsole console;
- public PyhidraInterpreter(PyhidraPlugin plugin, boolean isPythonAvailable) {
+ public PyGhidraInterpreter(PyGhidraPlugin plugin, boolean isPythonAvailable) {
InterpreterPanelService service =
plugin.getTool().getService(InterpreterPanelService.class);
console = service.createInterpreterPanel(this, false);
@@ -32,8 +32,8 @@ public final class PyhidraInterpreter implements Disposable, InterpreterConnecti
@Override
public void dispose() {
- if (pyhidraConsole != null) {
- pyhidraConsole.dispose();
+ if (pyghidraConsole != null) {
+ pyghidraConsole.dispose();
}
console.dispose();
}
@@ -45,7 +45,7 @@ public final class PyhidraInterpreter implements Disposable, InterpreterConnecti
@Override
public String getTitle() {
- return PyhidraPlugin.TITLE;
+ return PyGhidraPlugin.TITLE;
}
@Override
@@ -55,20 +55,20 @@ public final class PyhidraInterpreter implements Disposable, InterpreterConnecti
@Override
public List getCompletions(String cmd, int caretPos) {
- if (pyhidraConsole == null) {
+ if (pyghidraConsole == null) {
return List.of();
}
- return pyhidraConsole.getCompletions(cmd, caretPos);
+ return pyghidraConsole.getCompletions(cmd, caretPos);
}
private void unavailableCallback() {
console.setInputPermitted(false);
PrintWriter out = console.getOutWriter();
- out.println("Ghidra was not started with pyhidra. Python is not available.");
+ out.println("Ghidra was not started with PyGhidra. Python is not available.");
}
/**
- * Initializes the interpreter with the provided PyhidraConsole.
+ * Initializes the interpreter with the provided PyGhidraConsole.
*
* This method is for internal use only and is only public so it can be
* called from Python.
@@ -76,13 +76,13 @@ public final class PyhidraInterpreter implements Disposable, InterpreterConnecti
* @param pythonSideConsole the python side console
* @throws AssertException if the interpreter has already been initialized
*/
- public void init(PyhidraConsole pythonSideConsole) {
- if (pyhidraConsole != null) {
+ public void init(PyGhidraConsole pythonSideConsole) {
+ if (pyghidraConsole != null) {
throw new AssertException("the interpreter has already been initialized");
}
- pyhidraConsole = pythonSideConsole;
- console.addFirstActivationCallback(pyhidraConsole::restart);
- console.addAction(new CancelAction(pyhidraConsole));
- console.addAction(new ResetAction(pyhidraConsole));
+ pyghidraConsole = pythonSideConsole;
+ console.addFirstActivationCallback(pyghidraConsole::restart);
+ console.addAction(new CancelAction(pyghidraConsole));
+ console.addAction(new ResetAction(pyghidraConsole));
}
}
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/interpreter/ResetAction.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/interpreter/ResetAction.java
similarity index 73%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/interpreter/ResetAction.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/interpreter/ResetAction.java
index 1de493a3d0..a30997ff96 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/interpreter/ResetAction.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/interpreter/ResetAction.java
@@ -1,9 +1,9 @@
-package ghidra.pyhidra.interpreter;
+package ghidra.pyghidra.interpreter;
import java.awt.event.KeyEvent;
import javax.swing.ImageIcon;
-import ghidra.pyhidra.PyhidraPlugin;
+import ghidra.pyghidra.PyGhidraPlugin;
import ghidra.util.HelpLocation;
import docking.ActionContext;
import docking.action.DockingAction;
@@ -15,10 +15,10 @@ import static docking.DockingUtils.CONTROL_KEY_MODIFIER_MASK;
final class ResetAction extends DockingAction {
- private final PyhidraConsole console;
+ private final PyGhidraConsole console;
- ResetAction(PyhidraConsole console) {
- super("Reset", PyhidraPlugin.class.getSimpleName());
+ ResetAction(PyGhidraConsole console) {
+ super("Reset", PyGhidraPlugin.class.getSimpleName());
this.console = console;
setDescription("Reset the interpreter");
ImageIcon image = ResourceManager.loadImage("images/reload3.png");
@@ -26,7 +26,7 @@ final class ResetAction extends DockingAction {
setEnabled(true);
KeyBindingData key = new KeyBindingData(KeyEvent.VK_D, CONTROL_KEY_MODIFIER_MASK);
setKeyBindingData(key);
- setHelpLocation(new HelpLocation(PyhidraPlugin.TITLE, "Reset_Interpreter"));
+ setHelpLocation(new HelpLocation(PyGhidraPlugin.TITLE, "Reset_Interpreter"));
}
@Override
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/AbstractJavaProperty.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/AbstractJavaProperty.java
similarity index 94%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/AbstractJavaProperty.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/AbstractJavaProperty.java
index e9cb3cf7cd..0f11ce273e 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/AbstractJavaProperty.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/AbstractJavaProperty.java
@@ -1,4 +1,4 @@
-package ghidra.pyhidra.property;
+package ghidra.pyghidra.property;
import java.lang.invoke.MethodHandle;
@@ -16,7 +16,7 @@ import java.lang.invoke.MethodHandle;
* }
* }
*
- * The pyhidra internals expects every {@link JavaProperty} to be an instance of this class.
+ * The PyGhidra internals expects every {@link JavaProperty} to be an instance of this class.
* No checking is required or performed since the {@link JavaProperty} interface and this
* class are sealed.
*/
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/BooleanJavaProperty.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/BooleanJavaProperty.java
similarity index 95%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/BooleanJavaProperty.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/BooleanJavaProperty.java
index 7e764b3f2e..f332d97f7f 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/BooleanJavaProperty.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/BooleanJavaProperty.java
@@ -1,4 +1,4 @@
-package ghidra.pyhidra.property;
+package ghidra.pyghidra.property;
import java.lang.invoke.MethodHandle;
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/ByteJavaProperty.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/ByteJavaProperty.java
similarity index 95%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/ByteJavaProperty.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/ByteJavaProperty.java
index 4afa658564..06e3af80a1 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/ByteJavaProperty.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/ByteJavaProperty.java
@@ -1,4 +1,4 @@
-package ghidra.pyhidra.property;
+package ghidra.pyghidra.property;
import java.lang.invoke.MethodHandle;
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/CharacterJavaProperty.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/CharacterJavaProperty.java
similarity index 95%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/CharacterJavaProperty.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/CharacterJavaProperty.java
index fbbb5fdafb..9c966dce6d 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/CharacterJavaProperty.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/CharacterJavaProperty.java
@@ -1,4 +1,4 @@
-package ghidra.pyhidra.property;
+package ghidra.pyghidra.property;
import java.lang.invoke.MethodHandle;
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/DoubleJavaProperty.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/DoubleJavaProperty.java
similarity index 95%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/DoubleJavaProperty.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/DoubleJavaProperty.java
index 8b75ffb5d7..ed81f5bb0b 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/DoubleJavaProperty.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/DoubleJavaProperty.java
@@ -1,4 +1,4 @@
-package ghidra.pyhidra.property;
+package ghidra.pyghidra.property;
import java.lang.invoke.MethodHandle;
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/FloatJavaProperty.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/FloatJavaProperty.java
similarity index 95%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/FloatJavaProperty.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/FloatJavaProperty.java
index 88bbb340af..e5e26b9839 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/FloatJavaProperty.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/FloatJavaProperty.java
@@ -1,4 +1,4 @@
-package ghidra.pyhidra.property;
+package ghidra.pyghidra.property;
import java.lang.invoke.MethodHandle;
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/IntegerJavaProperty.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/IntegerJavaProperty.java
similarity index 95%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/IntegerJavaProperty.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/IntegerJavaProperty.java
index c14ff1ce77..ccaff265f1 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/IntegerJavaProperty.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/IntegerJavaProperty.java
@@ -1,4 +1,4 @@
-package ghidra.pyhidra.property;
+package ghidra.pyghidra.property;
import java.lang.invoke.MethodHandle;
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/JavaProperty.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/JavaProperty.java
similarity index 97%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/JavaProperty.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/JavaProperty.java
index 08d1fdfd1e..bad5682d5e 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/JavaProperty.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/JavaProperty.java
@@ -1,4 +1,4 @@
-package ghidra.pyhidra.property;
+package ghidra.pyghidra.property;
/**
* Property interface for creating a Python property for getters and setters.
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/JavaPropertyFactory.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/JavaPropertyFactory.java
similarity index 97%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/JavaPropertyFactory.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/JavaPropertyFactory.java
index 11a6278c22..e82e21b374 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/JavaPropertyFactory.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/JavaPropertyFactory.java
@@ -1,4 +1,4 @@
-package ghidra.pyhidra.property;
+package ghidra.pyghidra.property;
import java.lang.invoke.MethodHandle;
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/LongJavaProperty.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/LongJavaProperty.java
similarity index 95%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/LongJavaProperty.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/LongJavaProperty.java
index 9bda93d281..7875a04b3b 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/LongJavaProperty.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/LongJavaProperty.java
@@ -1,4 +1,4 @@
-package ghidra.pyhidra.property;
+package ghidra.pyghidra.property;
import java.lang.invoke.MethodHandle;
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/ObjectJavaProperty.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/ObjectJavaProperty.java
similarity index 95%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/ObjectJavaProperty.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/ObjectJavaProperty.java
index ea62fc38ab..cf38f14de0 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/ObjectJavaProperty.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/ObjectJavaProperty.java
@@ -1,4 +1,4 @@
-package ghidra.pyhidra.property;
+package ghidra.pyghidra.property;
import java.lang.invoke.MethodHandle;
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/PropertyUtils.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/PropertyUtils.java
similarity index 99%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/PropertyUtils.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/PropertyUtils.java
index d62317855f..0915d6b6dc 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/PropertyUtils.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/PropertyUtils.java
@@ -1,4 +1,4 @@
-package ghidra.pyhidra.property;
+package ghidra.pyghidra.property;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
diff --git a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/ShortJavaProperty.java b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/ShortJavaProperty.java
similarity index 95%
rename from Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/ShortJavaProperty.java
rename to Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/ShortJavaProperty.java
index 03f2b6b49a..fd3711819f 100644
--- a/Ghidra/Features/Pyhidra/src/main/java/ghidra/pyhidra/property/ShortJavaProperty.java
+++ b/Ghidra/Features/PyGhidra/src/main/java/ghidra/pyghidra/property/ShortJavaProperty.java
@@ -1,4 +1,4 @@
-package ghidra.pyhidra.property;
+package ghidra.pyghidra.property;
import java.lang.invoke.MethodHandle;
diff --git a/Ghidra/Features/Pyhidra/src/main/py/LICENSE b/Ghidra/Features/PyGhidra/src/main/py/LICENSE
similarity index 100%
rename from Ghidra/Features/Pyhidra/src/main/py/LICENSE
rename to Ghidra/Features/PyGhidra/src/main/py/LICENSE
diff --git a/Ghidra/Features/Pyhidra/src/main/py/MANIFEST.in b/Ghidra/Features/PyGhidra/src/main/py/MANIFEST.in
similarity index 100%
rename from Ghidra/Features/Pyhidra/src/main/py/MANIFEST.in
rename to Ghidra/Features/PyGhidra/src/main/py/MANIFEST.in
diff --git a/Ghidra/Features/Pyhidra/src/main/py/README.md b/Ghidra/Features/PyGhidra/src/main/py/README.md
similarity index 58%
rename from Ghidra/Features/Pyhidra/src/main/py/README.md
rename to Ghidra/Features/PyGhidra/src/main/py/README.md
index 0905a54f58..861b6ff5f3 100644
--- a/Ghidra/Features/Pyhidra/src/main/py/README.md
+++ b/Ghidra/Features/PyGhidra/src/main/py/README.md
@@ -1,9 +1,9 @@
-# pyhidra
+# PyGhidra
-Pyhidra is a Python library that provides direct access to the Ghidra API within a native CPython interpreter using [jpype](https://jpype.readthedocs.io/en/latest). As well, Pyhidra contains some conveniences for setting up analysis on a given sample and running a Ghidra script locally. It also contains a Ghidra plugin to allow the use of CPython from the Ghidra user interface.
+PyGhidra is a Python library that provides direct access to the Ghidra API within a native CPython interpreter using [jpype](https://jpype.readthedocs.io/en/latest). As well, PyGhidra contains some conveniences for setting up analysis on a given sample and running a Ghidra script locally. It also contains a Ghidra plugin to allow the use of CPython from the Ghidra user interface.
-Pyhidra was initially developed for use with Dragodis and is designed to be installable without requiring Java or Ghidra. This allows other Python projects
-have pyhidra as a dependency and provide optional Ghidra functionality without requiring all users to install Java and Ghidra. It is recommended to recommend that users set the `GHIDRA_INSTALL_DIR` environment variable to simplify locating Ghidra.
+PyGhidra was initially developed for use with Dragodis and is designed to be installable without requiring Java or Ghidra. This allows other Python projects
+have PyGhidra as a dependency and provide optional Ghidra functionality without requiring all users to install Java and Ghidra. It is recommended to recommend that users set the `GHIDRA_INSTALL_DIR` environment variable to simplify locating Ghidra.
## Usage
@@ -18,8 +18,8 @@ which will allow you to directly import `ghidra` and `java`.
*NOTE: No projects or programs get setup in this mode.*
```python
-import pyhidra
-pyhidra.start()
+import pyghidra
+pyghidra.start()
import ghidra
from ghidra.app.util.headless import HeadlessAnalyzer
@@ -32,12 +32,12 @@ from java.lang import String
### Customizing Java and Ghidra initialization
-JVM configuration for the classpath and vmargs may be done through a `PyhidraLauncher`.
+JVM configuration for the classpath and vmargs may be done through a `PyGhidraLauncher`.
```python
-from pyhidra.launcher import HeadlessPyhidraLauncher
+from pyghidra.launcher import HeadlessPyGhidraLauncher
-launcher = HeadlessPyhidraLauncher()
+launcher = HeadlessPyGhidraLauncher()
launcher.add_classpaths("log4j-core-2.17.1.jar", "log4j-api-2.17.1.jar")
launcher.add_vmargs("-Dlog4j2.formatMsgNoLookups=true")
launcher.start()
@@ -45,10 +45,10 @@ launcher.start()
### Registering an Entry Point
-The `PyhidraLauncher` can also be configured through the use of a registered entry point on your own python project.
-This is useful for installing your own Ghidra plugin which uses pyhidra and self-compiles.
+The `PyGhidraLauncher` can also be configured through the use of a registered entry point on your own python project.
+This is useful for installing your own Ghidra plugin which uses PyGhidra and self-compiles.
-First create an [entry_point](https://setuptools.pypa.io/en/latest/userguide/entry_point.html) for `pyhidra.setup`
+First create an [entry_point](https://setuptools.pypa.io/en/latest/userguide/entry_point.html) for `pyghidra.setup`
pointing to a single argument function which accepts the launcher instance.
```python
@@ -58,7 +58,7 @@ from setuptools import setup
setup(
# ...,
entry_points={
- 'pyhidra.setup': [
+ 'pyghidra.setup': [
'acme_plugin = acme.ghidra_plugin.install:setup',
]
}
@@ -67,25 +67,25 @@ setup(
Then we create the target function.
-This function will be called every time a user starts a pyhidra launcher.
-In the same fashion, another entry point `pyhidra.pre_launch` may be registered and will be called after Ghidra and all
+This function will be called every time a user starts a PyGhidra launcher.
+In the same fashion, another entry point `pyghidra.pre_launch` may be registered and will be called after Ghidra and all
plugins have been loaded.
```python
# acme/ghidra_plugin/install.py
from pathlib import Path
-import pyhidra
+import pyghidra
def setup(launcher):
"""
- Run by pyhidra launcher to install our plugin.
+ Run by PyGhidra launcher to install our plugin.
"""
launcher.add_classpaths("log4j-core-2.17.1.jar", "log4j-api-2.17.1.jar")
launcher.add_vmargs("-Dlog4j2.formatMsgNoLookups=true")
# Install our plugin.
source_path = Path(__file__).parent / "java" / "plugin" # path to uncompiled .java code
- details = pyhidra.ExtensionDetails(
+ details = pyghidra.ExtensionDetails(
name="acme_plugin",
description="My Cool Plugin",
author="acme",
@@ -97,15 +97,15 @@ def setup(launcher):
### Analyze a File
-To have pyhidra setup a binary file for you, use the `open_program()` function.
+To have PyGhidra setup a binary file for you, use the `open_program()` function.
This will setup a Ghidra project and import the given binary file as a program for you.
Again, this will also allow you to import `ghidra` and `java` to perform more advanced processing.
```python
-import pyhidra
+import pyghidra
-with pyhidra.open_program("binary_file.exe") as flat_api:
+with pyghidra.open_program("binary_file.exe") as flat_api:
program = flat_api.getCurrentProgram()
listing = program.getListing()
print(listing.getCodeUnitAt(flat_api.toAddr(0x1234)))
@@ -117,12 +117,12 @@ with pyhidra.open_program("binary_file.exe") as flat_api:
decomp_api.dispose()
```
-By default, pyhidra will run analysis for you. If you would like to do this yourself, set `analyze` to `False`.
+By default, PyGhidra will run analysis for you. If you would like to do this yourself, set `analyze` to `False`.
```python
-import pyhidra
+import pyghidra
-with pyhidra.open_program("binary_file.exe", analyze=False) as flat_api:
+with pyghidra.open_program("binary_file.exe", analyze=False) as flat_api:
from ghidra.program.util import GhidraProgramUtilities
program = flat_api.getCurrentProgram()
@@ -135,16 +135,16 @@ The `open_program()` function can also accept optional arguments to control the
(Helpful for opening up a sample in an already existing project.)
```python
-import pyhidra
+import pyghidra
-with pyhidra.open_program("binary_file.exe", project_name="EXAM_231", project_location=r"C:\exams\231") as flat_api:
+with pyghidra.open_program("binary_file.exe", project_name="EXAM_231", project_location=r"C:\exams\231") as flat_api:
...
```
### Run a Script
-Pyhidra can also be used to run an existing Ghidra Python script directly in your native python interpreter
+PyGhidra can also be used to run an existing Ghidra Python script directly in your native python interpreter
using the `run_script()` command.
However, while you can technically run an existing Ghidra script unmodified, you may
run into issues due to differences between Jython 2 and CPython 3.
@@ -152,21 +152,21 @@ Therefore, some modification to the script may be needed.
```python
-import pyhidra
+import pyghidra
-pyhidra.run_script(r"C:\input.exe", r"C:\some_ghidra_script.py")
+pyghidra.run_script(r"C:\input.exe", r"C:\some_ghidra_script.py")
```
-This can also be done on the command line using `pyhidra`.
+This can also be done on the command line using `pyghidra`.
```console
-> pyhidra C:\input.exe C:\some_ghidra_script.py
+> pyghidra C:\input.exe C:\some_ghidra_script.py
```
### Handling Package Name Conflicts
There may be some Python modules and Java packages with the same import path. When this occurs the Python module takes precedence.
-While jpype has its own mechanism for handling this situation, pyhidra automatically makes the Java package accessible by allowing
+While jpype has its own mechanism for handling this situation, PyGhidra automatically makes the Java package accessible by allowing
it to be imported with an underscore appended to the package name.
```python
diff --git a/Ghidra/Features/Pyhidra/src/main/py/pyproject.toml b/Ghidra/Features/PyGhidra/src/main/py/pyproject.toml
similarity index 91%
rename from Ghidra/Features/Pyhidra/src/main/py/pyproject.toml
rename to Ghidra/Features/PyGhidra/src/main/py/pyproject.toml
index 9478a8d8b3..ec08544cef 100644
--- a/Ghidra/Features/Pyhidra/src/main/py/pyproject.toml
+++ b/Ghidra/Features/PyGhidra/src/main/py/pyproject.toml
@@ -3,7 +3,7 @@ requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
[project]
-name = "pyhidra"
+name = "pyghidra"
dynamic = ["version", "readme"]
description = "Native CPython for Ghidra"
license = {text = "Apache-2.0"}
@@ -39,16 +39,16 @@ testing = [
]
[project.scripts]
-pyhidra = "pyhidra.__main__:main"
+pyghidra = "pyghidra.__main__:main"
[project.gui-scripts]
-pyhidraw = "pyhidra.gui:_gui"
+pyghidraw = "pyghidra.gui:_gui"
[project.urls]
Repository = "https://github.com/NationalSecurityAgency/ghidra"
[tool.setuptools.dynamic]
-version = {attr = "pyhidra.__version__"}
+version = {attr = "pyghidra.__version__"}
readme = {file = ["README.md"], content-type = "text/markdown"}
[tool.pytest.ini_options]
diff --git a/Ghidra/Features/Pyhidra/src/main/py/setup.py b/Ghidra/Features/PyGhidra/src/main/py/setup.py
similarity index 100%
rename from Ghidra/Features/Pyhidra/src/main/py/setup.py
rename to Ghidra/Features/PyGhidra/src/main/py/setup.py
diff --git a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/__init__.py b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/__init__.py
similarity index 86%
rename from Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/__init__.py
rename to Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/__init__.py
index 5941eb20f1..015c8d950f 100644
--- a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/__init__.py
+++ b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/__init__.py
@@ -41,13 +41,13 @@ debug_callback = _debug_callback
# Expose API
from .core import run_script, start, started, open_program
-from .launcher import DeferredPyhidraLauncher, GuiPyhidraLauncher, HeadlessPyhidraLauncher
+from .launcher import DeferredPyGhidraLauncher, GuiPyGhidraLauncher, HeadlessPyGhidraLauncher
from .script import get_current_interpreter
from .version import ApplicationInfo, ExtensionDetails
__all__ = [
"debug_callback", "get_current_interpreter", "open_program", "run_script", "start",
- "started", "ApplicationInfo", "DeferredPyhidraLauncher", "ExtensionDetails",
- "GuiPyhidraLauncher", "HeadlessPyhidraLauncher"
+ "started", "ApplicationInfo", "DeferredPyGhidraLauncher", "ExtensionDetails",
+ "GuiPyGhidraLauncher", "HeadlessPyGhidraLauncher"
]
diff --git a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/__main__.py b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/__main__.py
similarity index 90%
rename from Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/__main__.py
rename to Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/__main__.py
index 54cc8c7e3a..4959314425 100644
--- a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/__main__.py
+++ b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/__main__.py
@@ -5,13 +5,13 @@ import logging
import sys
from pathlib import Path
-import pyhidra
-import pyhidra.core
-import pyhidra.gui
+import pyghidra
+import pyghidra.core
+import pyghidra.gui
-# NOTE: this must be "pyhidra" and not __name__
-logger = logging.getLogger("pyhidra")
+# NOTE: this must be "pyghidra" and not __name__
+logger = logging.getLogger("pyghidra")
def _interpreter(interpreter_globals: dict):
@@ -24,7 +24,7 @@ def _interpreter(interpreter_globals: dict):
# pylint: disable=too-few-public-methods
-class PyhidraArgs(argparse.Namespace):
+class PyGhidraArgs(argparse.Namespace):
"""
Custom namespace for holding the command line arguments
"""
@@ -60,18 +60,18 @@ class PyhidraArgs(argparse.Namespace):
vmargs = self.jvm_args
if self.gui:
- pyhidra.gui.gui(self.install_dir, vmargs)
+ pyghidra.gui.gui(self.install_dir, vmargs)
return
# not in gui mode so it is easier to start Ghidra now
- launcher = pyhidra.HeadlessPyhidraLauncher(
+ launcher = pyghidra.HeadlessPyGhidraLauncher(
verbose=self.verbose, install_dir=self.install_dir)
launcher.vm_args = vmargs + launcher.vm_args
launcher.start()
if self.script_path is not None:
try:
- pyhidra.run_script(
+ pyghidra.run_script(
self.binary_path,
self.script_path,
project_location=self.project_path,
@@ -92,7 +92,7 @@ class PyhidraArgs(argparse.Namespace):
self.verbose,
not self.skip_analysis
)
- with pyhidra.core._flat_api(*args, install_dir=self.install_dir) as api:
+ with pyghidra.core._flat_api(*args, install_dir=self.install_dir) as api:
_interpreter(api)
else:
_interpreter(globals())
@@ -129,7 +129,7 @@ class PathAction(argparse.Action):
self.nargs = '*'
self.type = str
- def __call__(self, parser, namespace: PyhidraArgs, values, option_string=None):
+ def __call__(self, parser, namespace: PyGhidraArgs, values, option_string=None):
if not values:
return
@@ -168,7 +168,7 @@ class PathAction(argparse.Action):
def _get_parser():
- parser = argparse.ArgumentParser(prog="pyhidra")
+ parser = argparse.ArgumentParser(prog="pyghidra")
parser.add_argument(
"-v",
"--verbose",
@@ -215,7 +215,7 @@ def _get_parser():
action=PathAction,
help=(
"Headless script path. The script must have a .py extension. "
- "If a script is not provided, pyhidra will drop into a repl."
+ "If a script is not provided, pyghidra will drop into a repl."
)
)
parser.add_argument(
@@ -258,7 +258,7 @@ def _get_parser():
def main():
"""
- pyhidra module main function
+ pyghidra module main function
"""
handler = logging.StreamHandler()
formatter = logging.Formatter("%(filename)s:%(lineno)d %(message)s")
@@ -266,7 +266,7 @@ def main():
logger.addHandler(handler)
parser = _get_parser()
- parser.parse_args(namespace=PyhidraArgs(parser)).func()
+ parser.parse_args(namespace=PyGhidraArgs(parser)).func()
if __name__ == "__main__":
diff --git a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/converters.py b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/converters.py
similarity index 100%
rename from Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/converters.py
rename to Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/converters.py
diff --git a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/core.py b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/core.py
similarity index 93%
rename from Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/core.py
rename to Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/core.py
index 1d43198235..68d65aaffa 100644
--- a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/core.py
+++ b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/core.py
@@ -2,18 +2,18 @@ import contextlib
from pathlib import Path
from typing import Union, TYPE_CHECKING, Tuple, ContextManager, List, Optional
-from pyhidra.converters import * # pylint: disable=wildcard-import, unused-wildcard-import
+from pyghidra.converters import * # pylint: disable=wildcard-import, unused-wildcard-import
if TYPE_CHECKING:
- from pyhidra.launcher import PyhidraLauncher
+ from pyghidra.launcher import PyGhidraLauncher
from ghidra.base.project import GhidraProject
from ghidra.program.flatapi import FlatProgramAPI
from ghidra.program.model.lang import CompilerSpec, Language, LanguageService
from ghidra.program.model.listing import Program
-def start(verbose=False, *, install_dir: Path = None) -> "PyhidraLauncher":
+def start(verbose=False, *, install_dir: Path = None) -> "PyGhidraLauncher":
"""
Starts the JVM and fully initializes Ghidra in Headless mode.
@@ -22,18 +22,18 @@ def start(verbose=False, *, install_dir: Path = None) -> "PyhidraLauncher":
(Defaults to the GHIDRA_INSTALL_DIR environment variable)
:return: The PhyidraLauncher used to start the JVM
"""
- from pyhidra.launcher import HeadlessPyhidraLauncher
- launcher = HeadlessPyhidraLauncher(verbose=verbose, install_dir=install_dir)
+ from pyghidra.launcher import HeadlessPyGhidraLauncher
+ launcher = HeadlessPyGhidraLauncher(verbose=verbose, install_dir=install_dir)
launcher.start()
return launcher
def started() -> bool:
"""
- Whether the PyhidraLauncher has already started.
+ Whether the PyGhidraLauncher has already started.
"""
- from pyhidra.launcher import PyhidraLauncher
- return PyhidraLauncher.has_launched()
+ from pyghidra.launcher import PyGhidraLauncher
+ return PyGhidraLauncher.has_launched()
def _get_language(id: str) -> "Language":
@@ -137,7 +137,7 @@ def _setup_project(
def _setup_script(project: "GhidraProject", program: "Program"):
- from pyhidra.script import PyGhidraScript
+ from pyghidra.script import PyGhidraScript
from ghidra.app.script import GhidraState
from ghidra.program.util import ProgramLocation
from ghidra.util.task import TaskMonitor
@@ -205,10 +205,10 @@ def open_program(
:raises TypeError: If the provided loader does not implement `ghidra.app.util.opinion.Loader`.
"""
- from pyhidra.launcher import PyhidraLauncher, HeadlessPyhidraLauncher
+ from pyghidra.launcher import PyGhidraLauncher, HeadlessPyGhidraLauncher
- if not PyhidraLauncher.has_launched():
- HeadlessPyhidraLauncher().start()
+ if not PyGhidraLauncher.has_launched():
+ HeadlessPyGhidraLauncher().start()
from ghidra.app.script import GhidraScriptUtil
from ghidra.program.flatapi import FlatProgramAPI
@@ -273,10 +273,10 @@ def _flat_api(
:raises ValueError: If the provided language, compiler or loader is invalid.
:raises TypeError: If the provided loader does not implement `ghidra.app.util.opinion.Loader`.
"""
- from pyhidra.launcher import PyhidraLauncher, HeadlessPyhidraLauncher
+ from pyghidra.launcher import PyGhidraLauncher, HeadlessPyGhidraLauncher
- if not PyhidraLauncher.has_launched():
- HeadlessPyhidraLauncher(verbose=verbose, install_dir=install_dir).start()
+ if not PyGhidraLauncher.has_launched():
+ HeadlessPyGhidraLauncher(verbose=verbose, install_dir=install_dir).start()
project, program = None, None
if binary_path or project_location:
diff --git a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/ghidra_launch.py b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/ghidra_launch.py
similarity index 96%
rename from Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/ghidra_launch.py
rename to Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/ghidra_launch.py
index c985f03005..890f677aa6 100644
--- a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/ghidra_launch.py
+++ b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/ghidra_launch.py
@@ -4,10 +4,10 @@ from pathlib import Path
import sys
import threading
-from .launcher import PyhidraLauncher, _run_mac_app
+from .launcher import PyGhidraLauncher, _run_mac_app
-class GhidraLauncher(PyhidraLauncher):
+class GhidraLauncher(PyGhidraLauncher):
def __init__(self, verbose=False, class_name=str, gui=False, *, install_dir: Path = None):
super().__init__(verbose=verbose, install_dir=install_dir)
diff --git a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/ghidradoc.py b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/ghidradoc.py
similarity index 98%
rename from Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/ghidradoc.py
rename to Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/ghidradoc.py
index 7cef49ca2f..e0b3eded73 100644
--- a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/ghidradoc.py
+++ b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/ghidradoc.py
@@ -50,14 +50,14 @@ class _Helper:
self.msg += " # Perform headless processing\n"
self.msg += " headless.processLocal(...)\n\n"
else:
- # PyhidraPlugin scenario
+ # PyGhidraPlugin scenario
self.msg = "Press 'F1' for usage instructions"
def __call__(self, param=None):
def get_class_and_method(param):
if param is None and not SystemUtilities.isInHeadlessMode():
- # Enable help() in PyhidraPlugin scenario to show help for GhidraScript
+ # Enable help() in PyGhidraPlugin scenario to show help for GhidraScript
return "ghidra.app.script.GhidraScript", None
class_name = None
method_name = None
diff --git a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/gui.py b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/gui.py
similarity index 92%
rename from Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/gui.py
rename to Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/gui.py
index adbd7cc33c..aba4facd7d 100644
--- a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/gui.py
+++ b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/gui.py
@@ -8,7 +8,7 @@ import traceback
from typing import List, NoReturn
import warnings
-import pyhidra
+import pyghidra
class _GuiOutput(io.StringIO):
@@ -44,7 +44,7 @@ def _gui_mac() -> NoReturn:
path = Path(sys.base_exec_prefix) / "Resources/Python.app/Contents/MacOS/Python"
if path.exists():
# the python launcher app will correctly start the venv if sys.executable is in a venv
- argv = [sys.executable, "-m", "pyhidra", "-g"]
+ argv = [sys.executable, "-m", "pyghidra", "-g"]
if install_dir is not None:
argv += ["--install-dir", str(install_dir)]
actions = ((os.POSIX_SPAWN_CLOSE, 0), (os.POSIX_SPAWN_CLOSE, 1), (os.POSIX_SPAWN_CLOSE, 2))
@@ -55,7 +55,7 @@ def _gui_mac() -> NoReturn:
def _parse_args():
- parser = _GuiArgumentParser(prog="pyhidraw")
+ parser = _GuiArgumentParser(prog="pyghidraw")
parser.add_argument(
"--install-dir",
type=Path,
@@ -133,7 +133,7 @@ def gui(install_dir: Path = None, vm_args: List[str] = None):
(Defaults to the GHIDRA_INSTALL_DIR environment variable)
:param vm_args: Additional vm arguments to be passed ot the JVM.
"""
- launcher = pyhidra.GuiPyhidraLauncher(install_dir=install_dir)
+ launcher = pyghidra.GuiPyGhidraLauncher(install_dir=install_dir)
if vm_args:
launcher.vm_args += vm_args
launcher.start()
@@ -141,8 +141,8 @@ def gui(install_dir: Path = None, vm_args: List[str] = None):
def get_current_interpreter():
warnings.warn(
- "get_current_interpreter has been moved. Please use pyhidra.get_current_interpreter",
+ "get_current_interpreter has been moved. Please use pyghidra.get_current_interpreter",
DeprecationWarning
)
- return pyhidra.get_current_interpreter()
+ return pyghidra.get_current_interpreter()
diff --git a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/internal/__init__.py b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/internal/__init__.py
similarity index 100%
rename from Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/internal/__init__.py
rename to Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/internal/__init__.py
diff --git a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/internal/plugin/__init__.py b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/internal/plugin/__init__.py
similarity index 100%
rename from Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/internal/plugin/__init__.py
rename to Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/internal/plugin/__init__.py
diff --git a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/internal/plugin/completions.py b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/internal/plugin/completions.py
similarity index 100%
rename from Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/internal/plugin/completions.py
rename to Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/internal/plugin/completions.py
diff --git a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/internal/plugin/plugin.py b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/internal/plugin/plugin.py
similarity index 95%
rename from Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/internal/plugin/plugin.py
rename to Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/internal/plugin/plugin.py
index d5f8d9bbc8..ede8375080 100644
--- a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/internal/plugin/plugin.py
+++ b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/internal/plugin/plugin.py
@@ -9,8 +9,8 @@ import types
from code import InteractiveConsole
from ghidra.framework import Application
-from ghidra.pyhidra import PyhidraScriptProvider, PyhidraPlugin
-from ghidra.pyhidra.interpreter import PyhidraConsole
+from ghidra.pyghidra import PyGhidraScriptProvider, PyGhidraPlugin
+from ghidra.pyghidra.interpreter import PyGhidraConsole
from java.io import BufferedReader, InputStreamReader
from java.lang import String
from java.lang import Thread as JThread
@@ -18,8 +18,8 @@ from java.util import Collections
from java.util.function import Consumer
from jpype import JClass, JImplements, JOverride
-from pyhidra.internal.plugin.completions import PythonCodeCompleter
-from pyhidra.script import PyGhidraScript
+from pyghidra.internal.plugin.completions import PythonCodeCompleter
+from pyghidra.script import PyGhidraScript
logger = logging.getLogger(__name__)
@@ -125,15 +125,15 @@ class ConsoleState(enum.Enum):
RESET = enum.auto()
-@JImplements(PyhidraConsole)
+@JImplements(PyGhidraConsole)
class PyConsole(InteractiveConsole):
"""
- Pyhidra Interactive Console
+ PyGhidra Interactive Console
"""
_WORD_PATTERN = re.compile(r".*?([\w\.]+)\Z") # get the last word, including '.', from the right
- def __init__(self, py_plugin: PyhidraPlugin):
+ def __init__(self, py_plugin: PyGhidraPlugin):
super().__init__(locals=PyGhidraScript(py_plugin.script))
appVersion = Application.getApplicationVersion()
appName = Application.getApplicationReleaseName()
@@ -314,11 +314,11 @@ class PyConsole(InteractiveConsole):
return Collections.emptyList()
-def _init_plugin(plugin: PyhidraPlugin):
+def _init_plugin(plugin: PyGhidraPlugin):
console = PyConsole(plugin)
plugin.interpreter.init(console)
def setup_plugin():
- PyhidraPlugin.setInitializer(Consumer @ _init_plugin)
- PyhidraScriptProvider.setScriptRunner(Consumer @ _run_script)
+ PyGhidraPlugin.setInitializer(Consumer @ _init_plugin)
+ PyGhidraScriptProvider.setScriptRunner(Consumer @ _run_script)
diff --git a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/javac.py b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/javac.py
similarity index 100%
rename from Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/javac.py
rename to Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/javac.py
diff --git a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/launcher.py b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/launcher.py
similarity index 95%
rename from Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/launcher.py
rename to Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/launcher.py
index 6d43950037..fa510e6833 100644
--- a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/launcher.py
+++ b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/launcher.py
@@ -76,7 +76,7 @@ def _load_entry_points(group: str, *args):
logger.error(f"Failed to run {group} entry point {name} with error: {e}")
-class _PyhidraImportLoader:
+class _PyGhidraImportLoader:
""" (internal) Finder hook for importlib to handle Python mod conflicts. """
def find_spec(self, name, path, target=None):
@@ -101,7 +101,7 @@ def _plugin_lock():
File lock for processing plugins
"""
from java.io import RandomAccessFile
- path = Path(tempfile.gettempdir()) / "pyhidra_plugin_lock"
+ path = Path(tempfile.gettempdir()) / "pyghidra_plugin_lock"
try:
# Python doesn't have a file lock except for unix systems
# so use the one available in Java instead of adding on
@@ -117,19 +117,19 @@ def _plugin_lock():
path.unlink()
except:
# if it fails it's ok
- # another pyhidra process has the lock
+ # another pyghidra process has the lock
# it will be removed by said process when done
pass
-class PyhidraLauncher:
+class PyGhidraLauncher:
"""
- Base pyhidra launcher
+ Base pyghidra launcher
"""
def __init__(self, verbose=False, *, install_dir: Path = None):
"""
- Initializes a new `PyhidraLauncher`.
+ Initializes a new `PyGhidraLauncher`.
:param verbose: True to enable verbose output when starting Ghidra.
:param install_dir: Ghidra installation directory.
@@ -296,10 +296,10 @@ class PyhidraLauncher:
# dev mode
return install_dir
- path = install_dir / "Ghidra" / "Features" / "Pyhidra" / "lib" / "Pyhidra.jar"
+ path = install_dir / "Ghidra" / "Features" / "PyGhidra" / "lib" / "PyGhidra.jar"
if not path.exists():
- msg = "The Ghidra installation does not contain the Pyhidra module\n" + \
+ msg = "The Ghidra installation does not contain the PyGhidra module\n" + \
f"{path} does not exist"
cls._report_fatal_error("Incorrect Ghidra installation directory", msg, ValueError(msg))
@@ -344,12 +344,12 @@ class PyhidraLauncher:
Run setup entry points, start the JVM and prepare ghidra imports
"""
# Before starting up, give launcher to installed entry points so they can do their thing.
- _load_entry_points("pyhidra.setup", self)
+ _load_entry_points("pyghidra.setup", self)
# Merge classpath
jpype_kwargs['classpath'] = self.class_path + jpype_kwargs.get('classpath', [])
- # force convert strings (required by pyhidra)
+ # force convert strings (required by pyghidra)
jpype_kwargs['convertStrings'] = True
# set the JAVA_HOME environment variable to the correct one so jpype uses it
@@ -357,7 +357,7 @@ class PyhidraLauncher:
jpype_kwargs['ignoreUnrecognized'] = True
- if os.getenv("PYHIDRA_DEBUG"):
+ if os.getenv("PYGHIDRA_DEBUG"):
debug = "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:18001"
self.vm_args.insert(0, debug)
@@ -368,7 +368,7 @@ class PyhidraLauncher:
)
# Install hook into python importlib
- sys.meta_path.append(_PyhidraImportLoader())
+ sys.meta_path.append(_PyGhidraImportLoader())
imports.registerDomain("ghidra")
@@ -384,11 +384,11 @@ class PyhidraLauncher:
- # remove any installed pyhidra extension
+ # remove any old installed pyhidra extension
# if left in place Ghidra will fail to start with a confusing
# and unrelated error about the InterpreterConsole class not being found
# this is only needed for those using a DEV build of Ghidra
- # who also have pyhidra installed.
+ # who also have and old version of pyhidra installed.
# however, this took an unnecessary amount of time to debug
self.uninstall_plugin("pyhidra")
@@ -404,7 +404,7 @@ class PyhidraLauncher:
self._layout = GhidraLauncher.initializeGhidraEnvironment()
# import it at the end so interfaces in our java code may be implemented
- from pyhidra.internal.plugin.plugin import setup_plugin
+ from pyghidra.internal.plugin.plugin import setup_plugin
setup_plugin()
# Add extra class paths
@@ -432,7 +432,7 @@ class PyhidraLauncher:
# import properties to register the property customizer
from . import properties as _
- _load_entry_points("pyhidra.pre_launch")
+ _load_entry_points("pyghidra.pre_launch")
def start(self, **jpype_kwargs):
"""
@@ -548,9 +548,9 @@ class PyhidraLauncher:
return Application.isInitialized()
-class DeferredPyhidraLauncher(PyhidraLauncher):
+class DeferredPyGhidraLauncher(PyGhidraLauncher):
"""
- PyhidraLauncher which allows full Ghidra initialization to be deferred.
+ PyGhidraLauncher which allows full Ghidra initialization to be deferred.
initialize_ghidra must be called before all Ghidra classes are fully available.
"""
@@ -571,9 +571,9 @@ class DeferredPyhidraLauncher(PyhidraLauncher):
GhidraRun().launch(self._layout, self.args)
-class HeadlessPyhidraLauncher(PyhidraLauncher):
+class HeadlessPyGhidraLauncher(PyGhidraLauncher):
"""
- Headless pyhidra launcher
+ Headless pyghidra launcher
"""
def _launch(self):
@@ -583,7 +583,7 @@ class HeadlessPyhidraLauncher(PyhidraLauncher):
Application.initializeApplication(self._layout, config)
-class _PyhidraStdOut:
+class _PyGhidraStdOut:
def __init__(self, stream):
self._stream = stream
@@ -615,9 +615,9 @@ class _PyhidraStdOut:
return self._stream.write(s)
-class GuiPyhidraLauncher(PyhidraLauncher):
+class GuiPyGhidraLauncher(PyGhidraLauncher):
"""
- GUI pyhidra launcher
+ GUI pyghidra launcher
"""
@classmethod
@@ -647,8 +647,8 @@ class GuiPyhidraLauncher(PyhidraLauncher):
appid = ctypes.c_wchar_p(self.app_info.name)
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(appid)
- stdout = _PyhidraStdOut(sys.stdout)
- stderr = _PyhidraStdOut(sys.stderr)
+ stdout = _PyGhidraStdOut(sys.stdout)
+ stderr = _PyGhidraStdOut(sys.stderr)
with contextlib.redirect_stdout(stdout), contextlib.redirect_stderr(stderr):
Thread(lambda: Ghidra.main(["ghidra.GhidraRun", *self.args])).start()
is_exiting = threading.Event()
diff --git a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/properties.py b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/properties.py
similarity index 91%
rename from Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/properties.py
rename to Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/properties.py
index 61008f9035..314df44a16 100644
--- a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/properties.py
+++ b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/properties.py
@@ -14,10 +14,10 @@ class _JavaObject:
if isinstance(self, jpype.JException):
# don't process any exceptions
return
- exposer = jpype.JClass("ghidra.pyhidra.PythonFieldExposer")
+ exposer = jpype.JClass("ghidra.pyghidra.PythonFieldExposer")
if exposer.class_.isAssignableFrom(self.class_):
return
- utils = jpype.JClass("ghidra.pyhidra.property.PropertyUtils")
+ utils = jpype.JClass("ghidra.pyghidra.property.PropertyUtils")
for prop in utils.getProperties(self.class_):
field = prop.field
if keyword.iskeyword(field):
diff --git a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/script.py b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/script.py
similarity index 93%
rename from Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/script.py
rename to Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/script.py
index 9e4a79e1d6..acaeb472e9 100644
--- a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/script.py
+++ b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/script.py
@@ -12,7 +12,7 @@ from jpype import JClass, JImplementationFor
from typing import List
-from pyhidra import debug_callback
+from pyghidra import debug_callback
_NO_ATTRIBUTE = object()
@@ -70,12 +70,12 @@ class _JavaProperty(property):
#pylint: disable=too-few-public-methods
-@JImplementationFor("ghidra.pyhidra.PythonFieldExposer")
+@JImplementationFor("ghidra.pyghidra.PythonFieldExposer")
class _PythonFieldExposer:
#pylint: disable=no-member
def __jclass_init__(self):
- exposer = JClass("ghidra.pyhidra.PythonFieldExposer")
+ exposer = JClass("ghidra.pyghidra.PythonFieldExposer")
if self.class_ == exposer:
return
try:
@@ -135,8 +135,8 @@ class PyGhidraScript(dict):
def __init__(self, jobj=None):
super().__init__()
if jobj is None:
- from ghidra.pyhidra import PyhidraScriptProvider
- jobj = PyhidraScriptProvider().getScriptInstance(None, None)
+ from ghidra.pyghidra import PyGhidraScriptProvider
+ jobj = PyGhidraScriptProvider().getScriptInstance(None, None)
self._script = jobj
global _headless_interpreter
@@ -258,7 +258,7 @@ class PyGhidraScript(dict):
def get_current_interpreter():
"""
- Gets the underlying GhidraScript for the focused Pyhidra InteractiveConsole.
+ Gets the underlying GhidraScript for the focused PyGhidra InteractiveConsole.
This will always return None unless it is being access from a function
called from within the interactive console.
@@ -274,8 +274,8 @@ def get_current_interpreter():
if SystemUtilities.isInHeadlessMode():
if _headless_interpreter is None:
# one hasn't been created yet so make one now
- PyhidraScriptProvider = JClass("ghidra.pyhidra.PyhidraScriptProvider")
- _headless_interpreter = PyhidraScriptProvider.PyhidraHeadlessScript()
+ PyGhidraScriptProvider = JClass("ghidra.pyghidra.PyGhidraScriptProvider")
+ _headless_interpreter = PyGhidraScriptProvider.PyGhidraHeadlessScript()
return _headless_interpreter
project = AppInfo.getActiveProject()
@@ -293,7 +293,7 @@ def get_current_interpreter():
return None
for plugin in tool.getManagedPlugins():
- if plugin.name == 'PyhidraPlugin':
+ if plugin.name == 'PyGhidraPlugin':
return plugin.script
except ImportError:
diff --git a/Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/version.py b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/version.py
similarity index 100%
rename from Ghidra/Features/Pyhidra/src/main/py/src/pyhidra/version.py
rename to Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/version.py
diff --git a/Ghidra/Features/Pyhidra/src/main/py/tests/data/bad_plugin/BadPluginClass.java b/Ghidra/Features/PyGhidra/src/main/py/tests/data/bad_plugin/BadPluginClass.java
similarity index 86%
rename from Ghidra/Features/Pyhidra/src/main/py/tests/data/bad_plugin/BadPluginClass.java
rename to Ghidra/Features/PyGhidra/src/main/py/tests/data/bad_plugin/BadPluginClass.java
index 92ddc11555..2b90059eab 100644
--- a/Ghidra/Features/Pyhidra/src/main/py/tests/data/bad_plugin/BadPluginClass.java
+++ b/Ghidra/Features/PyGhidra/src/main/py/tests/data/bad_plugin/BadPluginClass.java
@@ -1,4 +1,4 @@
-package ghidra.pyhidra.test;
+package ghidra.pyghidra.test;
/**
* This is a bad class that will fail to compile.
diff --git a/Ghidra/Features/Pyhidra/src/main/py/tests/data/example_script.py b/Ghidra/Features/PyGhidra/src/main/py/tests/data/example_script.py
similarity index 100%
rename from Ghidra/Features/Pyhidra/src/main/py/tests/data/example_script.py
rename to Ghidra/Features/PyGhidra/src/main/py/tests/data/example_script.py
diff --git a/Ghidra/Features/Pyhidra/src/main/py/tests/data/good_plugin/DummyTestRecognizer.java b/Ghidra/Features/PyGhidra/src/main/py/tests/data/good_plugin/DummyTestRecognizer.java
similarity index 89%
rename from Ghidra/Features/Pyhidra/src/main/py/tests/data/good_plugin/DummyTestRecognizer.java
rename to Ghidra/Features/PyGhidra/src/main/py/tests/data/good_plugin/DummyTestRecognizer.java
index 399046c8ef..b325b71391 100644
--- a/Ghidra/Features/Pyhidra/src/main/py/tests/data/good_plugin/DummyTestRecognizer.java
+++ b/Ghidra/Features/PyGhidra/src/main/py/tests/data/good_plugin/DummyTestRecognizer.java
@@ -1,9 +1,9 @@
-package ghidra.pyhidra.test;
+package ghidra.pyghidra.test;
import ghidra.app.util.recognizer.Recognizer;
/**
- * Simple ExtensionPoint class for pyhidra plugin test.
+ * Simple ExtensionPoint class for PyGhidra plugin test.
*
* This can be any ExtensionPoint. Recognizer was chosen here
* because it has a small number of methods and hasn't changed in a long time.
diff --git a/Ghidra/Features/Pyhidra/src/main/py/tests/data/import_test_script.py b/Ghidra/Features/PyGhidra/src/main/py/tests/data/import_test_script.py
similarity index 100%
rename from Ghidra/Features/Pyhidra/src/main/py/tests/data/import_test_script.py
rename to Ghidra/Features/PyGhidra/src/main/py/tests/data/import_test_script.py
diff --git a/Ghidra/Features/Pyhidra/src/main/py/tests/data/programless_script.py b/Ghidra/Features/PyGhidra/src/main/py/tests/data/programless_script.py
similarity index 100%
rename from Ghidra/Features/Pyhidra/src/main/py/tests/data/programless_script.py
rename to Ghidra/Features/PyGhidra/src/main/py/tests/data/programless_script.py
diff --git a/Ghidra/Features/Pyhidra/src/main/py/tests/data/projectless_script.py b/Ghidra/Features/PyGhidra/src/main/py/tests/data/projectless_script.py
similarity index 100%
rename from Ghidra/Features/Pyhidra/src/main/py/tests/data/projectless_script.py
rename to Ghidra/Features/PyGhidra/src/main/py/tests/data/projectless_script.py
diff --git a/Ghidra/Features/Pyhidra/src/main/py/tests/test_argparser.py b/Ghidra/Features/PyGhidra/src/main/py/tests/test_argparser.py
similarity index 96%
rename from Ghidra/Features/Pyhidra/src/main/py/tests/test_argparser.py
rename to Ghidra/Features/PyGhidra/src/main/py/tests/test_argparser.py
index 0ceb3290a8..b010876798 100644
--- a/Ghidra/Features/Pyhidra/src/main/py/tests/test_argparser.py
+++ b/Ghidra/Features/PyGhidra/src/main/py/tests/test_argparser.py
@@ -2,9 +2,9 @@ from pathlib import Path
from typing import List, Tuple
import pytest
-from pyhidra.__main__ import _get_parser, PyhidraArgs
-from pyhidra.ghidra_launch import ParsedArgs
-from pyhidra.ghidra_launch import get_parser as get_ghidra_launcher_parser
+from pyghidra.__main__ import _get_parser, PyGhidraArgs
+from pyghidra.ghidra_launch import ParsedArgs
+from pyghidra.ghidra_launch import get_parser as get_ghidra_launcher_parser
PROJECT_NAME = "stub_name"
@@ -20,9 +20,9 @@ def exe_file(shared_datadir: Path):
class TestArgParser:
- def parse(self, *args) -> PyhidraArgs:
+ def parse(self, *args) -> PyGhidraArgs:
parser = _get_parser()
- parser_args = PyhidraArgs(parser)
+ parser_args = PyGhidraArgs(parser)
args = [str(arg) for arg in args]
parser.parse_args(args, namespace=parser_args)
return parser_args
diff --git a/Ghidra/Features/Pyhidra/src/main/py/tests/test_core.py b/Ghidra/Features/PyGhidra/src/main/py/tests/test_core.py
similarity index 81%
rename from Ghidra/Features/Pyhidra/src/main/py/tests/test_core.py
rename to Ghidra/Features/PyGhidra/src/main/py/tests/test_core.py
index cdf5c5f1b2..0bc74cdf05 100644
--- a/Ghidra/Features/Pyhidra/src/main/py/tests/test_core.py
+++ b/Ghidra/Features/PyGhidra/src/main/py/tests/test_core.py
@@ -4,7 +4,7 @@ import textwrap
import importlib
import sys
import jpype
-import pyhidra
+import pyghidra
import pytest
EXE_NAME = "strings.exe"
@@ -23,7 +23,7 @@ def class_file(shared_datadir: Path):
def test_invalid_jpype_keyword_arg():
assert not jpype.isJVMStarted()
- launcher = pyhidra.launcher.HeadlessPyhidraLauncher()
+ launcher = pyghidra.launcher.HeadlessPyGhidraLauncher()
with pytest.raises(TypeError) as ex:
launcher.start(someBogusKeywordArg=True)
assert "startJVM() got an unexpected keyword argument 'someBogusKeywordArg'" in str(ex.value)
@@ -32,7 +32,7 @@ def test_invalid_jpype_keyword_arg():
def test_invalid_vm_arg_succeed():
assert not jpype.isJVMStarted()
- launcher = pyhidra.launcher.HeadlessPyhidraLauncher()
+ launcher = pyghidra.launcher.HeadlessPyGhidraLauncher()
launcher.add_vmargs('-XX:SomeBogusJvmArg')
launcher.start(ignoreUnrecognized=True)
@@ -40,7 +40,7 @@ def test_invalid_vm_arg_succeed():
def test_run_script(capsys, shared_datadir: Path):
strings_exe = shared_datadir / EXE_NAME
script_path = shared_datadir / "example_script.py"
- pyhidra.run_script(strings_exe, script_path, script_args=["my", "--commands"], analyze=False)
+ pyghidra.run_script(strings_exe, script_path, script_args=["my", "--commands"], analyze=False)
captured = capsys.readouterr()
assert captured.err == ""
@@ -56,7 +56,7 @@ def test_run_script(capsys, shared_datadir: Path):
def test_open_program(shared_datadir: Path):
strings_exe = shared_datadir / EXE_NAME
- with pyhidra.open_program(strings_exe, analyze=False, language=TEST_LANGUAGE, compiler=TEST_COMPILER) as flat_api:
+ with pyghidra.open_program(strings_exe, analyze=False, language=TEST_LANGUAGE, compiler=TEST_COMPILER) as flat_api:
assert flat_api.currentProgram.name == strings_exe.name
assert flat_api.getCurrentProgram().listing
assert flat_api.getCurrentProgram().changeable
@@ -65,7 +65,7 @@ def test_open_program(shared_datadir: Path):
def test_bad_language(shared_datadir: Path):
strings_exe = shared_datadir / EXE_NAME
with pytest.raises(ValueError):
- with pyhidra.open_program(
+ with pyghidra.open_program(
strings_exe,
analyze=False,
language="invalid"
@@ -76,7 +76,7 @@ def test_bad_language(shared_datadir: Path):
def test_bad_compiler(shared_datadir: Path):
strings_exe = shared_datadir / EXE_NAME
with pytest.raises(ValueError):
- with pyhidra.open_program(
+ with pyghidra.open_program(
strings_exe,
analyze=False,
language=TEST_LANGUAGE,
@@ -87,19 +87,19 @@ def test_bad_compiler(shared_datadir: Path):
def test_no_compiler(shared_datadir: Path):
strings_exe = shared_datadir / EXE_NAME
- with pyhidra.open_program(strings_exe, analyze=False, language=TEST_LANGUAGE) as flat_api:
+ with pyghidra.open_program(strings_exe, analyze=False, language=TEST_LANGUAGE) as flat_api:
pass
def test_no_language_with_compiler(shared_datadir: Path):
strings_exe = shared_datadir / EXE_NAME
- with pyhidra.open_program(strings_exe, analyze=False, compiler=TEST_COMPILER) as flat_api:
+ with pyghidra.open_program(strings_exe, analyze=False, compiler=TEST_COMPILER) as flat_api:
pass
def test_loader(shared_datadir: Path):
strings_exe = shared_datadir / EXE_NAME
- with pyhidra.open_program(
+ with pyghidra.open_program(
strings_exe,
analyze=False,
language="DATA:LE:64:default",
@@ -112,7 +112,7 @@ def test_loader(shared_datadir: Path):
def test_invalid_loader(shared_datadir: Path):
strings_exe = shared_datadir / EXE_NAME
with pytest.raises(ValueError):
- with pyhidra.open_program(
+ with pyghidra.open_program(
strings_exe,
analyze=False,
language="DATA:LE:64:default",
@@ -125,7 +125,7 @@ def test_invalid_loader(shared_datadir: Path):
def test_invalid_loader_type(shared_datadir: Path):
strings_exe = shared_datadir / EXE_NAME
with pytest.raises(TypeError):
- with pyhidra.open_program(
+ with pyghidra.open_program(
strings_exe,
analyze=False,
language="DATA:LE:64:default",
@@ -136,7 +136,7 @@ def test_invalid_loader_type(shared_datadir: Path):
def test_no_project(capsys, shared_datadir: Path):
- pyhidra.run_script(None, shared_datadir / "projectless_script.py")
+ pyghidra.run_script(None, shared_datadir / "projectless_script.py")
captured = capsys.readouterr()
assert captured.out.rstrip() == "projectless_script executed successfully"
@@ -145,14 +145,14 @@ def test_no_program(capsys, shared_datadir: Path):
script_path = shared_datadir / "programless_script.py"
project_path = shared_datadir / "programless_ghidra"
- pyhidra.run_script(None, script_path, project_path, "programless")
+ pyghidra.run_script(None, script_path, project_path, "programless")
captured = capsys.readouterr()
assert captured.out.rstrip() == "programless_script executed successfully"
def test_import_script(capsys, shared_datadir: Path):
script_path = shared_datadir / "import_test_script.py"
- pyhidra.run_script(None, script_path)
+ pyghidra.run_script(None, script_path)
captured = capsys.readouterr()
assert captured.out.rstrip() == "imported successfully"
@@ -176,16 +176,16 @@ def test_import_ghidra_base_java_packages():
def wrap_mod(mod):
return mod + '_'
- launcher = pyhidra.start()
+ launcher = pyghidra.start()
- # Test to ensure _PyhidraImportLoader is last loader
- assert isinstance(sys.meta_path[-1], pyhidra.launcher._PyhidraImportLoader)
+ # Test to ensure _PyGhidraImportLoader is last loader
+ assert isinstance(sys.meta_path[-1], pyghidra.launcher._PyGhidraImportLoader)
packages = get_runtime_top_level_java_packages(launcher)
assert len(packages) > 0
- # Test full coverage for Java base packages (_JImportLoader or _PyhidraImportLoader)
+ # Test full coverage for Java base packages (_JImportLoader or _PyGhidraImportLoader)
for mod in packages:
# check spec using standard import machinery "import mod"
spec = importlib.util.find_spec(mod)
@@ -195,13 +195,13 @@ def test_import_ghidra_base_java_packages():
assert spec is not None
assert isinstance(spec.loader, jpype.imports._JImportLoader) or isinstance(
- spec.loader, pyhidra.launcher._PyhidraImportLoader)
+ spec.loader, pyghidra.launcher._PyGhidraImportLoader)
# Test all Java base packages are available with '_'
for mod in packages:
spec_ = importlib.util.find_spec(wrap_mod(mod))
assert spec_ is not None
- assert isinstance(spec_.loader, pyhidra.launcher._PyhidraImportLoader)
+ assert isinstance(spec_.loader, pyghidra.launcher._PyGhidraImportLoader)
# Test standard import
import ghidra
@@ -209,7 +209,7 @@ def test_import_ghidra_base_java_packages():
# Test import with conflict
import pdb_
- assert isinstance(pdb_.__loader__, pyhidra.launcher._PyhidraImportLoader)
+ assert isinstance(pdb_.__loader__, pyghidra.launcher._PyGhidraImportLoader)
# Test "from" import with conflict
from pdb_ import PdbPlugin
diff --git a/Ghidra/Features/Pyhidra/src/main/py/tests/test_plugin.py b/Ghidra/Features/PyGhidra/src/main/py/tests/test_plugin.py
similarity index 83%
rename from Ghidra/Features/Pyhidra/src/main/py/tests/test_plugin.py
rename to Ghidra/Features/PyGhidra/src/main/py/tests/test_plugin.py
index c030f651c1..7d514f9b8a 100644
--- a/Ghidra/Features/Pyhidra/src/main/py/tests/test_plugin.py
+++ b/Ghidra/Features/PyGhidra/src/main/py/tests/test_plugin.py
@@ -5,7 +5,7 @@ from pathlib import Path
import typing
import jpype
-import pyhidra
+import pyghidra
import pytest
@@ -13,8 +13,8 @@ import pytest
pytestmark = pytest.mark.plugin
-SETUP_KEY = "pyhidra.setup"
-PRE_LAUNCH_KEY = "pyhidra.pre_launch"
+SETUP_KEY = "pyghidra.setup"
+PRE_LAUNCH_KEY = "pyghidra.pre_launch"
NAME_KEY = "names"
@@ -30,10 +30,10 @@ class PluginTest:
ran_setup = False
ran_prelaunch = False
- details: pyhidra.ExtensionDetails = None
+ details: pyghidra.ExtensionDetails = None
def __init_subclass__(cls) -> None:
- cls.details = pyhidra.ExtensionDetails(
+ cls.details = pyghidra.ExtensionDetails(
name=cls.__name__,
description="Test Plugin",
author=""
@@ -43,7 +43,7 @@ class PluginTest:
_prelaunch = cls.prelaunch
@functools.wraps(_setup)
- def setup(launcher: pyhidra.HeadlessPyhidraLauncher):
+ def setup(launcher: pyghidra.HeadlessPyGhidraLauncher):
_setup(launcher)
cls.ran_setup = True
@@ -62,7 +62,7 @@ class PluginTest:
@classmethod
@abc.abstractmethod
- def setup(cls, launcher: pyhidra.HeadlessPyhidraLauncher):
+ def setup(cls, launcher: pyghidra.HeadlessPyGhidraLauncher):
...
@classmethod
@@ -110,7 +110,7 @@ def with_ghidra():
"""
_monkey_patch_entry_points()
try:
- launcher = pyhidra.HeadlessPyhidraLauncher()
+ launcher = pyghidra.HeadlessPyGhidraLauncher()
launcher.start()
yield # can't yield None
finally:
@@ -128,29 +128,29 @@ def with_ghidra():
class TestValidPlugin(PluginTest):
@classmethod
- def setup(cls, launcher: pyhidra.HeadlessPyhidraLauncher):
+ def setup(cls, launcher: pyghidra.HeadlessPyGhidraLauncher):
source_path = Path(__file__).parent / "data" / "good_plugin"
launcher.install_plugin(source_path, cls.details)
@classmethod
def prelaunch(cls):
- DummyTestRecognizer = jpype.JClass("ghidra.pyhidra.test.DummyTestRecognizer")
+ DummyTestRecognizer = jpype.JClass("ghidra.pyghidra.test.DummyTestRecognizer")
DummyTestRecognizer.preLaunchInitialized = True
@classmethod
def test_extension_point(cls):
from ghidra.app.util.recognizer import Recognizer
from ghidra.util.classfinder import ClassSearcher
- DummyTestRecognizer = jpype.JClass("ghidra.pyhidra.test.DummyTestRecognizer")
+ DummyTestRecognizer = jpype.JClass("ghidra.pyghidra.test.DummyTestRecognizer")
assert DummyTestRecognizer in ClassSearcher.getClasses(Recognizer)
class TestBadPlugin(PluginTest):
- launcher: pyhidra.HeadlessPyhidraLauncher = None
+ launcher: pyghidra.HeadlessPyGhidraLauncher = None
@classmethod
- def setup(cls, launcher: pyhidra.HeadlessPyhidraLauncher):
+ def setup(cls, launcher: pyghidra.HeadlessPyGhidraLauncher):
source_path = Path(__file__).parent / "data" / "bad_plugin"
launcher.install_plugin(source_path, cls.details)
cls.launcher = launcher
diff --git a/Ghidra/Features/Pyhidra/src/test.slow/java/ghidra/pyhidra/PyhidraPluginTest.java b/Ghidra/Features/PyGhidra/src/test.slow/java/ghidra/pyghidra/PyGhidraPluginTest.java
similarity index 82%
rename from Ghidra/Features/Pyhidra/src/test.slow/java/ghidra/pyhidra/PyhidraPluginTest.java
rename to Ghidra/Features/PyGhidra/src/test.slow/java/ghidra/pyghidra/PyGhidraPluginTest.java
index 139a81cdcc..8293005781 100644
--- a/Ghidra/Features/Pyhidra/src/test.slow/java/ghidra/pyhidra/PyhidraPluginTest.java
+++ b/Ghidra/Features/PyGhidra/src/test.slow/java/ghidra/pyghidra/PyGhidraPluginTest.java
@@ -13,11 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package ghidra.pyhidra;
+package ghidra.pyghidra;
-import static org.junit.Assert.*;
-
-import org.junit.*;
+import org.junit.After;
+import org.junit.Before;
import ghidra.app.plugin.core.osgi.BundleHost;
import ghidra.app.script.GhidraScriptUtil;
@@ -28,7 +27,7 @@ import ghidra.test.TestEnv;
/**
* Tests the Python Plugin functionality.
*/
-public class PyhidraPluginTest extends AbstractGhidraHeadedIntegrationTest {
+public class PyGhidraPluginTest extends AbstractGhidraHeadedIntegrationTest {
private TestEnv env;
@@ -37,8 +36,8 @@ public class PyhidraPluginTest extends AbstractGhidraHeadedIntegrationTest {
env = new TestEnv();
PluginTool tool = env.getTool();
GhidraScriptUtil.initialize(new BundleHost(), null);
- tool.addPlugin(PyhidraPlugin.class.getName());
- env.getPlugin(PyhidraPlugin.class);
+ tool.addPlugin(PyGhidraPlugin.class.getName());
+ env.getPlugin(PyGhidraPlugin.class);
}
@After
diff --git a/Ghidra/Features/Pyhidra/src/test.slow/java/ghidra/pyhidra/PythonScriptInfoTest.java b/Ghidra/Features/PyGhidra/src/test.slow/java/ghidra/pyghidra/PythonScriptInfoTest.java
similarity index 99%
rename from Ghidra/Features/Pyhidra/src/test.slow/java/ghidra/pyhidra/PythonScriptInfoTest.java
rename to Ghidra/Features/PyGhidra/src/test.slow/java/ghidra/pyghidra/PythonScriptInfoTest.java
index d6b6608156..60494b3c5a 100644
--- a/Ghidra/Features/Pyhidra/src/test.slow/java/ghidra/pyhidra/PythonScriptInfoTest.java
+++ b/Ghidra/Features/PyGhidra/src/test.slow/java/ghidra/pyghidra/PythonScriptInfoTest.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package ghidra.pyhidra;
+package ghidra.pyghidra;
import static org.junit.Assert.*;
diff --git a/Ghidra/Features/Pyhidra/src/test/java/ghidra/pyhidra/PythonFieldExposerTest.java b/Ghidra/Features/Pyhidra/src/test/java/ghidra/pyhidra/PythonFieldExposerTest.java
deleted file mode 100644
index 7b05a33aac..0000000000
--- a/Ghidra/Features/Pyhidra/src/test/java/ghidra/pyhidra/PythonFieldExposerTest.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package ghidra.pyhidra;
-
-import org.junit.Test;
-
-import ghidra.pyhidra.PythonFieldExposer.ExposedField;
-
-import static org.junit.Assert.assertTrue;
-
-import java.util.Map;;
-
-public class PythonFieldExposerTest {
-
- @Test
- public void test() {
- Map fields = PythonFieldExposer.getProperties(PyhidraScriptProvider.PyhidraGhidraScript.class);
- assertTrue(fields.containsKey("currentProgram"));
- }
-}
diff --git a/Ghidra/Features/Pyhidra/src/test/java/ghidra/pyhidra/property/PropertyUtilsTest.java b/Ghidra/Features/Pyhidra/src/test/java/ghidra/pyhidra/property/PropertyUtilsTest.java
deleted file mode 100644
index 8349a741ef..0000000000
--- a/Ghidra/Features/Pyhidra/src/test/java/ghidra/pyhidra/property/PropertyUtilsTest.java
+++ /dev/null
@@ -1,240 +0,0 @@
-package ghidra.pyhidra.property;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Repeatable;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-import static org.junit.Assert.assertArrayEquals;
-
-@RunWith(Parameterized.class)
-public class PropertyUtilsTest {
-
- @Parameters(name = "{0}")
- public static List