mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-30 10:25:18 +08:00
GP-2509 GP-2644 Improved Ghidra URL support. Added support for Ghidra
URL linked files and folders within project.
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
// NOTE: Script will only process unversioned and checked-out files.
|
||||
//@category Examples
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.script.GhidraScript;
|
||||
import ghidra.app.script.GhidraState;
|
||||
import ghidra.framework.model.*;
|
||||
@@ -25,8 +27,6 @@ import ghidra.program.model.listing.Program;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
import ghidra.util.exception.VersionException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class CallAnotherScriptForAllPrograms extends GhidraScript {
|
||||
|
||||
// The script referenced in the following line should be replaced with the script to be called
|
||||
@@ -59,6 +59,10 @@ public class CallAnotherScriptForAllPrograms extends GhidraScript {
|
||||
}
|
||||
|
||||
private void processDomainFile(DomainFile domainFile) throws CancelledException, IOException {
|
||||
// Do not follow folder-links or consider program links. Using content type
|
||||
// to filter is best way to control this. If program links should be considered
|
||||
// "Program.class.isAssignableFrom(domainFile.getDomainObjectClass())"
|
||||
// should be used.
|
||||
if (!ProgramContentHandler.PROGRAM_CONTENT_TYPE.equals(domainFile.getContentType())) {
|
||||
return; // skip non-Program files
|
||||
}
|
||||
|
||||
@@ -143,6 +143,8 @@ public class RepositoryFileUpgradeScript extends GhidraScript {
|
||||
}
|
||||
|
||||
private boolean performProgramUpgrade(DomainFile df) throws IOException, CancelledException {
|
||||
// Do not follow folder-links or consider program links. Using content type
|
||||
// to filter is best way to control this.
|
||||
if (!ProgramContentHandler.PROGRAM_CONTENT_TYPE.equals(df.getContentType())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,10 @@ public class VersionControl_AddAll extends GhidraScript {
|
||||
if (monitor.isCancelled()) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Do not follow folder-links or consider program links. Using content type
|
||||
// to filter is best way to control this. If program links should be considered
|
||||
// "Program.class.isAssignableFrom(domainFile.getDomainObjectClass())"
|
||||
// should be used. It may also be appropriate to handle other content types.
|
||||
if (!ProgramContentHandler.PROGRAM_CONTENT_TYPE.equals(file.getContentType()) ||
|
||||
file.isVersioned()) {
|
||||
continue;// skip
|
||||
|
||||
Reference in New Issue
Block a user