GP-3814 - Version Tracking - Removed dependency on VTController from VT scripts

This commit is contained in:
dragonmacher 2023-09-11 18:08:11 -04:00
parent d7d6b44e29
commit e7bc5efb93
68 changed files with 740 additions and 689 deletions

View file

@ -28,7 +28,6 @@ import ghidra.feature.vt.api.markuptype.*;
import ghidra.feature.vt.api.util.*;
import ghidra.framework.model.DomainFolder;
import ghidra.framework.options.ToolOptions;
import ghidra.framework.plugintool.PluginTool;
import ghidra.program.model.address.AddressSet;
import ghidra.program.model.address.AddressSetView;
import ghidra.program.model.listing.Program;
@ -74,7 +73,6 @@ public class CreateAppliedExactMatchingSessionScript extends GhidraScript {
int sessionTransaction = session.startTransaction(description);
try {
PluginTool serviceProvider = state.getTool();
VTAssociationManager manager = session.getAssociationManager();
// should we have convenience methods in VTCorrelator that don't
@ -87,16 +85,16 @@ public class CreateAppliedExactMatchingSessionScript extends GhidraScript {
VTProgramCorrelatorFactory factory;
factory = new ExactDataMatchProgramCorrelatorFactory();
correlateAndPossiblyApply(sourceProgram, destinationProgram, session, serviceProvider,
manager, sourceAddressSet, destinationAddressSet, factory);
correlateAndPossiblyApply(session, manager, sourceAddressSet, destinationAddressSet,
factory);
factory = new ExactMatchBytesProgramCorrelatorFactory();
correlateAndPossiblyApply(sourceProgram, destinationProgram, session, serviceProvider,
manager, sourceAddressSet, destinationAddressSet, factory);
correlateAndPossiblyApply(session, manager, sourceAddressSet, destinationAddressSet,
factory);
factory = new ExactMatchInstructionsProgramCorrelatorFactory();
correlateAndPossiblyApply(sourceProgram, destinationProgram, session, serviceProvider,
manager, sourceAddressSet, destinationAddressSet, factory);
correlateAndPossiblyApply(session, manager, sourceAddressSet, destinationAddressSet,
factory);
}
finally {
try {
@ -110,8 +108,7 @@ public class CreateAppliedExactMatchingSessionScript extends GhidraScript {
}
}
private void correlateAndPossiblyApply(Program sourceProgram, Program destinationProgram,
VTSession session, PluginTool serviceProvider, VTAssociationManager manager,
private void correlateAndPossiblyApply(VTSession session, VTAssociationManager manager,
AddressSetView sourceAddressSet, AddressSetView destinationAddressSet,
VTProgramCorrelatorFactory factory)
throws CancelledException, VTAssociationStatusException {
@ -121,7 +118,7 @@ public class CreateAppliedExactMatchingSessionScript extends GhidraScript {
AddressSetView restrictedDestinationAddresses =
excludeAcceptedMatches(session, destinationAddressSet, false);
VTOptions options = factory.createDefaultOptions();
VTProgramCorrelator correlator = factory.createCorrelator(serviceProvider, sourceProgram,
VTProgramCorrelator correlator = factory.createCorrelator(sourceProgram,
restrictedSourceAddresses, destinationProgram, restrictedDestinationAddresses, options);
VTMatchSet results = correlator.correlate(session, monitor);