So this question may seem too generic on first glance but I have tagged it with Ghidra - does tags not mean anything - in any case I added a [Ghidra]
to clarify even more that I'm asking about Ghidra script.
I don't want this question to be lost because even myself I would like to have it as a future reference.