File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Ghidra/Features/Python/src/main/java/ghidra/python Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,11 @@ public static GhidraPythonInterpreter get() {
69
69
// Setup python cache directory
70
70
PythonUtils .setupPythonCacheDir (TaskMonitor .DUMMY );
71
71
72
+ // Enable protected java methods to be accessed from python sub-classes.
73
+ // This is necessary to be able to call protected GhidraScript/FlatProgram API
74
+ // methods from a python script.
75
+ System .setProperty ("python.security.respectJavaAccessibility" , "false" );
76
+
72
77
// Indicate that we've initialized the python environment, which should
73
78
// only happen once.
74
79
pythonInitialized = true ;
@@ -343,11 +348,12 @@ private void injectScriptHierarchy(PythonScript script) {
343
348
}
344
349
}
345
350
346
- // Add public methods only once. Ignore inner classes.
351
+ // Add public and protected methods ( only once) . Ignore inner classes.
347
352
if (!scriptMethodsInjected ) {
348
353
for (Method method : scriptClass .getDeclaredMethods ()) {
349
354
if (!method .getName ().contains ("$" ) &&
350
- Modifier .isPublic (method .getModifiers ())) {
355
+ (Modifier .isPublic (method .getModifiers ()) ||
356
+ Modifier .isProtected (method .getModifiers ()))) {
351
357
method .setAccessible (true );
352
358
setMethod (script , method );
353
359
}
You can’t perform that action at this time.
0 commit comments