mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
Merge pull request #1807 from BasisOlivers/custom_artifact_addition-1848
Updated to use Type class
This commit is contained in:
commit
b15a1553a2
@ -226,7 +226,7 @@ public class EmailExtracted implements AutopsyVisitableItem {
|
|||||||
* for the event to have a null oldValue.
|
* for the event to have a null oldValue.
|
||||||
*/
|
*/
|
||||||
ModuleDataEvent eventData = (ModuleDataEvent) evt.getOldValue();
|
ModuleDataEvent eventData = (ModuleDataEvent) evt.getOldValue();
|
||||||
if (null != eventData && eventData.getArtifactTypeId() == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) {
|
if (null != eventData && eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) {
|
||||||
emailResults.update();
|
emailResults.update();
|
||||||
}
|
}
|
||||||
} catch (IllegalStateException notUsed) {
|
} catch (IllegalStateException notUsed) {
|
||||||
|
@ -167,7 +167,7 @@ public class ExtractedContent implements AutopsyVisitableItem {
|
|||||||
if (null != event) {
|
if (null != event) {
|
||||||
boolean passed = true;
|
boolean passed = true;
|
||||||
for(BlackboardArtifact.ARTIFACT_TYPE type: doNotShow) {
|
for(BlackboardArtifact.ARTIFACT_TYPE type: doNotShow) {
|
||||||
if(type.getTypeID() == event.getArtifactTypeId()) {
|
if(type.getTypeID() == event.getBlackboardArtifactType().getTypeID()) {
|
||||||
passed = false;
|
passed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -225,9 +225,9 @@ public class ExtractedContent implements AutopsyVisitableItem {
|
|||||||
if (skCase != null) {
|
if (skCase != null) {
|
||||||
try {
|
try {
|
||||||
List<BlackboardArtifact.ARTIFACT_TYPE> inUse = new ArrayList<>();
|
List<BlackboardArtifact.ARTIFACT_TYPE> inUse = new ArrayList<>();
|
||||||
List<Integer> types = skCase.getArtifactTypesInUse();
|
List<BlackboardArtifact.Type> types = skCase.getArtifactTypesInUse();
|
||||||
for (Integer i: types) {
|
for (BlackboardArtifact.Type type: types) {
|
||||||
inUse.add(BlackboardArtifact.ARTIFACT_TYPE.fromID(i));
|
inUse.add(BlackboardArtifact.ARTIFACT_TYPE.fromID(type.getTypeID()));
|
||||||
}
|
}
|
||||||
inUse.removeAll(doNotShow);
|
inUse.removeAll(doNotShow);
|
||||||
Collections.sort(inUse,
|
Collections.sort(inUse,
|
||||||
@ -424,7 +424,7 @@ public class ExtractedContent implements AutopsyVisitableItem {
|
|||||||
* for the event to have a null oldValue.
|
* for the event to have a null oldValue.
|
||||||
*/
|
*/
|
||||||
final ModuleDataEvent event = (ModuleDataEvent) evt.getOldValue();
|
final ModuleDataEvent event = (ModuleDataEvent) evt.getOldValue();
|
||||||
if (null != event && event.getArtifactTypeId() == type.getTypeID()) {
|
if (null != event && event.getBlackboardArtifactType().getTypeID() == type.getTypeID()) {
|
||||||
refresh(true);
|
refresh(true);
|
||||||
}
|
}
|
||||||
} catch (IllegalStateException notUsed) {
|
} catch (IllegalStateException notUsed) {
|
||||||
|
@ -204,7 +204,7 @@ public class HashsetHits implements AutopsyVisitableItem {
|
|||||||
* oldValue if the event is a remote event.
|
* oldValue if the event is a remote event.
|
||||||
*/
|
*/
|
||||||
ModuleDataEvent eventData = (ModuleDataEvent) evt.getOldValue();
|
ModuleDataEvent eventData = (ModuleDataEvent) evt.getOldValue();
|
||||||
if (null != eventData && eventData.getArtifactTypeId() == ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()) {
|
if (null != eventData && eventData.getBlackboardArtifactType().getTypeID() == ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()) {
|
||||||
hashsetResults.update();
|
hashsetResults.update();
|
||||||
}
|
}
|
||||||
} catch (IllegalStateException notUsed) {
|
} catch (IllegalStateException notUsed) {
|
||||||
|
@ -195,8 +195,8 @@ public class InterestingHits implements AutopsyVisitableItem {
|
|||||||
* for the event to have a null oldValue.
|
* for the event to have a null oldValue.
|
||||||
*/
|
*/
|
||||||
ModuleDataEvent eventData = (ModuleDataEvent) evt.getOldValue();
|
ModuleDataEvent eventData = (ModuleDataEvent) evt.getOldValue();
|
||||||
if (null != eventData && (eventData.getArtifactTypeId() == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT.getTypeID()
|
if (null != eventData && (eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT.getTypeID()
|
||||||
|| eventData.getArtifactTypeId() == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID())) {
|
|| eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID())) {
|
||||||
interestingResults.update();
|
interestingResults.update();
|
||||||
}
|
}
|
||||||
} catch (IllegalStateException notUsed) {
|
} catch (IllegalStateException notUsed) {
|
||||||
|
@ -268,7 +268,7 @@ public class KeywordHits implements AutopsyVisitableItem {
|
|||||||
* for the event to have a null oldValue.
|
* for the event to have a null oldValue.
|
||||||
*/
|
*/
|
||||||
ModuleDataEvent eventData = (ModuleDataEvent) evt.getOldValue();
|
ModuleDataEvent eventData = (ModuleDataEvent) evt.getOldValue();
|
||||||
if (null != eventData && eventData.getArtifactTypeId() == BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
|
if (null != eventData && eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
|
||||||
keywordResults.update();
|
keywordResults.update();
|
||||||
}
|
}
|
||||||
} catch (IllegalStateException notUsed) {
|
} catch (IllegalStateException notUsed) {
|
||||||
|
@ -49,39 +49,39 @@ import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
|
|||||||
public class ModuleDataEvent extends ChangeEvent {
|
public class ModuleDataEvent extends ChangeEvent {
|
||||||
|
|
||||||
private String moduleName;
|
private String moduleName;
|
||||||
private ARTIFACT_TYPE artifactType;
|
private BlackboardArtifact.Type blackboardArtifactType;
|
||||||
private int artifactTypeId;
|
|
||||||
private Collection<BlackboardArtifact> artifacts;
|
private Collection<BlackboardArtifact> artifacts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param moduleName Module name
|
* @param moduleName Module name
|
||||||
* @param artifactType Type of artifact that was posted to blackboard
|
* @param artifactType Type of artifact that was posted to blackboard
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public ModuleDataEvent(String moduleName, ARTIFACT_TYPE artifactType) {
|
public ModuleDataEvent(String moduleName, ARTIFACT_TYPE artifactType) {
|
||||||
super(artifactType);
|
super(artifactType);
|
||||||
this.artifactTypeId = artifactType.getTypeID();
|
this.blackboardArtifactType = new BlackboardArtifact.Type(artifactType.getTypeID(), artifactType.getLabel(), artifactType.getDisplayName());
|
||||||
this.moduleName = moduleName;
|
this.moduleName = moduleName;
|
||||||
this.artifactType = artifactType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param moduleName Module name
|
* @param moduleName Module Name
|
||||||
* @param artifactTypeId ID of the type of artifact posted to the blackboard
|
* @param blackboardArtifactType Type of the blackboard artifact posted to
|
||||||
|
* the blackboard
|
||||||
*/
|
*/
|
||||||
public ModuleDataEvent(String moduleName, int artifactTypeId) {
|
public ModuleDataEvent(String moduleName, BlackboardArtifact.Type blackboardArtifactType) {
|
||||||
super(ARTIFACT_TYPE.fromID(artifactTypeId));
|
super(blackboardArtifactType);
|
||||||
this.artifactTypeId = artifactTypeId;
|
this.blackboardArtifactType = blackboardArtifactType;
|
||||||
this.moduleName = moduleName;
|
this.moduleName = moduleName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param moduleName Module name
|
* @param moduleName Module name
|
||||||
* @param artifactTypeId ID of the type of artifact posted to the blackboard
|
* @param blackboardArtifactType Type of artifact posted to the blackboard
|
||||||
* @param artifacts List of specific artifact ID values that were added to
|
* @param artifacts List of specific artifact ID values that were added to
|
||||||
* blackboard
|
* blackboard
|
||||||
*/
|
*/
|
||||||
public ModuleDataEvent(String moduleName, int artifactTypeId, Collection<BlackboardArtifact> artifacts) {
|
public ModuleDataEvent(String moduleName, BlackboardArtifact.Type blackboardArtifactType, Collection<BlackboardArtifact> artifacts) {
|
||||||
this(moduleName, artifactTypeId);
|
this(moduleName, blackboardArtifactType);
|
||||||
this.artifacts = artifacts;
|
this.artifacts = artifacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,17 +91,20 @@ public class ModuleDataEvent extends ChangeEvent {
|
|||||||
* @param artifacts List of specific artifact values that were added to
|
* @param artifacts List of specific artifact values that were added to
|
||||||
* blackboard
|
* blackboard
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public ModuleDataEvent(String moduleName, ARTIFACT_TYPE artifactType, Collection<BlackboardArtifact> artifacts) {
|
public ModuleDataEvent(String moduleName, ARTIFACT_TYPE artifactType, Collection<BlackboardArtifact> artifacts) {
|
||||||
this(moduleName, artifactType);
|
this(moduleName, artifactType);
|
||||||
this.artifacts = artifacts;
|
this.artifacts = artifacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the Artifact Type ID of this event
|
* Gets the blackboard artifact type of the new artifacts associated with
|
||||||
* @return The artifact ID
|
* the event
|
||||||
|
*
|
||||||
|
* @return The blackboard artifact type
|
||||||
*/
|
*/
|
||||||
public int getArtifactTypeId() {
|
public BlackboardArtifact.Type getBlackboardArtifactType() {
|
||||||
return this.artifactTypeId;
|
return this.blackboardArtifactType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -112,16 +115,6 @@ public class ModuleDataEvent extends ChangeEvent {
|
|||||||
public Collection<BlackboardArtifact> getArtifacts() {
|
public Collection<BlackboardArtifact> getArtifacts() {
|
||||||
return artifacts;
|
return artifacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* get artifact type of the new artifacts associated with the event
|
|
||||||
* If it is a user defined artifact, it will return null
|
|
||||||
* @return the artifact type
|
|
||||||
*/
|
|
||||||
public ARTIFACT_TYPE getArtifactType() {
|
|
||||||
return artifactType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get module name that created the artifacts and fired the event
|
* get module name that created the artifacts and fired the event
|
||||||
*
|
*
|
||||||
|
@ -61,7 +61,7 @@ public final class BlackboardPostEvent extends AutopsyEvent implements Serializa
|
|||||||
*/
|
*/
|
||||||
super(
|
super(
|
||||||
IngestManager.IngestModuleEvent.DATA_ADDED.toString(),
|
IngestManager.IngestModuleEvent.DATA_ADDED.toString(),
|
||||||
new SerializableEventData(eventData.getModuleName(), eventData.getArtifactTypeId(), eventData.getArtifacts() != null
|
new SerializableEventData(eventData.getModuleName(), eventData.getBlackboardArtifactType() , eventData.getArtifacts() != null
|
||||||
? eventData.getArtifacts()
|
? eventData.getArtifacts()
|
||||||
.stream()
|
.stream()
|
||||||
.map(BlackboardArtifact::getArtifactID)
|
.map(BlackboardArtifact::getArtifactID)
|
||||||
@ -112,10 +112,10 @@ public final class BlackboardPostEvent extends AutopsyEvent implements Serializa
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private final String moduleName;
|
private final String moduleName;
|
||||||
private int artifactTypeId;
|
private BlackboardArtifact.Type artifactTypeId;
|
||||||
private Collection<Long> artifactIds;
|
private Collection<Long> artifactIds;
|
||||||
|
|
||||||
private SerializableEventData(String moduleName, int artifactTypeId, Collection<Long> artifactIds) {
|
private SerializableEventData(String moduleName, BlackboardArtifact.Type artifactTypeId, Collection<Long> artifactIds) {
|
||||||
this.moduleName = moduleName;
|
this.moduleName = moduleName;
|
||||||
this.artifactTypeId = artifactTypeId;
|
this.artifactTypeId = artifactTypeId;
|
||||||
this.artifactIds = new ArrayList<>(artifactIds);
|
this.artifactIds = new ArrayList<>(artifactIds);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user