Sleuth Kit Java Bindings (JNI)  4.12.1
Java bindings for using The Sleuth Kit
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  */
19 package org.sleuthkit.datamodel.blackboardutils;
20 
21 import java.util.ArrayList;
22 import java.util.Collection;
23 import java.util.Collections;
24 import java.util.Optional;
32 
36 public 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, Collection< BlackboardAttribute > otherAttributesList)
DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection< BlackboardAttribute > attributesList)
BlackboardArtifact addInstalledProgram(String programName, long dateInstalled)
ArtifactsHelper(SleuthkitCase caseDb, String moduleName, Content srcContent, Long ingestJobId)
ArtifactsHelper(SleuthkitCase caseDb, String moduleName, Content srcContent)

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