mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 10:19:23 +02:00
GP-4700 - Improve PDB and MDMang developer scripts
This commit is contained in:
parent
043f66b9af
commit
999004245a
5 changed files with 23 additions and 16 deletions
|
@ -23,7 +23,8 @@ import docking.widgets.values.GValuesMap;
|
|||
import ghidra.app.script.GhidraScript;
|
||||
import ghidra.app.util.bin.format.pdb2.pdbreader.*;
|
||||
import ghidra.features.base.values.GhidraValuesMap;
|
||||
import ghidra.util.*;
|
||||
import ghidra.util.MessageType;
|
||||
import ghidra.util.StatusListener;
|
||||
|
||||
public class PdbDeveloperDumpScript extends GhidraScript {
|
||||
|
||||
|
@ -85,6 +86,7 @@ public class PdbDeveloperDumpScript extends GhidraScript {
|
|||
values.setValidator((valueMap, status) -> {
|
||||
return validatePdb(valueMap, status) && validateOutput(valueMap, status);
|
||||
});
|
||||
setReusePreviousChoices(false); // false for second pass... want our default output
|
||||
values = askValues(TITLE, null, values);
|
||||
pdbFile = values.getFile(PDB_PROMPT); // might have changed
|
||||
pdbFileName = pdbFile.getAbsolutePath(); // might have changed
|
||||
|
@ -92,14 +94,14 @@ public class PdbDeveloperDumpScript extends GhidraScript {
|
|||
|
||||
if (dumpFile.exists()) {
|
||||
if (!askYesNo("Confirm Overwrite", "Overwrite file: " + dumpFile.getName())) {
|
||||
Msg.info(this, "Operation canceled");
|
||||
println("Operation canceled");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
String message = "Processing PDB Dump of: " + pdbFileName;
|
||||
monitor.setMessage(message);
|
||||
Msg.info(this, message);
|
||||
println(message);
|
||||
try (AbstractPdb pdb = PdbParser.parse(pdbFile, new PdbReaderOptions(), monitor)) {
|
||||
pdb.deserialize();
|
||||
FileWriter fileWriter = new FileWriter(dumpFile);
|
||||
|
@ -110,12 +112,12 @@ public class PdbDeveloperDumpScript extends GhidraScript {
|
|||
bufferedWriter.close();
|
||||
}
|
||||
catch (IOException ioe) {
|
||||
Msg.info(this, ioe.getMessage());
|
||||
println(ioe.getMessage());
|
||||
popup(ioe.getMessage());
|
||||
}
|
||||
message = "Results located in: " + dumpFile.getAbsoluteFile();
|
||||
monitor.setMessage(message);
|
||||
Msg.info(this, message);
|
||||
println(message);
|
||||
}
|
||||
|
||||
private void outputHeaderMessage(BufferedWriter bufferedWriter, String name) throws Exception {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue