Sleuth Kit Java Bindings (JNI)  4.10.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;
30 
35 public final class ArtifactsHelper extends ArtifactHelperBase {
36 
45  public ArtifactsHelper(SleuthkitCase caseDb, String moduleName, Content srcContent) {
46  super(caseDb, moduleName, srcContent);
47  }
48 
60  public BlackboardArtifact addInstalledProgram(String programName, long dateInstalled) throws TskCoreException, BlackboardException {
61  return addInstalledProgram(programName, dateInstalled,
62  Collections.emptyList());
63  }
64 
79  public BlackboardArtifact addInstalledProgram(String programName, long dateInstalled,
80  Collection<BlackboardAttribute> otherAttributesList) throws TskCoreException, BlackboardException {
81 
82  BlackboardArtifact installedProgramArtifact;
83  Collection<BlackboardAttribute> attributes = new ArrayList<>();
84 
85  // create artifact
86  installedProgramArtifact = getContent().newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_INSTALLED_PROG);
87 
88  // construct attributes
89  attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME, getModuleName(), programName));
90  addAttributeIfNotZero(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, dateInstalled, attributes);
91 
92  // add the attributes
93  attributes.addAll(otherAttributesList);
94  installedProgramArtifact.addAttributes(attributes);
95 
96  // post artifact
97  getSleuthkitCase().getBlackboard().postArtifact(installedProgramArtifact, getModuleName());
98 
99  // return the artifact
100  return installedProgramArtifact;
101  }
102 
103 }
BlackboardArtifact addInstalledProgram(String programName, long dateInstalled, Collection< BlackboardAttribute > otherAttributesList)
BlackboardArtifact addInstalledProgram(String programName, long dateInstalled)
BlackboardArtifact newArtifact(int artifactTypeID)
ArtifactsHelper(SleuthkitCase caseDb, String moduleName, Content srcContent)

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