NationalSecurityAgency / ghidra

Ghidra is a software reverse engineering (SRE) framework
https://www.nsa.gov/ghidra
Apache License 2.0
51.92k stars 5.89k forks source link

Doesn't load extensions from .jar-Files when in development mode #1615

Closed ubfx closed 3 years ago

ubfx commented 4 years ago

Describe the bug If in development mode (SystemUtilities.isInDevelopmentMode()) aka launched from eclipse, Ghidra will only load plugins from the Extensions/[extname]/bin/main/[...]/*.class files. Plugins in .jar-Format aren't loaded correctly (They are shown in the Extension explorer, but not loaded).

To Reproduce Steps to reproduce the behavior:

  1. Open the Ghidra eclipse project
  2. Copy some compiled extension to Ghidra/Extensions (for example BinExport)
  3. The plugin will show up in the extension manager but the .jar will not have been loaded.

Expected behavior Plugins in .jar-Format should also be loaded in development mode.

Suggested fix Change this:

GhidraLauncher.java:59

if (SystemUtilities.isInDevelopmentMode()) {
    addModuleBinPaths(classpathList, modules);
    addExternalJarPaths(classpathList, layout.getApplicationRootDirs());
}
else {
    addPatchPaths(classpathList, layout.getPatchDir());
    addModuleJarPaths(classpathList, modules);
}

to:

if (SystemUtilities.isInDevelopmentMode()) {
    addModuleBinPaths(classpathList, modules);
    addExternalJarPaths(classpathList, layout.getApplicationRootDirs());
}
else {
    addPatchPaths(classpathList, layout.getPatchDir());
}
addModuleJarPaths(classpathList, modules);

I'll do a pull request

dragonmacher commented 4 years ago

This area just changed recently. We will investigate.

ubfx commented 4 years ago

Pull request: https://github.com/NationalSecurityAgency/ghidra/pull/1616

ryanmkurtz commented 3 years ago

Can you describe your use case? It sounds like you are in development mode, and would like to install a 3rd party extension that is in a "release" format (jars in its lib directory, no bin directory, etc). Is this correct?

ryanmkurtz commented 3 years ago

Closing due to inactivity. We can reopen if you still have a desire for this.