mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 02:07:42 +00:00
Merge pull request #1804 from BasisOlivers/custom_artifact_addition
Updated ModuleDataEvent
This commit is contained in:
commit
b6fb5d65e8
@ -226,7 +226,7 @@ public class EmailExtracted implements AutopsyVisitableItem {
|
||||
* for the event to have a null oldValue.
|
||||
*/
|
||||
ModuleDataEvent eventData = (ModuleDataEvent) evt.getOldValue();
|
||||
if (null != eventData && eventData.getArtifactType() == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG) {
|
||||
if (null != eventData && eventData.getArtifactTypeId() == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) {
|
||||
emailResults.update();
|
||||
}
|
||||
} catch (IllegalStateException notUsed) {
|
||||
|
@ -164,9 +164,17 @@ public class ExtractedContent implements AutopsyVisitableItem {
|
||||
* the event is a remote event.
|
||||
*/
|
||||
final ModuleDataEvent event = (ModuleDataEvent) evt.getOldValue();
|
||||
if (null != event && doNotShow.contains(event.getArtifactType()) == false) {
|
||||
if (null != event) {
|
||||
boolean passed = true;
|
||||
for(BlackboardArtifact.ARTIFACT_TYPE type: doNotShow) {
|
||||
if(type.getTypeID() == event.getArtifactTypeId()) {
|
||||
passed = false;
|
||||
}
|
||||
}
|
||||
if(passed) {
|
||||
refresh(true);
|
||||
}
|
||||
}
|
||||
} catch (IllegalStateException notUsed) {
|
||||
/**
|
||||
* Case is closed, do nothing.
|
||||
@ -416,7 +424,7 @@ public class ExtractedContent implements AutopsyVisitableItem {
|
||||
* for the event to have a null oldValue.
|
||||
*/
|
||||
final ModuleDataEvent event = (ModuleDataEvent) evt.getOldValue();
|
||||
if (null != event && event.getArtifactType() == type) {
|
||||
if (null != event && event.getArtifactTypeId() == type.getTypeID()) {
|
||||
refresh(true);
|
||||
}
|
||||
} catch (IllegalStateException notUsed) {
|
||||
|
@ -204,7 +204,7 @@ public class HashsetHits implements AutopsyVisitableItem {
|
||||
* oldValue if the event is a remote event.
|
||||
*/
|
||||
ModuleDataEvent eventData = (ModuleDataEvent) evt.getOldValue();
|
||||
if (null != eventData && eventData.getArtifactType() == ARTIFACT_TYPE.TSK_HASHSET_HIT) {
|
||||
if (null != eventData && eventData.getArtifactTypeId() == ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()) {
|
||||
hashsetResults.update();
|
||||
}
|
||||
} catch (IllegalStateException notUsed) {
|
||||
|
@ -195,8 +195,8 @@ public class InterestingHits implements AutopsyVisitableItem {
|
||||
* for the event to have a null oldValue.
|
||||
*/
|
||||
ModuleDataEvent eventData = (ModuleDataEvent) evt.getOldValue();
|
||||
if (null != eventData && (eventData.getArtifactType() == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT
|
||||
|| eventData.getArtifactType() == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT)) {
|
||||
if (null != eventData && (eventData.getArtifactTypeId() == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT.getTypeID()
|
||||
|| eventData.getArtifactTypeId() == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID())) {
|
||||
interestingResults.update();
|
||||
}
|
||||
} catch (IllegalStateException notUsed) {
|
||||
|
@ -268,7 +268,7 @@ public class KeywordHits implements AutopsyVisitableItem {
|
||||
* for the event to have a null oldValue.
|
||||
*/
|
||||
ModuleDataEvent eventData = (ModuleDataEvent) evt.getOldValue();
|
||||
if (null != eventData && eventData.getArtifactType() == BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT) {
|
||||
if (null != eventData && eventData.getArtifactTypeId() == BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
|
||||
keywordResults.update();
|
||||
}
|
||||
} catch (IllegalStateException notUsed) {
|
||||
|
@ -50,7 +50,8 @@ public class ModuleDataEvent extends ChangeEvent {
|
||||
|
||||
private String moduleName;
|
||||
private ARTIFACT_TYPE artifactType;
|
||||
private Collection<BlackboardArtifact> artifactIDs;
|
||||
private int artifactTypeId;
|
||||
private Collection<BlackboardArtifact> artifacts;
|
||||
|
||||
/**
|
||||
* @param moduleName Module name
|
||||
@ -58,19 +59,49 @@ public class ModuleDataEvent extends ChangeEvent {
|
||||
*/
|
||||
public ModuleDataEvent(String moduleName, ARTIFACT_TYPE artifactType) {
|
||||
super(artifactType);
|
||||
this.artifactTypeId = artifactType.getTypeID();
|
||||
this.moduleName = moduleName;
|
||||
this.artifactType = artifactType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param moduleName Module name
|
||||
* @param artifactType Type of artifact that was posted to blackboard
|
||||
* @param artifactIDs List of specific artifact ID values that were added
|
||||
* to blackboard
|
||||
* @param artifactTypeId ID of the type of artifact posted to the blackboard
|
||||
*/
|
||||
public ModuleDataEvent(String moduleName, ARTIFACT_TYPE artifactType, Collection<BlackboardArtifact> artifactIDs) {
|
||||
public ModuleDataEvent(String moduleName, int artifactTypeId) {
|
||||
super(ARTIFACT_TYPE.fromID(artifactTypeId));
|
||||
this.artifactTypeId = artifactTypeId;
|
||||
this.moduleName = moduleName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param moduleName Module name
|
||||
* @param artifactTypeId ID of the type of artifact posted to the blackboard
|
||||
* @param artifacts List of specific artifact ID values that were added to
|
||||
* blackboard
|
||||
*/
|
||||
public ModuleDataEvent(String moduleName, int artifactTypeId, Collection<BlackboardArtifact> artifacts) {
|
||||
this(moduleName, artifactTypeId);
|
||||
this.artifacts = artifacts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param moduleName Module name
|
||||
* @param artifactType Type of artifact that was posted to blackboard
|
||||
* @param artifacts List of specific artifact values that were added to
|
||||
* blackboard
|
||||
*/
|
||||
public ModuleDataEvent(String moduleName, ARTIFACT_TYPE artifactType, Collection<BlackboardArtifact> artifacts) {
|
||||
this(moduleName, artifactType);
|
||||
this.artifactIDs = artifactIDs;
|
||||
this.artifacts = artifacts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Artifact Type ID of this event
|
||||
* @return The artifact ID
|
||||
*/
|
||||
public int getArtifactTypeId() {
|
||||
return this.artifactTypeId;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,13 +110,13 @@ public class ModuleDataEvent extends ChangeEvent {
|
||||
* @return Collection of artifact ids or null if not provided
|
||||
*/
|
||||
public Collection<BlackboardArtifact> getArtifacts() {
|
||||
return artifactIDs;
|
||||
return artifacts;
|
||||
}
|
||||
|
||||
/**
|
||||
* get artifact type of the new artifacts associated with the event
|
||||
*
|
||||
* @return
|
||||
* If it is a user defined artifact, it will return null
|
||||
* @return the artifact type
|
||||
*/
|
||||
public ARTIFACT_TYPE getArtifactType() {
|
||||
return artifactType;
|
||||
|
@ -61,7 +61,7 @@ public final class BlackboardPostEvent extends AutopsyEvent implements Serializa
|
||||
*/
|
||||
super(
|
||||
IngestManager.IngestModuleEvent.DATA_ADDED.toString(),
|
||||
new SerializableEventData(eventData.getModuleName(), eventData.getArtifactType(), eventData.getArtifacts() != null
|
||||
new SerializableEventData(eventData.getModuleName(), eventData.getArtifactTypeId(), eventData.getArtifacts() != null
|
||||
? eventData.getArtifacts()
|
||||
.stream()
|
||||
.map(BlackboardArtifact::getArtifactID)
|
||||
@ -96,7 +96,7 @@ public final class BlackboardPostEvent extends AutopsyEvent implements Serializa
|
||||
for (Long id : data.artifactIds) {
|
||||
artifacts.add(Case.getCurrentCase().getSleuthkitCase().getBlackboardArtifact(id));
|
||||
}
|
||||
eventData = new ModuleDataEvent(data.moduleName, data.artifactType, !artifacts.isEmpty() ? artifacts : null);
|
||||
eventData = new ModuleDataEvent(data.moduleName, data.artifactTypeId, !artifacts.isEmpty() ? artifacts : null);
|
||||
return eventData;
|
||||
} catch (IllegalStateException | TskCoreException ex) {
|
||||
logger.log(Level.SEVERE, "Error doing lazy load for remote event", ex);
|
||||
@ -112,12 +112,12 @@ public final class BlackboardPostEvent extends AutopsyEvent implements Serializa
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final String moduleName;
|
||||
private ARTIFACT_TYPE artifactType;
|
||||
private int artifactTypeId;
|
||||
private Collection<Long> artifactIds;
|
||||
|
||||
private SerializableEventData(String moduleName, ARTIFACT_TYPE artifactType, Collection<Long> artifactIds) {
|
||||
private SerializableEventData(String moduleName, int artifactTypeId, Collection<Long> artifactIds) {
|
||||
this.moduleName = moduleName;
|
||||
this.artifactType = artifactType;
|
||||
this.artifactTypeId = artifactTypeId;
|
||||
this.artifactIds = new ArrayList<>(artifactIds);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user