Ghidra is a software reverse engineering (SRE) framework
clarify and discourage access to compiled scripts
Jason P. Leasurec660a12ab3e6
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/script/GhidraScriptUtil.java b/Ghidra/Features/Base/src/main/java/ghidra/app/script/GhidraScriptUtil.javaindex 96cca45d36..993544df4f 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/script/GhidraScriptUtil.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/script/GhidraScriptUtil.java@@ -25,7 +25,6 @@ import org.apache.commons.collections4.map.LazyMap;import docking.widgets.bundlemanager.BundlePath;import generic.jar.ResourceFile;-import ghidra.app.script.osgi.SourceBundleInfo;import ghidra.framework.Application;import ghidra.program.model.listing.Program;import ghidra.util.Msg;@@ -193,16 +192,6 @@ public class GhidraScriptUtil {return null;}- /**- * Returns the output directory to which the given script file's generated .class file should- * be written- * @param scriptFile the script file- * @return the directory- */- public static ResourceFile getScriptCompileOutputDirectory(ResourceFile scriptFile) {- return new ResourceFile(SourceBundleInfo.getBindirFromScriptFile(scriptFile).toFile());- }-public static Path getOsgiDir() {Path usersettings = Application.getUserSettingsDirectory().toPath();return usersettings.resolve("osgi");@@ -213,15 +202,13 @@ public class GhidraScriptUtil {}/**- * Returns the list of directories to which scripts are compiled.+ * Returns the list of exploded bundle directories* @return the list*- * @see #getScriptCompileOutputDirectory(ResourceFile)- *- * @deprecated class files shouldn't be accessed directly+ * @deprecated accessing class file directly precludes OSGi wiring according to requirements and capabilities*/@Deprecated- public static List<ResourceFile> getScriptBinDirectories() {+ public static List<ResourceFile> getExplodedBundlePaths() {try {return Files.list(getOsgiDir()).filter(Files::isDirectory).map(x -> new ResourceFile(x.toFile())).collect(Collectors.toList());diff --git a/Ghidra/Features/Python/src/main/java/ghidra/python/GhidraPythonInterpreter.java b/Ghidra/Features/Python/src/main/java/ghidra/python/GhidraPythonInterpreter.javaindex 4b8b98d228..069294be9a 100644--- a/Ghidra/Features/Python/src/main/java/ghidra/python/GhidraPythonInterpreter.java+++ b/Ghidra/Features/Python/src/main/java/ghidra/python/GhidraPythonInterpreter.java@@ -138,7 +138,7 @@ public class GhidraPythonInterpreter extends InteractiveInterpreter {systemState.path.append(Py.newString(resourceFile.getFile(false).getAbsolutePath()));}- for (ResourceFile resourceFile : GhidraScriptUtil.getScriptBinDirectories()) {+ for (ResourceFile resourceFile : GhidraScriptUtil.getExplodedBundlePaths()) {systemState.path.append(Py.newString(resourceFile.getFile(false).getAbsolutePath()));}