Ghidra: ScriptMgrPlugin: Automatically remove stale scripts

Created on 18 Mar 2020  路  3Comments  路  Source: NationalSecurityAgency/ghidra

Is your feature request related to a problem? Please describe.

I stumbled upon a NoClassDefFoundError as follows:

1.) add script MyFirstScript.java to a script directory and bind it to say, shift+1
2.) rename the class (outside the script manager plugin) to MySecondScript and the file to MySecondScript.java
After changing my scripts I tend to clear my compiled files (dev/ghidra_scripts/bin/) to force a recompilation
3.) refresh script list in the plugin and rebind MySecondScript .java to shift+1
4.) old binding persists and is difficult to remove. NoClassDefFoundError is thrown

Describe the solution you'd like
ScriptManagerPlugin should forget about scripts no longer in the directories, or provide a clean way to manage its memory.

Describe alternatives you've considered
I was able to manually remove it by editing _code_browser.tcd, replacing all instances of MyFirstScript with MySecondScript
The more sane version is creating a temporary MyFirstScript, then deleting it from the manager to allow the plugin to do housekeeping.

Most helpful comment

did we just make sad-dev.. happy?? :-)

All 3 comments

We have recently completely rewritten the scripting management framework. You should no longer need to delete your old scripts, as the framework is much better at script lifecycle management.

That being said, your above issue may still be present. Will you verify that you problem still exists in the master branch?

I've tested on 9.2 and encountered no problems (except some of my scripts breaking due to API changes, which is my problem to fix). Hitting refresh to recompile scripts felt really great, I've got to say :D

did we just make sad-dev.. happy?? :-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

astrelsky picture astrelsky  路  3Comments

pd0wm picture pd0wm  路  3Comments

Merculous picture Merculous  路  3Comments

0x6d696368 picture 0x6d696368  路  3Comments

ghost picture ghost  路  3Comments