Sleuth Kit Java Bindings (JNI) 4.14.0
Java bindings for using The Sleuth Kit
Loading...
Searching...
No Matches
ArtifactsHelper.java
Go to the documentation of this file.
1/*
2 * Sleuth Kit Data Model
3 *
4 * Copyright 2019-2021 Basis Technology Corp.
5 * Contact: carrier <at> sleuthkit <dot> org
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19package org.sleuthkit.datamodel.blackboardutils;
20
21import java.util.ArrayList;
22import java.util.Collection;
23import java.util.Collections;
24import java.util.Optional;
25import org.sleuthkit.datamodel.Blackboard.BlackboardException;
26import org.sleuthkit.datamodel.BlackboardArtifact;
27import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
28import org.sleuthkit.datamodel.BlackboardAttribute;
29import org.sleuthkit.datamodel.Content;
30import org.sleuthkit.datamodel.SleuthkitCase;
31import org.sleuthkit.datamodel.TskCoreException;
32
36public final class ArtifactsHelper extends ArtifactHelperBase {
37
38 private static final BlackboardArtifact.Type INSTALLED_PROG_TYPE = new BlackboardArtifact.Type(ARTIFACT_TYPE.TSK_INSTALLED_PROG);
39
50 public ArtifactsHelper(SleuthkitCase caseDb, String moduleName, Content srcContent, Long ingestJobId) {
51 super(caseDb, moduleName, srcContent, ingestJobId);
52 }
53
65 @Deprecated
66 public ArtifactsHelper(SleuthkitCase caseDb, String moduleName, Content srcContent) {
67 this(caseDb, moduleName, srcContent, null);
68 }
69
81 public BlackboardArtifact addInstalledProgram(String programName, long dateInstalled) throws TskCoreException, BlackboardException {
82 return addInstalledProgram(programName, dateInstalled,
83 Collections.emptyList());
84 }
85
100 public BlackboardArtifact addInstalledProgram(String programName, long dateInstalled,
101 Collection<BlackboardAttribute> otherAttributesList) throws TskCoreException, BlackboardException {
102
103 Collection<BlackboardAttribute> attributes = new ArrayList<>();
104
105 // construct attributes
106 attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME, getModuleName(), programName));
107 addAttributeIfNotZero(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, dateInstalled, attributes);
108
109 // add the attributes
110 attributes.addAll(otherAttributesList);
111
112 // create artifact
113 Content content = getContent();
114 BlackboardArtifact installedProgramArtifact = content.newDataArtifact(INSTALLED_PROG_TYPE, attributes);
115
116 // post artifact
117 Optional<Long> ingestJobId = getIngestJobId();
118 getSleuthkitCase().getBlackboard().postArtifact(installedProgramArtifact, getModuleName(), ingestJobId.orElse(null));
119
120 // return the artifact
121 return installedProgramArtifact;
122 }
123
124}
BlackboardArtifact addInstalledProgram(String programName, long dateInstalled)
ArtifactsHelper(SleuthkitCase caseDb, String moduleName, Content srcContent)
ArtifactsHelper(SleuthkitCase caseDb, String moduleName, Content srcContent, Long ingestJobId)
BlackboardArtifact addInstalledProgram(String programName, long dateInstalled, Collection< BlackboardAttribute > otherAttributesList)
DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection< BlackboardAttribute > attributesList)

Copyright © 2011-2024 Brian Carrier. (carrier -at- sleuthkit -dot- org)
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.