GP-2509 GP-2644 Improved Ghidra URL support. Added support for Ghidra

URL linked files and folders within project.
This commit is contained in:
ghidra1
2022-08-30 18:31:11 -04:00
parent 8d6cf5e310
commit 5a422c4502
153 changed files with 7083 additions and 1732 deletions
@@ -99,6 +99,10 @@ public class CollectFailedRelocations extends GhidraScript {
if (monitor.isCancelled()) {
return;
}
// 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 (domainFile.getContentType().equals(ProgramContentHandler.PROGRAM_CONTENT_TYPE)) {
programs.add(domainFile);
}
@@ -258,6 +258,10 @@ public class CreateMultipleLibraries extends GhidraScript {
DomainFile[] files = myFolder.getFiles();
for (DomainFile domainFile : files) {
monitor.checkCanceled();
// 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 (domainFile.getContentType().equals(ProgramContentHandler.PROGRAM_CONTENT_TYPE)) {
programs.add(domainFile);
}
@@ -372,6 +372,10 @@ public class FidStatistics extends GhidraScript {
DomainFile[] files = folder.getFiles();
for (DomainFile domainFile : files) {
monitor.checkCanceled();
// 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 (domainFile.getContentType().equals(ProgramContentHandler.PROGRAM_CONTENT_TYPE)) {
programs.add(domainFile);
}
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +16,9 @@
//Opens all programs under a chosen domain folder, grabs their error count,
//then sorts in increasing error order and prints them
//@category FunctionID
import java.io.IOException;
import java.util.*;
import generic.stl.Pair;
import ghidra.app.script.GhidraScript;
import ghidra.framework.model.DomainFile;
@@ -27,9 +29,6 @@ import ghidra.util.Msg;
import ghidra.util.exception.CancelledException;
import ghidra.util.exception.VersionException;
import java.io.IOException;
import java.util.*;
public class FindErrors extends GhidraScript {
@Override
@@ -82,6 +81,10 @@ public class FindErrors extends GhidraScript {
if (monitor.isCancelled()) {
return;
}
// 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 (domainFile.getContentType().equals(ProgramContentHandler.PROGRAM_CONTENT_TYPE)) {
programs.add(domainFile);
}
@@ -100,6 +100,10 @@ public class FindFunctionByHash extends GhidraScript {
if (monitor.isCancelled()) {
return;
}
// 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 (domainFile.getContentType().equals(ProgramContentHandler.PROGRAM_CONTENT_TYPE)) {
programs.add(domainFile);
}
@@ -16,6 +16,9 @@
//Opens all programs under a chosen domain folder, scans them for functions
//that match a user supplied name, and prints info about the match.
//@category FunctionID
import java.io.IOException;
import java.util.ArrayList;
import ghidra.app.script.GhidraScript;
import ghidra.feature.fid.service.FidService;
import ghidra.framework.model.DomainFile;
@@ -26,9 +29,6 @@ import ghidra.util.Msg;
import ghidra.util.exception.CancelledException;
import ghidra.util.exception.VersionException;
import java.io.IOException;
import java.util.ArrayList;
public class FindNamedFunction extends GhidraScript {
FidService service;
@@ -85,6 +85,10 @@ public class FindNamedFunction extends GhidraScript {
if (monitor.isCancelled()) {
return;
}
// 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 (domainFile.getContentType().equals(ProgramContentHandler.PROGRAM_CONTENT_TYPE)) {
programs.add(domainFile);
}
@@ -153,6 +153,10 @@ public class IngestTask extends Task {
for (DomainFile domainFile : files) {
monitor.checkCanceled();
monitor.incrementProgress(1);
// 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 (domainFile.getContentType().equals(ProgramContentHandler.PROGRAM_CONTENT_TYPE)) {
programs.add(domainFile);
}