GP-1016: Fixing single jar mode exception

This commit is contained in:
Ryan Kurtz 2021-06-04 11:44:07 -04:00
parent a3f3f7eb82
commit 2eea089265
3 changed files with 26 additions and 12 deletions

View file

@ -86,6 +86,10 @@ public class GhidraJarBuilder implements GhidraLaunchable {
// include features unless they have been excluded via the module.manifest file.
return !module.excludeFromGhidraJar();
}
if (module.isDebug()) {
// include debug modules unless they have been excluded via the module.manifest file.
return !module.excludeFromGhidraJar();
}
if (module.isGPL()) {
// include features unless they have been excluded via the module.manifest file.
return !module.excludeFromGhidraJar();
@ -335,8 +339,8 @@ public class GhidraJarBuilder implements GhidraLaunchable {
}
}
if (wroteToZip) {
System.out.println(
"Can't create source zip! Has source been downloaded and installed?");
System.out
.println("Can't create source zip! Has source been downloaded and installed?");
// zip.close reports error if nothing has been written to it
zip.close();
}
@ -396,6 +400,7 @@ public class GhidraJarBuilder implements GhidraLaunchable {
Enumeration<JarEntry> entries = jarFile.entries();
while (entries.hasMoreElements()) {
JarEntry jarEntry = entries.nextElement();
String jarName = jarEntry.getName();
// Special case for Log4j:
//
@ -415,7 +420,7 @@ public class GhidraJarBuilder implements GhidraLaunchable {
// point, even though it doesn't now. As such, we may want to try to merge
// all the .dat files together at some point.
//
if (jarEntry.getName().contains("Log4j2Plugins.dat")) {
if (jarName.contains("Log4j2Plugins.dat")) {
if (jarFile.getName().contains("log4j-core")) {
jar.addJarEntry(jarFile, jarEntry, module);
}
@ -424,6 +429,10 @@ public class GhidraJarBuilder implements GhidraLaunchable {
}
}
if (jarName.endsWith(".SF") || jarName.endsWith(".DSA") || jarName.endsWith(".RSA")) {
continue;
}
jar.addJarEntry(jarFile, jarEntry, module);
}
}

View file

@ -65,6 +65,10 @@ public class ApplicationModule implements Comparable<ApplicationModule> {
return moduleDir.getParentFile().getName().equalsIgnoreCase("Framework");
}
public boolean isDebug() {
return moduleDir.getParentFile().getName().equalsIgnoreCase("Debug");
}
public boolean isProcessor() {
return moduleDir.getParentFile().getName().equalsIgnoreCase("Processors");
}

View file

@ -232,10 +232,11 @@ public class GhidraLauncher {
typePriorityMap.put("Framework", 0);
typePriorityMap.put("Configurations", 1);
typePriorityMap.put("Features", 2);
typePriorityMap.put("Processors", 3);
typePriorityMap.put("GPL", 4);
typePriorityMap.put("Extensions", 5);
typePriorityMap.put("Test", 6);
typePriorityMap.put("Debug", 3);
typePriorityMap.put("Processors", 4);
typePriorityMap.put("GPL", 5);
typePriorityMap.put("Extensions", 6);
typePriorityMap.put("Test", 7);
String type1 = module1.getModuleRoot().getParentFile().getName();
String type2 = module2.getModuleRoot().getParentFile().getName();