Sleuth Kit Java Bindings (JNI)  4.11.0
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 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;
34 
39 public final class ArtifactsHelper extends ArtifactHelperBase {
40  private static final BlackboardArtifact.Type INSTALLED_PROG_TYPE = new BlackboardArtifact.Type(ARTIFACT_TYPE.TSK_INSTALLED_PROG);
41 
50  public ArtifactsHelper(SleuthkitCase caseDb, String moduleName, Content srcContent) {
51  super(caseDb, moduleName, srcContent);
52  }
53 
65  public BlackboardArtifact addInstalledProgram(String programName, long dateInstalled) throws TskCoreException, BlackboardException {
66  return addInstalledProgram(programName, dateInstalled,
67  Collections.emptyList());
68  }
69 
84  public BlackboardArtifact addInstalledProgram(String programName, long dateInstalled,
85  Collection<BlackboardAttribute> otherAttributesList) throws TskCoreException, BlackboardException {
86 
87  Collection<BlackboardAttribute> attributes = new ArrayList<>();
88 
89  // construct attributes
90  attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME, getModuleName(), programName));
91  addAttributeIfNotZero(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, dateInstalled, attributes);
92 
93  // add the attributes
94  attributes.addAll(otherAttributesList);
95 
96  // create artifact
97  Content content = getContent();
98  BlackboardArtifact installedProgramArtifact = content.newDataArtifact(INSTALLED_PROG_TYPE, attributes);
99 
100  // post artifact
101  getSleuthkitCase().getBlackboard().postArtifact(installedProgramArtifact, getModuleName());
102 
103  // return the artifact
104  return installedProgramArtifact;
105  }
106 
107 }
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)

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.