mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 02:57:44 +00:00
Added tag events to sleuthkit
This commit is contained in:
parent
92ec7b2e42
commit
eb2a720354
@ -671,6 +671,38 @@ public class Case {
|
|||||||
public void publishAnalysisResultDeleted(TskEvent.AnalysisResultsDeletedTskEvent event) {
|
public void publishAnalysisResultDeleted(TskEvent.AnalysisResultsDeletedTskEvent event) {
|
||||||
eventPublisher.publish(new AnalysisResultDeletedEvent(event.getAnalysisResultObjectIds()));
|
eventPublisher.publish(new AnalysisResultDeletedEvent(event.getAnalysisResultObjectIds()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void publishBlackboardArtifactTagDeleted(TskEvent.BlackboardArtifactTagsDeletedTskEvent event) {
|
||||||
|
List<BlackboardArtifactTag> tags = event.getTags();
|
||||||
|
for(BlackboardArtifactTag tag: tags) {
|
||||||
|
eventPublisher.publish(new BlackBoardArtifactTagDeletedEvent(tag));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void publishBlackboardTagAdded(TskEvent.BlackboardArtifactTagsAddedTskEvent event) {
|
||||||
|
List<BlackboardArtifactTag> tags = event.getTags();
|
||||||
|
for(BlackboardArtifactTag tag: tags) {
|
||||||
|
eventPublisher.publish(new BlackBoardArtifactTagAddedEvent(tag));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void publishContentTagAdded(TskEvent.ContentTagsAddedTskEvent event) {
|
||||||
|
List<ContentTag> tags = event.getTags();
|
||||||
|
for(ContentTag tag: tags) {
|
||||||
|
eventPublisher.publish(new ContentTagAddedEvent(tag));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void publishContentTagDeleted(TskEvent.ContentTagsDeletedTskEvent event) {
|
||||||
|
List<ContentTag> tags = event.getTags();
|
||||||
|
for(ContentTag tag: tags) {
|
||||||
|
eventPublisher.publish(new ContentTagDeletedEvent(tag));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1820,41 +1852,6 @@ public class Case {
|
|||||||
eventPublisher.publish(new DataSourceNameChangedEvent(dataSource, newName));
|
eventPublisher.publish(new DataSourceNameChangedEvent(dataSource, newName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Notifies case event subscribers that a content tag has been added.
|
|
||||||
*
|
|
||||||
* This should not be called from the event dispatch thread (EDT)
|
|
||||||
*
|
|
||||||
* @param newTag new ContentTag added
|
|
||||||
*/
|
|
||||||
public void notifyContentTagAdded(ContentTag newTag) {
|
|
||||||
notifyContentTagAdded(newTag, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notifies case event subscribers that a content tag has been added.
|
|
||||||
*
|
|
||||||
* This should not be called from the event dispatch thread (EDT)
|
|
||||||
*
|
|
||||||
* @param newTag The added ContentTag.
|
|
||||||
* @param deletedTagList List of ContentTags that were removed as a result
|
|
||||||
* of the addition of newTag.
|
|
||||||
*/
|
|
||||||
public void notifyContentTagAdded(ContentTag newTag, List<ContentTag> deletedTagList) {
|
|
||||||
eventPublisher.publish(new ContentTagAddedEvent(newTag, deletedTagList));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notifies case event subscribers that a content tag has been deleted.
|
|
||||||
*
|
|
||||||
* This should not be called from the event dispatch thread (EDT)
|
|
||||||
*
|
|
||||||
* @param deletedTag ContentTag deleted
|
|
||||||
*/
|
|
||||||
public void notifyContentTagDeleted(ContentTag deletedTag) {
|
|
||||||
eventPublisher.publish(new ContentTagDeletedEvent(deletedTag));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies case event subscribers that a tag definition has changed.
|
* Notifies case event subscribers that a tag definition has changed.
|
||||||
*
|
*
|
||||||
@ -1885,41 +1882,6 @@ public class Case {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Notifies case event subscribers that an artifact tag has been added.
|
|
||||||
*
|
|
||||||
* This should not be called from the event dispatch thread (EDT)
|
|
||||||
*
|
|
||||||
* @param newTag new BlackboardArtifactTag added
|
|
||||||
*/
|
|
||||||
public void notifyBlackBoardArtifactTagAdded(BlackboardArtifactTag newTag) {
|
|
||||||
notifyBlackBoardArtifactTagAdded(newTag, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notifies case event subscribers that an artifact tag has been added.
|
|
||||||
*
|
|
||||||
* This should not be called from the event dispatch thread (EDT)
|
|
||||||
*
|
|
||||||
* @param newTag The added ContentTag.
|
|
||||||
* @param removedTagList List of ContentTags that were removed as a result
|
|
||||||
* of the addition of newTag.
|
|
||||||
*/
|
|
||||||
public void notifyBlackBoardArtifactTagAdded(BlackboardArtifactTag newTag, List<BlackboardArtifactTag> removedTagList) {
|
|
||||||
eventPublisher.publish(new BlackBoardArtifactTagAddedEvent(newTag, removedTagList));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notifies case event subscribers that an artifact tag has been deleted.
|
|
||||||
*
|
|
||||||
* This should not be called from the event dispatch thread (EDT)
|
|
||||||
*
|
|
||||||
* @param deletedTag BlackboardArtifactTag deleted
|
|
||||||
*/
|
|
||||||
public void notifyBlackBoardArtifactTagDeleted(BlackboardArtifactTag deletedTag) {
|
|
||||||
eventPublisher.publish(new BlackBoardArtifactTagDeletedEvent(deletedTag));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a report to the case.
|
* Adds a report to the case.
|
||||||
*
|
*
|
||||||
|
@ -66,9 +66,9 @@ public class TagsManager implements Closeable {
|
|||||||
private static String PROJECT_VIC_TAG_SET_NAME = "Project VIC";
|
private static String PROJECT_VIC_TAG_SET_NAME = "Project VIC";
|
||||||
|
|
||||||
private static final Object lock = new Object();
|
private static final Object lock = new Object();
|
||||||
|
|
||||||
private final Map<String, TagName> allTagNameMap = Collections.synchronizedMap(new HashMap<>());
|
private final Map<String, TagName> allTagNameMap = Collections.synchronizedMap(new HashMap<>());
|
||||||
|
|
||||||
private final PropertyChangeListener listener = new PropertyChangeListener() {
|
private final PropertyChangeListener listener = new PropertyChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
@ -95,7 +95,7 @@ public class TagsManager implements Closeable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final PropertyChangeListener weakListener = WeakListeners.propertyChange(listener, null);
|
private final PropertyChangeListener weakListener = WeakListeners.propertyChange(listener, null);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@ -300,12 +300,12 @@ public class TagsManager implements Closeable {
|
|||||||
try {
|
try {
|
||||||
List<TagSet> tagSetsInCase = taggingMgr.getTagSets();
|
List<TagSet> tagSetsInCase = taggingMgr.getTagSets();
|
||||||
if (tagSetsInCase.isEmpty()) {
|
if (tagSetsInCase.isEmpty()) {
|
||||||
|
|
||||||
// add the standard tag names
|
// add the standard tag names
|
||||||
for (TagNameDefinition def : TagNameDefinition.getStandardTagNameDefinitions()) {
|
for (TagNameDefinition def : TagNameDefinition.getStandardTagNameDefinitions()) {
|
||||||
taggingMgr.addOrUpdateTagName(def.getDisplayName(), def.getDescription(), def.getColor(), def.getKnownStatus());
|
taggingMgr.addOrUpdateTagName(def.getDisplayName(), def.getDescription(), def.getColor(), def.getKnownStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Assume new case and add all tag sets
|
//Assume new case and add all tag sets
|
||||||
for (TagSetDefinition setDef : TagSetDefinition.readTagSetDefinitions()) {
|
for (TagSetDefinition setDef : TagSetDefinition.readTagSetDefinitions()) {
|
||||||
List<TagName> tagNamesInSet = new ArrayList<>();
|
List<TagName> tagNamesInSet = new ArrayList<>();
|
||||||
@ -317,12 +317,12 @@ public class TagsManager implements Closeable {
|
|||||||
taggingMgr.addTagSet(setDef.getName(), tagNamesInSet);
|
taggingMgr.addTagSet(setDef.getName(), tagNamesInSet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(TagName tagName: caseDb.getAllTagNames()) {
|
for (TagName tagName : caseDb.getAllTagNames()) {
|
||||||
allTagNameMap.put(tagName.getDisplayName(), tagName);
|
allTagNameMap.put(tagName.getDisplayName(), tagName);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
LOGGER.log(Level.SEVERE, "Error updating standard tag name and tag set definitions", ex);
|
LOGGER.log(Level.SEVERE, "Error updating standard tag name and tag set definitions", ex);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
@ -332,7 +332,7 @@ public class TagsManager implements Closeable {
|
|||||||
for (TagNameDefinition tagName : TagNameDefinition.getTagNameDefinitions()) {
|
for (TagNameDefinition tagName : TagNameDefinition.getTagNameDefinitions()) {
|
||||||
tagName.saveToCase(caseDb);
|
tagName.saveToCase(caseDb);
|
||||||
}
|
}
|
||||||
|
|
||||||
Case.addEventTypeSubscriber(Collections.singleton(Case.Events.TAG_NAMES_UPDATED), weakListener);
|
Case.addEventTypeSubscriber(Collections.singleton(Case.Events.TAG_NAMES_UPDATED), weakListener);
|
||||||
Case.addEventTypeSubscriber(Collections.singleton(Case.Events.TAG_NAMES_ADDED), weakListener);
|
Case.addEventTypeSubscriber(Collections.singleton(Case.Events.TAG_NAMES_ADDED), weakListener);
|
||||||
Case.addEventTypeSubscriber(Collections.singleton(Case.Events.TAG_NAMES_DELETED), weakListener);
|
Case.addEventTypeSubscriber(Collections.singleton(Case.Events.TAG_NAMES_DELETED), weakListener);
|
||||||
@ -359,7 +359,7 @@ public class TagsManager implements Closeable {
|
|||||||
* @throws TskCoreException If there is an error querying the case database.
|
* @throws TskCoreException If there is an error querying the case database.
|
||||||
*/
|
*/
|
||||||
public TagSet getTagSet(TagName tagName) throws TskCoreException {
|
public TagSet getTagSet(TagName tagName) throws TskCoreException {
|
||||||
return caseDb.getTaggingManager().getTagSet(tagName);
|
return caseDb.getTaggingManager().getTagSet(tagName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -383,7 +383,7 @@ public class TagsManager implements Closeable {
|
|||||||
* @return A list, possibly empty, of TagName objects.
|
* @return A list, possibly empty, of TagName objects.
|
||||||
*/
|
*/
|
||||||
public synchronized List<TagName> getAllTagNames() {
|
public synchronized List<TagName> getAllTagNames() {
|
||||||
|
|
||||||
List<TagName> tagNames = new ArrayList<>();
|
List<TagName> tagNames = new ArrayList<>();
|
||||||
tagNames.addAll(allTagNameMap.values());
|
tagNames.addAll(allTagNameMap.values());
|
||||||
return tagNames;
|
return tagNames;
|
||||||
@ -636,14 +636,6 @@ public class TagsManager implements Closeable {
|
|||||||
*/
|
*/
|
||||||
public ContentTag addContentTag(Content content, TagName tagName, String comment, long beginByteOffset, long endByteOffset) throws TskCoreException {
|
public ContentTag addContentTag(Content content, TagName tagName, String comment, long beginByteOffset, long endByteOffset) throws TskCoreException {
|
||||||
TaggingManager.ContentTagChange tagChange = caseDb.getTaggingManager().addContentTag(content, tagName, comment, beginByteOffset, endByteOffset);
|
TaggingManager.ContentTagChange tagChange = caseDb.getTaggingManager().addContentTag(content, tagName, comment, beginByteOffset, endByteOffset);
|
||||||
try {
|
|
||||||
Case currentCase = Case.getCurrentCaseThrows();
|
|
||||||
|
|
||||||
currentCase.notifyContentTagAdded(tagChange.getAddedTag(), tagChange.getRemovedTags().isEmpty() ? null : tagChange.getRemovedTags());
|
|
||||||
|
|
||||||
} catch (NoCurrentCaseException ex) {
|
|
||||||
throw new TskCoreException("Added a tag to a closed case", ex);
|
|
||||||
}
|
|
||||||
return tagChange.getAddedTag();
|
return tagChange.getAddedTag();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -657,11 +649,6 @@ public class TagsManager implements Closeable {
|
|||||||
*/
|
*/
|
||||||
public void deleteContentTag(ContentTag tag) throws TskCoreException {
|
public void deleteContentTag(ContentTag tag) throws TskCoreException {
|
||||||
caseDb.deleteContentTag(tag);
|
caseDb.deleteContentTag(tag);
|
||||||
try {
|
|
||||||
Case.getCurrentCaseThrows().notifyContentTagDeleted(tag);
|
|
||||||
} catch (NoCurrentCaseException ex) {
|
|
||||||
throw new TskCoreException("Deleted a tag from a closed case", ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -857,12 +844,6 @@ public class TagsManager implements Closeable {
|
|||||||
*/
|
*/
|
||||||
public BlackboardArtifactTag addBlackboardArtifactTag(BlackboardArtifact artifact, TagName tagName, String comment) throws TskCoreException {
|
public BlackboardArtifactTag addBlackboardArtifactTag(BlackboardArtifact artifact, TagName tagName, String comment) throws TskCoreException {
|
||||||
TaggingManager.BlackboardArtifactTagChange tagChange = caseDb.getTaggingManager().addArtifactTag(artifact, tagName, comment);
|
TaggingManager.BlackboardArtifactTagChange tagChange = caseDb.getTaggingManager().addArtifactTag(artifact, tagName, comment);
|
||||||
try {
|
|
||||||
Case currentCase = Case.getCurrentCaseThrows();
|
|
||||||
currentCase.notifyBlackBoardArtifactTagAdded(tagChange.getAddedTag(), tagChange.getRemovedTags().isEmpty() ? null : tagChange.getRemovedTags());
|
|
||||||
} catch (NoCurrentCaseException ex) {
|
|
||||||
throw new TskCoreException("Added a tag to a closed case", ex);
|
|
||||||
}
|
|
||||||
return tagChange.getAddedTag();
|
return tagChange.getAddedTag();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -876,11 +857,6 @@ public class TagsManager implements Closeable {
|
|||||||
*/
|
*/
|
||||||
public void deleteBlackboardArtifactTag(BlackboardArtifactTag tag) throws TskCoreException {
|
public void deleteBlackboardArtifactTag(BlackboardArtifactTag tag) throws TskCoreException {
|
||||||
caseDb.deleteBlackboardArtifactTag(tag);
|
caseDb.deleteBlackboardArtifactTag(tag);
|
||||||
try {
|
|
||||||
Case.getCurrentCaseThrows().notifyBlackBoardArtifactTagDeleted(tag);
|
|
||||||
} catch (NoCurrentCaseException ex) {
|
|
||||||
throw new TskCoreException("Deleted a tag from a closed case", ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user