mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
GT-3376: Design improvements
This commit is contained in:
parent
a46e788706
commit
73b018fd84
13 changed files with 149 additions and 170 deletions
|
@ -17,7 +17,6 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import generic.stl.Pair;
|
||||
import ghidra.app.script.GhidraScript;
|
||||
|
@ -26,47 +25,18 @@ import ghidra.app.util.bin.format.coff.*;
|
|||
import ghidra.app.util.bin.format.coff.archive.CoffArchiveHeader;
|
||||
import ghidra.app.util.bin.format.coff.archive.CoffArchiveMemberHeader;
|
||||
import ghidra.app.util.importer.*;
|
||||
import ghidra.app.util.opinion.*;
|
||||
import ghidra.app.util.opinion.Loader;
|
||||
import ghidra.app.util.opinion.MSCoffLoader;
|
||||
import ghidra.framework.model.DomainFolder;
|
||||
import ghidra.framework.store.local.LocalFileSystem;
|
||||
import ghidra.program.model.lang.*;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.util.InvalidNameException;
|
||||
import ghidra.util.exception.*;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
import util.CollectionUtils;
|
||||
|
||||
public class RecursiveRecursiveMSLibImport extends GhidraScript {
|
||||
final static Predicate<Loader> LOADER_FILTER = new SingleLoaderFilter(MSCoffLoader.class);
|
||||
final static LoadSpecChooser LOADSPEC_CHOOSER = loadMap -> {
|
||||
Stream<LoadSpec> loadSpecStream = loadMap.values().stream().flatMap(e -> e.stream());
|
||||
Iterable<LoadSpec> loadSpecs = CollectionUtils.asIterable(loadSpecStream.iterator());
|
||||
for (LoadSpec loadSpec : loadSpecs) {
|
||||
LanguageCompilerSpecPair lcsp = loadSpec.getLanguageCompilerSpec();
|
||||
if (lcsp.compilerSpecID.getIdAsString().equals("windows")) {
|
||||
return loadSpec;
|
||||
}
|
||||
}
|
||||
for (LoadSpec loadSpec : loadSpecs) {
|
||||
LanguageCompilerSpecPair lcsp = loadSpec.getLanguageCompilerSpec();
|
||||
try {
|
||||
if (lcsp.getLanguageDescription().getEndian() == Endian.LITTLE &&
|
||||
lcsp.getLanguageDescription().getVariant().contains("v7")) {
|
||||
return loadSpec;
|
||||
}
|
||||
}
|
||||
catch (LanguageNotFoundException e) {
|
||||
// ignore...not sure why this happened
|
||||
}
|
||||
}
|
||||
for (LoadSpec loadSpec : loadSpecs) {
|
||||
LanguageCompilerSpecPair lcsp = loadSpec.getLanguageCompilerSpec();
|
||||
if (lcsp.compilerSpecID.getIdAsString().equals("gcc")) {
|
||||
return loadSpec;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
final static LoadSpecChooser LOADSPEC_CHOOSER = new CsHintLoadSpecChooser("windows");
|
||||
|
||||
@Override
|
||||
protected void run() throws Exception {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue