expose current `GhidraScript` instance to Python
slippycheeze opened this issue · 2 comments
ghidra.util.Msg
has some useful "popup" functions that I wanted to use, specifically the ones that take a Java Throwable
for displaying Java exception details; for example:
public static void showError(java.lang.Object originator, java.awt.Component parent, java.lang.String title, java.lang.Object message)
That first argument, originator
, is supposed to be the Java thing that is displaying the message; typical use would be Msg.showError(this, ...)
in Java. I'd like to do the same in Ghidrathon, but there is no easy way I can see to access the current GhidraScript
derivative.
I can get the current script by calling jepwrappers.get_script()
, which returns the ghidrathon.GhidrathonScript
instance, if I want, but it isn't exposed any other way that I can see.
I'd suggest adding getCurrentScript()
or something very similar as a "public" version of that to the globals of the python script environment?
@slippycheeze thank you for the suggestion. I like the idea of adding a new Python function, named getCurrentScript
, to the Python builtins scope. Alternatively, we should consider naming the function script
to better align with the way Ghidrathon exposes other GhidraScript
variables like currentProgram
and monitor
.
ultimately, anything that provided a "public" API to getting the GhidraScript instance would be fine by me; I don't have strong feelings about what it is called or anything like that. thanks. :)