diff --git a/Ghidra/Features/Python/Module.manifest b/Ghidra/Features/Jython/Module.manifest
similarity index 100%
rename from Ghidra/Features/Python/Module.manifest
rename to Ghidra/Features/Jython/Module.manifest
diff --git a/Ghidra/Features/Python/build.gradle b/Ghidra/Features/Jython/build.gradle
similarity index 87%
rename from Ghidra/Features/Python/build.gradle
rename to Ghidra/Features/Jython/build.gradle
index 32abc8a940..b832d40f24 100644
--- a/Ghidra/Features/Python/build.gradle
+++ b/Ghidra/Features/Jython/build.gradle
@@ -21,7 +21,7 @@ apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle"
apply from: "$rootProject.projectDir/gradle/javadoc.gradle"
apply plugin: 'eclipse'
-eclipse.project.name = 'Features Python'
+eclipse.project.name = 'Features Jython'
def JYTHON = "org.python:jython-standalone:2.7.3"
@@ -51,15 +51,15 @@ task jythonUnpack(type: Copy) {
destinationDir file("build/data/${JYTHON_DIR}")
}
-task pythonSrcCopy(type: Copy) {
- description "Copy python-src directory (for Feature Python)"
+task jythonSrcCopy(type: Copy) {
+ description "Copy jython-src directory (for Feature Jython)"
- from(file("python-src"))
+ from(file("jython-src"))
- destinationDir file("build/data/python-src")
+ destinationDir file("build/data/jython-src")
}
// Ensure that Jython is usable in development xx
rootProject.prepDev.dependsOn jythonUnpack
jar.dependsOn jythonUnpack
-jar.dependsOn pythonSrcCopy
+jar.dependsOn jythonSrcCopy
diff --git a/Ghidra/Features/Python/certification.manifest b/Ghidra/Features/Jython/certification.manifest
similarity index 64%
rename from Ghidra/Features/Python/certification.manifest
rename to Ghidra/Features/Jython/certification.manifest
index 716354906c..d3b4b1eb36 100644
--- a/Ghidra/Features/Python/certification.manifest
+++ b/Ghidra/Features/Jython/certification.manifest
@@ -2,7 +2,7 @@
##MODULE IP: Jython License
##MODULE IP: LGPL 2.1
Module.manifest||GHIDRA||||END|
-data/python.theme.properties||GHIDRA||||END|
+data/jython.theme.properties||GHIDRA||||END|
src/main/help/help/TOC_Source.xml||GHIDRA||||END|
-src/main/help/help/topics/Python/interpreter.html||GHIDRA||||END|
+src/main/help/help/topics/Jython/interpreter.html||GHIDRA||||END|
src/main/resources/images/python.png||GHIDRA||||END|
diff --git a/Ghidra/Features/Jython/data/jython.theme.properties b/Ghidra/Features/Jython/data/jython.theme.properties
new file mode 100644
index 0000000000..7798dfc264
--- /dev/null
+++ b/Ghidra/Features/Jython/data/jython.theme.properties
@@ -0,0 +1,21 @@
+
+[Defaults]
+
+color.fg.plugin.jython.syntax.class = color.palette.blue
+color.fg.plugin.jython.syntax.code = color.palette.darkgreen
+color.fg.plugin.jython.syntax.function = color.palette.green
+color.fg.plugin.jython.syntax.instance = color.palette.purple
+color.fg.plugin.jython.syntax.map = color.palette.steelblue
+color.fg.plugin.jython.syntax.method = color.palette.teal
+color.fg.plugin.jython.syntax.null = color.palette.red
+color.fg.plugin.jython.syntax.number = color.palette.darkgray
+color.fg.plugin.jython.syntax.package = color.palette.darkred
+color.fg.plugin.jython.syntax.sequence = color.palette.saddlebrown
+color.fg.plugin.jython.syntax.special = color.palette.darkgreen
+
+icon.plugin.jython = python.png
+
+
+
+[Dark Defaults]
+
diff --git a/Ghidra/Features/Python/ghidra_scripts/AddCommentToProgramScriptPy.py b/Ghidra/Features/Jython/ghidra_scripts/AddCommentToProgramScriptPy.py
similarity index 100%
rename from Ghidra/Features/Python/ghidra_scripts/AddCommentToProgramScriptPy.py
rename to Ghidra/Features/Jython/ghidra_scripts/AddCommentToProgramScriptPy.py
diff --git a/Ghidra/Features/Python/ghidra_scripts/AskScriptPy.py b/Ghidra/Features/Jython/ghidra_scripts/AskScriptPy.py
similarity index 100%
rename from Ghidra/Features/Python/ghidra_scripts/AskScriptPy.py
rename to Ghidra/Features/Jython/ghidra_scripts/AskScriptPy.py
diff --git a/Ghidra/Features/Python/ghidra_scripts/CallAnotherScriptForAllProgramsPy.py b/Ghidra/Features/Jython/ghidra_scripts/CallAnotherScriptForAllProgramsPy.py
similarity index 100%
rename from Ghidra/Features/Python/ghidra_scripts/CallAnotherScriptForAllProgramsPy.py
rename to Ghidra/Features/Jython/ghidra_scripts/CallAnotherScriptForAllProgramsPy.py
diff --git a/Ghidra/Features/Python/ghidra_scripts/CallAnotherScriptPy.py b/Ghidra/Features/Jython/ghidra_scripts/CallAnotherScriptPy.py
similarity index 100%
rename from Ghidra/Features/Python/ghidra_scripts/CallAnotherScriptPy.py
rename to Ghidra/Features/Jython/ghidra_scripts/CallAnotherScriptPy.py
diff --git a/Ghidra/Features/Python/ghidra_scripts/ChooseDataTypeScriptPy.py b/Ghidra/Features/Jython/ghidra_scripts/ChooseDataTypeScriptPy.py
similarity index 100%
rename from Ghidra/Features/Python/ghidra_scripts/ChooseDataTypeScriptPy.py
rename to Ghidra/Features/Jython/ghidra_scripts/ChooseDataTypeScriptPy.py
diff --git a/Ghidra/Features/Python/ghidra_scripts/ExampleColorScriptPy.py b/Ghidra/Features/Jython/ghidra_scripts/ExampleColorScriptPy.py
similarity index 100%
rename from Ghidra/Features/Python/ghidra_scripts/ExampleColorScriptPy.py
rename to Ghidra/Features/Jython/ghidra_scripts/ExampleColorScriptPy.py
diff --git a/Ghidra/Features/Python/ghidra_scripts/FormatExampleScriptPy.py b/Ghidra/Features/Jython/ghidra_scripts/FormatExampleScriptPy.py
similarity index 100%
rename from Ghidra/Features/Python/ghidra_scripts/FormatExampleScriptPy.py
rename to Ghidra/Features/Jython/ghidra_scripts/FormatExampleScriptPy.py
diff --git a/Ghidra/Features/Python/ghidra_scripts/ImportSymbolsScript.py b/Ghidra/Features/Jython/ghidra_scripts/ImportSymbolsScript.py
similarity index 100%
rename from Ghidra/Features/Python/ghidra_scripts/ImportSymbolsScript.py
rename to Ghidra/Features/Jython/ghidra_scripts/ImportSymbolsScript.py
diff --git a/Ghidra/Features/Python/ghidra_scripts/PrintNonZeroPurge.py b/Ghidra/Features/Jython/ghidra_scripts/PrintNonZeroPurge.py
similarity index 100%
rename from Ghidra/Features/Python/ghidra_scripts/PrintNonZeroPurge.py
rename to Ghidra/Features/Jython/ghidra_scripts/PrintNonZeroPurge.py
diff --git a/Ghidra/Features/Python/ghidra_scripts/ToolPropertiesExampleScriptPy.py b/Ghidra/Features/Jython/ghidra_scripts/ToolPropertiesExampleScriptPy.py
similarity index 100%
rename from Ghidra/Features/Python/ghidra_scripts/ToolPropertiesExampleScriptPy.py
rename to Ghidra/Features/Jython/ghidra_scripts/ToolPropertiesExampleScriptPy.py
diff --git a/Ghidra/Features/Python/ghidra_scripts/external_module_callee.py b/Ghidra/Features/Jython/ghidra_scripts/external_module_callee.py
similarity index 100%
rename from Ghidra/Features/Python/ghidra_scripts/external_module_callee.py
rename to Ghidra/Features/Jython/ghidra_scripts/external_module_callee.py
diff --git a/Ghidra/Features/Python/ghidra_scripts/external_module_caller.py b/Ghidra/Features/Jython/ghidra_scripts/external_module_caller.py
similarity index 100%
rename from Ghidra/Features/Python/ghidra_scripts/external_module_caller.py
rename to Ghidra/Features/Jython/ghidra_scripts/external_module_caller.py
diff --git a/Ghidra/Features/Python/ghidra_scripts/ghidra_basics.py b/Ghidra/Features/Jython/ghidra_scripts/ghidra_basics.py
similarity index 100%
rename from Ghidra/Features/Python/ghidra_scripts/ghidra_basics.py
rename to Ghidra/Features/Jython/ghidra_scripts/ghidra_basics.py
diff --git a/Ghidra/Features/Python/ghidra_scripts/jython_basics.py b/Ghidra/Features/Jython/ghidra_scripts/jython_basics.py
similarity index 100%
rename from Ghidra/Features/Python/ghidra_scripts/jython_basics.py
rename to Ghidra/Features/Jython/ghidra_scripts/jython_basics.py
diff --git a/Ghidra/Features/Python/ghidra_scripts/python_basics.py b/Ghidra/Features/Jython/ghidra_scripts/python_basics.py
similarity index 100%
rename from Ghidra/Features/Python/ghidra_scripts/python_basics.py
rename to Ghidra/Features/Jython/ghidra_scripts/python_basics.py
diff --git a/Ghidra/Features/Python/python-src/ghidradoc.py b/Ghidra/Features/Jython/jython-src/ghidradoc.py
similarity index 100%
rename from Ghidra/Features/Python/python-src/ghidradoc.py
rename to Ghidra/Features/Jython/jython-src/ghidradoc.py
diff --git a/Ghidra/Features/Python/python-src/introspect.py b/Ghidra/Features/Jython/jython-src/introspect.py
similarity index 99%
rename from Ghidra/Features/Python/python-src/introspect.py
rename to Ghidra/Features/Jython/jython-src/introspect.py
index aeb4ae2f30..97096f78ec 100644
--- a/Ghidra/Features/Python/python-src/introspect.py
+++ b/Ghidra/Features/Jython/jython-src/introspect.py
@@ -16,7 +16,7 @@ import sys
import tokenize
import types
import __main__
-from ghidra.python import PythonCodeCompletionFactory
+from ghidra.jython import JythonCodeCompletionFactory
import java # needed for java.lang.Class
try:
@@ -72,7 +72,7 @@ def getAutoCompleteList(command='', locals=None, includeMagic=1,
pyObj = getattr(object, attribute)
else:
pyObj = locals[attribute]
- completion_list.append(PythonCodeCompletionFactory.
+ completion_list.append(JythonCodeCompletionFactory.
newCodeCompletion(attribute,
attribute,
pyObj,
diff --git a/Ghidra/Features/Python/python-src/jintrospect.py b/Ghidra/Features/Jython/jython-src/jintrospect.py
similarity index 99%
rename from Ghidra/Features/Python/python-src/jintrospect.py
rename to Ghidra/Features/Jython/jython-src/jintrospect.py
index 8501e31d4d..9ef61dca20 100644
--- a/Ghidra/Features/Python/python-src/jintrospect.py
+++ b/Ghidra/Features/Jython/jython-src/jintrospect.py
@@ -8,7 +8,7 @@ import string
import __builtin__
import java # needed for java.lang.Class
import org # for org.python.core
-import ghidra # for PythonCodeCompletionFactory
+import ghidra # for JythonCodeCompletionFactory
__author__ = "Don Coleman
- The Ghidra Python Interpreter provides a full general-purpose Python interactive shell
+ The Ghidra Jython Interpreter provides a full general-purpose Jython interactive shell
and allows you to interact with your current Ghidra session by exposing Ghidra's powerful Java
API through the magic of Jython.
- The Ghidra Python Interpreter is configured to run in a similar context as a Ghidra
+ The Ghidra Jython 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 Jython allows you to interact with
@@ -48,7 +48,7 @@
hierarchy, so nothing has to be explicitly imported before they can be used. However, because
the DataTypeSelectionDialog class and AllowedDataType enum reside in
different packages, they must be explicitly imported. Failure to do so will result in a
- Python NameError.
+ Jython NameError.
- The Ghidra Python Interpreter supports the following hard-coded keybindings:
+ The Ghidra Jython Interpreter supports the following hard-coded keybindings:
- Copy and paste from within the Ghidra Python Interpreter should work as expected for
+ Copy and paste from within the Ghidra Jython Interpreter should work as expected for
your given environment:
- The built-in help() Python function has been altered by the Ghidra Python Interpreter
+ The built-in help() Jython function has been altered by the Ghidra Jython 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:
Python Interpreter
+ Jython Interpreter
Environment
@@ -78,7 +78,7 @@
Keybindings
Copy/Paste
API Documentation
@@ -147,7 +147,7 @@
Note: It may be necessary to import a Ghidra class before calling the built-in help() - Python function on it. Failure to do so will result in a Python NameError. + Jython function on it. Failure to do so will result in a Jython NameError.
@@ -160,7 +160,7 @@ -Provided by: PythonPlugin
+Provided by: JythonPlugin
@@ -181,7 +181,7 @@ public class PythonPlugin extends ProgramPlugin
*/
private void resetInterpreter() {
- TaskLauncher.launchModal("Resetting Python...", () -> {
+ TaskLauncher.launchModal("Resetting Jython...", () -> {
resetInterpreterInBackground();
});
}
@@ -193,23 +193,23 @@ public class PythonPlugin extends ProgramPlugin
if (interpreter == null) {
// Setup options
- ToolOptions options = tool.getOptions("Python");
+ ToolOptions options = tool.getOptions("Jython");
includeBuiltins = options.getBoolean(INCLUDE_BUILTINS_LABEL, INCLUDE_BUILTINS_DEFAULT);
options.registerOption(INCLUDE_BUILTINS_LABEL, INCLUDE_BUILTINS_DEFAULT, null,
INCLUDE_BUILTINS_DESCRIPTION);
options.addOptionsChangeListener(this);
- interpreter = GhidraPythonInterpreter.get();
+ interpreter = GhidraJythonInterpreter.get();
// Setup code completion. This currently has to be done after the interpreter
// is created. Otherwise an exception will occur.
- PythonCodeCompletionFactory.setupOptions(this, options);
+ JythonCodeCompletionFactory.setupOptions(this, options);
}
else {
inputThread.shutdown();
inputThread = null;
interpreter.cleanup();
- interpreter = GhidraPythonInterpreter.get();
+ interpreter = GhidraJythonInterpreter.get();
}
// Reset the console.
@@ -224,20 +224,20 @@ public class PythonPlugin extends ProgramPlugin
// Print a welcome message.
welcome();
- // Setup the PythonScript describing the state of the interactive prompt.
+ // Setup the JythonScript describing the state of the interactive prompt.
// This allows things like currentProgram and currentAddress to dynamically reflect
// what's happening in the listing. Injecting the script hierarchy early here allows
// code completion to work before commands are entered.
- interactiveScript = new PythonScript();
+ interactiveScript = new JythonScript();
interactiveScript.set(
new GhidraState(tool, tool.getProject(), getCurrentProgram(), getProgramLocation(),
getProgramSelection(), getProgramHighlight()),
interactiveTaskMonitor, new PrintWriter(getConsole().getStdOut()));
interpreter.injectScriptHierarchy(interactiveScript);
- interactiveTaskMonitor = new PythonInteractiveTaskMonitor(console.getStdOut());
+ interactiveTaskMonitor = new JythonInteractiveTaskMonitor(console.getStdOut());
- // Start the input thread that receives python commands to execute.
- inputThread = new PythonPluginInputThread(this);
+ // Start the input thread that receives jython commands to execute.
+ inputThread = new JythonPluginInputThread(this);
inputThread.start();
}
@@ -252,11 +252,11 @@ public class PythonPlugin extends ProgramPlugin
@Override
public void optionsChanged(ToolOptions options, String optionName, Object oldValue,
Object newValue) {
- if (optionName.startsWith(PythonCodeCompletionFactory.COMPLETION_LABEL)) {
- PythonCodeCompletionFactory.changeOptions(options, optionName, oldValue, newValue);
+ if (optionName.startsWith(JythonCodeCompletionFactory.COMPLETION_LABEL)) {
+ JythonCodeCompletionFactory.changeOptions(options, optionName, oldValue, newValue);
}
- else if (optionName.equals(PythonCodeCompletionFactory.INCLUDE_TYPES_LABEL)) {
- PythonCodeCompletionFactory.changeOptions(options, optionName, oldValue, newValue);
+ else if (optionName.equals(JythonCodeCompletionFactory.INCLUDE_TYPES_LABEL)) {
+ JythonCodeCompletionFactory.changeOptions(options, optionName, oldValue, newValue);
}
else if (optionName.equals(INCLUDE_BUILTINS_LABEL)) {
includeBuiltins = ((Boolean) newValue).booleanValue();
@@ -284,7 +284,7 @@ public class PythonPlugin extends ProgramPlugin
@Override
public List
- * In Python this is a triple single quote sequence, "'''".
+ * In Jython this is a triple single quote sequence, "'''".
*
- * @return the Pattern for Python block comment openings
+ * @return the Pattern for Jython block comment openings
*/
@Override
public Pattern getBlockCommentStart() {
@@ -52,9 +52,9 @@ public class PythonScriptProvider extends GhidraScriptProvider {
* {@inheritDoc}
*
*
- * In Python this is a triple single quote sequence, "'''".
+ * In Jython this is a triple single quote sequence, "'''".
*
- * @return the Pattern for Python block comment openings
+ * @return the Pattern for Jython block comment openings
*/
@Override
public Pattern getBlockCommentEnd() {
@@ -83,7 +83,7 @@ public class PythonScriptProvider extends GhidraScriptProvider {
@Override
public String getDescription() {
- return "Python";
+ return "Jython";
}
@Override
@@ -96,7 +96,7 @@ public class PythonScriptProvider extends GhidraScriptProvider {
throws GhidraScriptLoadException {
try {
- Class> clazz = Class.forName(PythonScript.class.getName());
+ Class> clazz = Class.forName(JythonScript.class.getName());
GhidraScript script = (GhidraScript) clazz.getConstructor().newInstance();
script.setSourceFile(sourceFile);
return script;
diff --git a/Ghidra/Features/Python/src/main/java/ghidra/python/PythonUtils.java b/Ghidra/Features/Jython/src/main/java/ghidra/jython/JythonUtils.java
similarity index 53%
rename from Ghidra/Features/Python/src/main/java/ghidra/python/PythonUtils.java
rename to Ghidra/Features/Jython/src/main/java/ghidra/jython/JythonUtils.java
index 60bb81b762..32ab1e7998 100644
--- a/Ghidra/Features/Python/src/main/java/ghidra/python/PythonUtils.java
+++ b/Ghidra/Features/Jython/src/main/java/ghidra/jython/JythonUtils.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package ghidra.python;
+package ghidra.jython;
import java.io.*;
@@ -25,83 +25,83 @@ import utilities.util.FileUtilities;
/**
* Python utility method class.
*/
-public class PythonUtils {
+public class JythonUtils {
- public static final String PYTHON_NAME = "jython-2.7.3";
- public static final String PYTHON_CACHEDIR = "jython_cachedir";
- public static final String PYTHON_SRC = "python-src";
+ public static final String JYTHON_NAME = "jython-2.7.3";
+ public static final String JYTHON_CACHEDIR = "jython_cachedir";
+ public static final String JYTHON_SRC = "jython-src";
/**
- * Sets up the python home directory. This is the directory that has the "Lib" directory in it.
+ * Sets up the jython home directory. This is the directory that has the "Lib" directory in it.
*
- * @return The python home directory.
+ * @return The jython home directory.
* @throws IOException If there was a disk-related problem setting up the home directory.
*/
- public static File setupPythonHomeDir() throws IOException {
+ public static File setupJythonHomeDir() throws IOException {
- File pythonModuleDir = Application.getMyModuleRootDirectory().getFile(false);
- File pythonHomeDir =
- Application.getModuleDataSubDirectory(pythonModuleDir.getName(), PYTHON_NAME).getFile(
- false);
+ File jythonModuleDir = Application.getMyModuleRootDirectory().getFile(false);
+ File jythonHomeDir =
+ Application.getModuleDataSubDirectory(jythonModuleDir.getName(), JYTHON_NAME)
+ .getFile(false);
- if (!pythonHomeDir.exists()) {
- throw new IOException("Failed to find the python home directory at: " + pythonHomeDir);
+ if (!jythonHomeDir.exists()) {
+ throw new IOException("Failed to find the jython home directory at: " + jythonHomeDir);
}
- System.setProperty("python.home", pythonHomeDir.getAbsolutePath());
+ System.setProperty("jython.home", jythonHomeDir.getAbsolutePath());
- return pythonHomeDir;
+ return jythonHomeDir;
}
/**
- * Sets up the python cache directory. This is a temporary space that python source files
+ * Sets up the jython cache directory. This is a temporary space that jython source files
* get compiled to and cached. It should NOT be in the Ghidra installation directory, because
* some installations will not have the appropriate directory permissions to create new files in.
*
* @param monitor A monitor to use during the cache directory setup.
- * @return The python cache directory.
+ * @return The jython cache directory.
* @throws IOException If there was a disk-related problem setting up the cache directory.
* @throws CancelledException If the user cancelled the setup.
*/
- public static File setupPythonCacheDir(TaskMonitor monitor)
+ public static File setupJythonCacheDir(TaskMonitor monitor)
throws CancelledException, IOException {
File devDir = new File(Application.getUserSettingsDirectory(), "dev");
- File cacheDir = new File(devDir, PYTHON_CACHEDIR);
+ File cacheDir = new File(devDir, JYTHON_CACHEDIR);
if (!FileUtilities.mkdirs(cacheDir)) {
- throw new IOException("Failed to create the python cache directory at: " + cacheDir);
+ throw new IOException("Failed to create the jython cache directory at: " + cacheDir);
}
- File pythonSrcDestDir = new File(cacheDir, PYTHON_SRC);
- if (!FileUtilities.createDir(pythonSrcDestDir)) {
+ File jythonSrcDestDir = new File(cacheDir, JYTHON_SRC);
+ if (!FileUtilities.createDir(jythonSrcDestDir)) {
throw new IOException(
- "Failed to create the " + PYTHON_SRC + " directory at: " + pythonSrcDestDir);
+ "Failed to create the " + JYTHON_SRC + " directory at: " + jythonSrcDestDir);
}
- File pythonModuleDir = Application.getMyModuleRootDirectory().getFile(false);
- File pythonSrcDir = new File(pythonModuleDir, PYTHON_SRC);
- if (!pythonSrcDir.exists()) {
+ File jythonModuleDir = Application.getMyModuleRootDirectory().getFile(false);
+ File jythonSrcDir = new File(jythonModuleDir, JYTHON_SRC);
+ if (!jythonSrcDir.exists()) {
try {
- pythonSrcDir = Application.getModuleDataSubDirectory(pythonModuleDir.getName(),
- PYTHON_SRC).getFile(false);
+ jythonSrcDir = Application.getModuleDataSubDirectory(jythonModuleDir.getName(),
+ JYTHON_SRC).getFile(false);
}
catch (FileNotFoundException e) {
- throw new IOException("Failed to find the module's " + PYTHON_SRC + " directory");
+ throw new IOException("Failed to find the module's " + JYTHON_SRC + " directory");
}
}
try {
- FileUtilities.copyDir(pythonSrcDir, pythonSrcDestDir, f -> f.getName().endsWith(".py"),
+ FileUtilities.copyDir(jythonSrcDir, jythonSrcDestDir, f -> f.getName().endsWith(".py"),
monitor);
}
catch (IOException e) {
throw new IOException(
- "Failed to copy " + PYTHON_SRC + " files to: " + pythonSrcDestDir);
+ "Failed to copy " + JYTHON_SRC + " files to: " + jythonSrcDestDir);
}
System.setProperty("python.cachedir.skip", "false");
System.setProperty("python.cachedir", cacheDir.getAbsolutePath());
- System.setProperty("python.path", pythonSrcDestDir.getAbsolutePath());
+ System.setProperty("python.path", jythonSrcDestDir.getAbsolutePath());
return cacheDir;
}
diff --git a/Ghidra/Features/Python/src/main/java/ghidra/python/PyDevUtils.java b/Ghidra/Features/Jython/src/main/java/ghidra/jython/PyDevUtils.java
similarity index 97%
rename from Ghidra/Features/Python/src/main/java/ghidra/python/PyDevUtils.java
rename to Ghidra/Features/Jython/src/main/java/ghidra/jython/PyDevUtils.java
index ef87a4ed4e..5843e6c2ec 100644
--- a/Ghidra/Features/Python/src/main/java/ghidra/python/PyDevUtils.java
+++ b/Ghidra/Features/Jython/src/main/java/ghidra/jython/PyDevUtils.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package ghidra.python;
+package ghidra.jython;
import java.io.File;
diff --git a/Ghidra/Features/Python/src/main/resources/images/python.png b/Ghidra/Features/Jython/src/main/resources/images/python.png
similarity index 100%
rename from Ghidra/Features/Python/src/main/resources/images/python.png
rename to Ghidra/Features/Jython/src/main/resources/images/python.png
diff --git a/Ghidra/Features/Python/src/test.slow/java/ghidra/python/PythonCodeCompletionTest.java b/Ghidra/Features/Jython/src/test.slow/java/ghidra/jython/JythonCodeCompletionTest.java
similarity index 95%
rename from Ghidra/Features/Python/src/test.slow/java/ghidra/python/PythonCodeCompletionTest.java
rename to Ghidra/Features/Jython/src/test.slow/java/ghidra/jython/JythonCodeCompletionTest.java
index 7e155cd7f1..5cab08353b 100644
--- a/Ghidra/Features/Python/src/test.slow/java/ghidra/python/PythonCodeCompletionTest.java
+++ b/Ghidra/Features/Jython/src/test.slow/java/ghidra/jython/JythonCodeCompletionTest.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package ghidra.python;
+package ghidra.jython;
import static org.junit.Assert.*;
@@ -36,7 +36,7 @@ import ghidra.test.AbstractGhidraHeadedIntegrationTest;
/**
* Tests for the Ghidra Python Interpreter's code completion functionality.
*/
-public class PythonCodeCompletionTest extends AbstractGhidraHeadedIntegrationTest {
+public class JythonCodeCompletionTest extends AbstractGhidraHeadedIntegrationTest {
private String simpleTestProgram = """
my_int = 32
@@ -68,13 +68,13 @@ public class PythonCodeCompletionTest extends AbstractGhidraHeadedIntegrationTes
@Rule
public TemporaryFolder tempScriptFolder = new TemporaryFolder();
- private GhidraPythonInterpreter interpreter;
+ private GhidraJythonInterpreter interpreter;
@Before
public void setUp() throws Exception {
GhidraScriptUtil.initialize(new BundleHost(), null);
- interpreter = GhidraPythonInterpreter.get();
- executePythonProgram(simpleTestProgram);
+ interpreter = GhidraJythonInterpreter.get();
+ executeJythonProgram(simpleTestProgram);
}
@After
@@ -160,7 +160,7 @@ public class PythonCodeCompletionTest extends AbstractGhidraHeadedIntegrationTes
return interpreter.getCommandCompletions(command, false, caretPos);
}
- private void executePythonProgram(String code) {
+ private void executeJythonProgram(String code) {
try {
File tempFile = tempScriptFolder.newFile();
FileUtils.writeStringToFile(tempFile, code, Charset.defaultCharset());
diff --git a/Ghidra/Features/Python/src/test.slow/java/ghidra/python/PythonInterpreterTest.java b/Ghidra/Features/Jython/src/test.slow/java/ghidra/jython/JythonInterpreterTest.java
similarity index 87%
rename from Ghidra/Features/Python/src/test.slow/java/ghidra/python/PythonInterpreterTest.java
rename to Ghidra/Features/Jython/src/test.slow/java/ghidra/jython/JythonInterpreterTest.java
index 2e7e1bff47..385465f073 100644
--- a/Ghidra/Features/Python/src/test.slow/java/ghidra/python/PythonInterpreterTest.java
+++ b/Ghidra/Features/Jython/src/test.slow/java/ghidra/jython/JythonInterpreterTest.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package ghidra.python;
+package ghidra.jython;
import static org.junit.Assert.*;
@@ -29,16 +29,16 @@ import ghidra.test.AbstractGhidraHeadedIntegrationTest;
/**
* Tests the Ghidra python interpreter's functionality.
*/
-public class PythonInterpreterTest extends AbstractGhidraHeadedIntegrationTest {
+public class JythonInterpreterTest extends AbstractGhidraHeadedIntegrationTest {
private ByteArrayOutputStream out;
- private GhidraPythonInterpreter interpreter;
+ private GhidraJythonInterpreter interpreter;
@Before
public void setUp() throws Exception {
out = new ByteArrayOutputStream();
GhidraScriptUtil.initialize(new BundleHost(), null);
- interpreter = GhidraPythonInterpreter.get();
+ interpreter = GhidraJythonInterpreter.get();
interpreter.setOut(out);
interpreter.setErr(out);
}
@@ -54,7 +54,7 @@ public class PythonInterpreterTest extends AbstractGhidraHeadedIntegrationTest {
* Tests that the interpreter's "push" method is working by executing a simple line of python.
*/
@Test
- public void testPythonPush() {
+ public void testJythonPush() {
final String str = "hi";
interpreter.push("print \"" + str + "\"", null);
assertEquals(out.toString().trim(), str);
@@ -64,7 +64,7 @@ public class PythonInterpreterTest extends AbstractGhidraHeadedIntegrationTest {
* Tests that the interpreter's "execFile" method is working by executing a simple file of python.
*/
@Test
- public void testPythonExecFile() {
+ public void testJythonExecFile() {
interpreter.execFile(new ResourceFile("ghidra_scripts/python_basics.py"), null);
assertTrue(out.toString().contains("Snoopy"));
}
@@ -74,7 +74,7 @@ public class PythonInterpreterTest extends AbstractGhidraHeadedIntegrationTest {
* that we install from there.
*/
@Test
- public void testPythonSiteCustomize() {
+ public void testJythonSiteCustomize() {
interpreter.push("help", null);
assertTrue(out.toString().contains("Press 'F1'"));
}
@@ -83,7 +83,7 @@ public class PythonInterpreterTest extends AbstractGhidraHeadedIntegrationTest {
* Tests that cleaning the interpreter invalidates it.
*/
@Test
- public void testPythonCleanupInvalidation() {
+ public void testJythonCleanupInvalidation() {
interpreter.cleanup();
try {
diff --git a/Ghidra/Features/Python/src/test.slow/java/ghidra/python/PythonPluginTest.java b/Ghidra/Features/Jython/src/test.slow/java/ghidra/jython/JythonPluginTest.java
similarity index 78%
rename from Ghidra/Features/Python/src/test.slow/java/ghidra/python/PythonPluginTest.java
rename to Ghidra/Features/Jython/src/test.slow/java/ghidra/jython/JythonPluginTest.java
index c4e5544b6f..dc8c72be10 100644
--- a/Ghidra/Features/Python/src/test.slow/java/ghidra/python/PythonPluginTest.java
+++ b/Ghidra/Features/Jython/src/test.slow/java/ghidra/jython/JythonPluginTest.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package ghidra.python;
+package ghidra.jython;
import static org.junit.Assert.*;
@@ -28,19 +28,19 @@ import ghidra.test.TestEnv;
/**
* Tests the Python Plugin functionality.
*/
-public class PythonPluginTest extends AbstractGhidraHeadedIntegrationTest {
+public class JythonPluginTest extends AbstractGhidraHeadedIntegrationTest {
private TestEnv env;
private PluginTool tool;
- private PythonPlugin plugin;
+ private JythonPlugin plugin;
@Before
public void setUp() throws Exception {
env = new TestEnv();
tool = env.getTool();
GhidraScriptUtil.initialize(new BundleHost(), null);
- tool.addPlugin(PythonPlugin.class.getName());
- plugin = env.getPlugin(PythonPlugin.class);
+ tool.addPlugin(JythonPlugin.class.getName());
+ plugin = env.getPlugin(JythonPlugin.class);
}
@After
@@ -53,10 +53,10 @@ public class PythonPluginTest extends AbstractGhidraHeadedIntegrationTest {
* Tests that issuing a reset from the plugin resets the interpreter.
*/
@Test
- public void testPythonPluginReset() {
- GhidraPythonInterpreter origInterpreter = plugin.getInterpreter();
+ public void testJythonPluginReset() {
+ GhidraJythonInterpreter origInterpreter = plugin.getInterpreter();
plugin.reset();
- GhidraPythonInterpreter newInterpreter = plugin.getInterpreter();
+ GhidraJythonInterpreter newInterpreter = plugin.getInterpreter();
assertNotSame(origInterpreter, newInterpreter);
}
}
diff --git a/Ghidra/Features/Python/src/test.slow/java/ghidra/python/PythonScriptInfoTest.java b/Ghidra/Features/Jython/src/test.slow/java/ghidra/jython/JythonScriptInfoTest.java
similarity index 95%
rename from Ghidra/Features/Python/src/test.slow/java/ghidra/python/PythonScriptInfoTest.java
rename to Ghidra/Features/Jython/src/test.slow/java/ghidra/jython/JythonScriptInfoTest.java
index ca16891de0..ec3094d913 100644
--- a/Ghidra/Features/Python/src/test.slow/java/ghidra/python/PythonScriptInfoTest.java
+++ b/Ghidra/Features/Jython/src/test.slow/java/ghidra/jython/JythonScriptInfoTest.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package ghidra.python;
+package ghidra.jython;
import static org.junit.Assert.*;
@@ -31,7 +31,7 @@ import ghidra.app.script.GhidraScriptUtil;
import ghidra.app.script.ScriptInfo;
import ghidra.test.AbstractGhidraHeadedIntegrationTest;
-public class PythonScriptInfoTest extends AbstractGhidraHeadedIntegrationTest {
+public class JythonScriptInfoTest extends AbstractGhidraHeadedIntegrationTest {
@Before
public void setUp() throws Exception {
@@ -48,7 +48,7 @@ public class PythonScriptInfoTest extends AbstractGhidraHeadedIntegrationTest {
}
@Test
- public void testDetailedPythonScript() {
+ public void testDetailedJythonScript() {
String descLine1 = "This script exists to check that the info on";
String descLine2 = "a script that has extensive documentation is";
String descLine3 = "properly parsed and represented.";
@@ -99,7 +99,7 @@ public class PythonScriptInfoTest extends AbstractGhidraHeadedIntegrationTest {
}
@Test
- public void testPythonScriptWithBlockComment() {
+ public void testJythonScriptWithBlockComment() {
String description = "Script with a block comment at the top.";
String category = "Test";
ResourceFile scriptFile = null;
@@ -129,7 +129,7 @@ public class PythonScriptInfoTest extends AbstractGhidraHeadedIntegrationTest {
}
@Test
- public void testPythonScriptWithBlockCommentAndCertifyHeader() {
+ public void testJythonScriptWithBlockCommentAndCertifyHeader() {
String description = "Script with a block comment at the top.";
String category = "Test";
ResourceFile scriptFile = null;
@@ -168,7 +168,7 @@ public class PythonScriptInfoTest extends AbstractGhidraHeadedIntegrationTest {
}
@Test
- public void testPythonScriptWithoutBlockComment() {
+ public void testJythonScriptWithoutBlockComment() {
String description = "Script without a block comment at the top.";
String category = "Test";
ResourceFile scriptFile = null;
@@ -194,7 +194,7 @@ public class PythonScriptInfoTest extends AbstractGhidraHeadedIntegrationTest {
}
@Test
- public void testPythonScriptWithSingleLineBlockComment() {
+ public void testJythonScriptWithSingleLineBlockComment() {
String description = "Script with a block comment at the top.";
String category = "Test";
ResourceFile scriptFile = null;
diff --git a/Ghidra/Features/Python/src/test.slow/java/ghidra/python/PythonScriptTest.java b/Ghidra/Features/Jython/src/test.slow/java/ghidra/jython/JythonScriptTest.java
similarity index 84%
rename from Ghidra/Features/Python/src/test.slow/java/ghidra/python/PythonScriptTest.java
rename to Ghidra/Features/Jython/src/test.slow/java/ghidra/jython/JythonScriptTest.java
index e5b1e5554a..9287776f64 100644
--- a/Ghidra/Features/Python/src/test.slow/java/ghidra/python/PythonScriptTest.java
+++ b/Ghidra/Features/Jython/src/test.slow/java/ghidra/jython/JythonScriptTest.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package ghidra.python;
+package ghidra.jython;
import static org.junit.Assert.*;
@@ -37,7 +37,7 @@ import ghidra.util.task.TaskMonitor;
/**
* Tests the Python script functionality.
*/
-public class PythonScriptTest extends AbstractGhidraHeadedIntegrationTest {
+public class JythonScriptTest extends AbstractGhidraHeadedIntegrationTest {
private TestEnv env;
private PluginTool tool;
@@ -59,19 +59,19 @@ public class PythonScriptTest extends AbstractGhidraHeadedIntegrationTest {
}
/**
- * Tests that Python scripts are running correctly.
+ * Tests that Jython scripts are running correctly.
*
* @throws Exception If an exception occurred while trying to run the script.
*/
@Test
- public void testPythonScript() throws Exception {
+ public void testJythonScript() throws Exception {
String script = "ghidra_scripts/python_basics.py";
try {
- String output = runPythonScript(Application.getModuleFile("Python", script));
+ String output = runPythonScript(Application.getModuleFile("Jython", script));
assertTrue(output.contains("Snoopy"));
}
catch (FileNotFoundException e) {
- fail("Could not find python script: " + script);
+ fail("Could not find jython script: " + script);
}
catch (Exception e) {
fail("Exception occurred trying to run script: " + e.getMessage());
@@ -79,18 +79,18 @@ public class PythonScriptTest extends AbstractGhidraHeadedIntegrationTest {
}
/**
- * Tests that Python scripts are running correctly.
+ * Tests that Jython scripts are running correctly.
*
* @throws Exception If an exception occurred while trying to run the script.
*/
@Test
- public void testPythonInterpreterGoneFromState() throws Exception {
+ public void testJythonInterpreterGoneFromState() throws Exception {
String script = "ghidra_scripts/python_basics.py";
try {
GhidraState state =
new GhidraState(env.getTool(), env.getProject(), null, null, null, null);
- runPythonScript(Application.getModuleFile("Python", script), state);
- assertTrue(state.getEnvironmentVar(PythonScript.PYTHON_INTERPRETER) == null);
+ runPythonScript(Application.getModuleFile("Jython", script), state);
+ assertTrue(state.getEnvironmentVar(JythonScript.JYTHON_INTERPRETER) == null);
}
catch (FileNotFoundException e) {
fail("Could not find python script: " + script);
@@ -125,9 +125,9 @@ public class PythonScriptTest extends AbstractGhidraHeadedIntegrationTest {
runSwing(() -> console.clearMessages());
- PythonScriptProvider scriptProvider = new PythonScriptProvider();
+ JythonScriptProvider scriptProvider = new JythonScriptProvider();
PrintWriter writer = new PrintWriter(new ByteArrayOutputStream());
- PythonScript script = (PythonScript) scriptProvider.getScriptInstance(scriptFile, writer);
+ JythonScript script = (JythonScript) scriptProvider.getScriptInstance(scriptFile, writer);
script.set(state, TaskMonitor.DUMMY, writer);
script.run();
diff --git a/Ghidra/Features/Python/data/python.theme.properties b/Ghidra/Features/Python/data/python.theme.properties
deleted file mode 100644
index 3400dc379c..0000000000
--- a/Ghidra/Features/Python/data/python.theme.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-
-[Defaults]
-
-color.fg.plugin.python.syntax.class = color.palette.blue
-color.fg.plugin.python.syntax.code = color.palette.darkgreen
-color.fg.plugin.python.syntax.function = color.palette.green
-color.fg.plugin.python.syntax.instance = color.palette.purple
-color.fg.plugin.python.syntax.map = color.palette.steelblue
-color.fg.plugin.python.syntax.method = color.palette.teal
-color.fg.plugin.python.syntax.null = color.palette.red
-color.fg.plugin.python.syntax.number = color.palette.darkgray
-color.fg.plugin.python.syntax.package = color.palette.darkred
-color.fg.plugin.python.syntax.sequence = color.palette.saddlebrown
-color.fg.plugin.python.syntax.special = color.palette.darkgreen
-
-icon.plugin.python = python.png
-
-
-
-[Dark Defaults]
-
diff --git a/Ghidra/RuntimeScripts/Linux/support/pythonRun b/Ghidra/RuntimeScripts/Linux/support/pythonRun
index 53d157bbe2..fdb0bc7a17 100755
--- a/Ghidra/RuntimeScripts/Linux/support/pythonRun
+++ b/Ghidra/RuntimeScripts/Linux/support/pythonRun
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
#----------------------------------------
-# Ghidra Python launch
+# Ghidra Jython launch
#----------------------------------------
# Maximum heap memory may be changed if default is inadequate. This will generally be up to 1/4 of
@@ -31,6 +31,6 @@ VMARG_LIST+="-Djava.awt.headless=true "
SCRIPT_FILE="$(readlink -f "$0" 2>/dev/null || readlink "$0" 2>/dev/null || echo "$0")"
SCRIPT_DIR="${SCRIPT_FILE%/*}"
-# Launch Ghidra Python
+# Launch Ghidra Jython
# DEBUG_ADDRESS set via environment for launch.sh
-DEBUG_ADDRESS=${DEBUG_ADDRESS} "${SCRIPT_DIR}"/launch.sh "${LAUNCH_MODE}" jdk "Ghidra-Python" "${MAXMEM}" "${VMARG_LIST}" ghidra.python.PythonRun "$@"
+DEBUG_ADDRESS=${DEBUG_ADDRESS} "${SCRIPT_DIR}"/launch.sh "${LAUNCH_MODE}" jdk "Ghidra-Jython" "${MAXMEM}" "${VMARG_LIST}" ghidra.jython.JythonRun "$@"
diff --git a/Ghidra/RuntimeScripts/Windows/support/pythonRun.bat b/Ghidra/RuntimeScripts/Windows/support/pythonRun.bat
index b0ab27b039..8782f9cec7 100644
--- a/Ghidra/RuntimeScripts/Windows/support/pythonRun.bat
+++ b/Ghidra/RuntimeScripts/Windows/support/pythonRun.bat
@@ -1,4 +1,4 @@
-:: Ghidra python launch
+:: Ghidra jython launch
@echo off
setlocal
@@ -24,4 +24,4 @@ set DEBUG_ADDRESS=127.0.0.1:13002
set VMARG_LIST=-XX:ParallelGCThreads=2
set VMARG_LIST=%VMARG_LIST% -XX:CICompilerCount=2
-call "%~dp0launch.bat" %LAUNCH_MODE% jdk Ghidra-Python "%MAXMEM%" "%VMARG_LIST%" ghidra.python.PythonRun %*
+call "%~dp0launch.bat" %LAUNCH_MODE% jdk Ghidra-Jython "%MAXMEM%" "%VMARG_LIST%" ghidra.jython.JythonRun %*
diff --git a/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/GhidraScriptMgrPluginScreenShots.java b/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/GhidraScriptMgrPluginScreenShots.java
index 78f20580b1..0101856efb 100644
--- a/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/GhidraScriptMgrPluginScreenShots.java
+++ b/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/GhidraScriptMgrPluginScreenShots.java
@@ -36,7 +36,7 @@ import ghidra.app.plugin.core.osgi.BundleStatusComponentProvider;
import ghidra.app.plugin.core.script.*;
import ghidra.app.script.*;
import ghidra.app.services.ConsoleService;
-import ghidra.python.PythonScriptProvider;
+import ghidra.jython.JythonScriptProvider;
import ghidra.util.HelpLocation;
public class GhidraScriptMgrPluginScreenShots extends GhidraScreenShotGenerator {
@@ -223,7 +223,7 @@ public class GhidraScriptMgrPluginScreenShots extends GhidraScreenShotGenerator
List