mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-02-17 08:00:15 +00:00
parent
2f0b64a31a
commit
c5594d2b91
@ -371,7 +371,7 @@ public abstract class GhidraScript extends FlatProgramAPI {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DomainFolder getProjectRootFolder() {
|
||||
public DomainFolder getProjectRootFolder() {
|
||||
if (isRunningHeadless()) {
|
||||
Project project = state.getProject();
|
||||
ProjectData projectData = project.getProjectData();
|
||||
|
@ -2473,7 +2473,7 @@ public class FlatProgramAPI {
|
||||
* the root domain folder.
|
||||
* @return the root domain folder of the current project
|
||||
*/
|
||||
protected DomainFolder getProjectRootFolder() {
|
||||
public DomainFolder getProjectRootFolder() {
|
||||
Project project = AppInfo.getActiveProject();
|
||||
ProjectData projectData = project.getProjectData();
|
||||
DomainFolder folder = projectData.getRootFolder();
|
||||
|
@ -69,11 +69,6 @@ public class GhidraPythonInterpreter extends InteractiveInterpreter {
|
||||
// Setup python cache directory
|
||||
PythonUtils.setupPythonCacheDir(TaskMonitor.DUMMY);
|
||||
|
||||
// Enable protected java methods to be accessed from python sub-classes.
|
||||
// This is necessary to be able to call protected GhidraScript/FlatProgram API
|
||||
// methods from a python script.
|
||||
System.setProperty("python.security.respectJavaAccessibility", "false");
|
||||
|
||||
// Indicate that we've initialized the python environment, which should
|
||||
// only happen once.
|
||||
pythonInitialized = true;
|
||||
@ -348,12 +343,16 @@ public class GhidraPythonInterpreter extends InteractiveInterpreter {
|
||||
}
|
||||
}
|
||||
|
||||
// Add public and protected methods (only once). Ignore inner classes.
|
||||
// Add public methods (only once). Ignore inner classes.
|
||||
//
|
||||
// NOTE: We currently do not have a way to safely add protected methods. Disabling
|
||||
// python.security.respectJavaAccessibility and adding in protected methods in the below
|
||||
// loop caused an InaccessibleObjectException for some users (relating to core Java
|
||||
// modules, not the GhidraScript class hierarchy).
|
||||
if (!scriptMethodsInjected) {
|
||||
for (Method method : scriptClass.getDeclaredMethods()) {
|
||||
if (!method.getName().contains("$") &&
|
||||
(Modifier.isPublic(method.getModifiers()) ||
|
||||
Modifier.isProtected(method.getModifiers()))) {
|
||||
Modifier.isPublic(method.getModifiers())) {
|
||||
method.setAccessible(true);
|
||||
setMethod(script, method);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user