19 package org.sleuthkit.autopsy.datasourcesummary.datamodel;
21 import java.util.ArrayList;
22 import java.util.Arrays;
23 import java.util.Collection;
24 import java.util.Collections;
25 import java.util.HashSet;
26 import java.util.List;
28 import java.util.stream.Collectors;
29 import java.util.stream.Stream;
30 import org.apache.commons.lang3.tuple.Pair;
36 import org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
38 import org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE;
82 public PastCasesResult(List<Pair<String, Long>> sameIdsResults, List<Pair<String, Long>> taggedNotable) {
91 return Collections.unmodifiableList(sameIdsResults);
98 return Collections.unmodifiableList(taggedNotable);
103 ARTIFACT_TYPE.TSK_PREVIOUSLY_SEEN.getTypeID(),
104 ARTIFACT_TYPE.TSK_PREVIOUSLY_NOTABLE.getTypeID()
108 private static final BlackboardAttribute.Type
TYPE_COMMENT =
new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_OTHER_CASES);
111 ARTIFACT_TYPE.TSK_DEVICE_ATTACHED.getTypeID(),
112 ARTIFACT_TYPE.TSK_DEVICE_INFO.getTypeID(),
113 ARTIFACT_TYPE.TSK_SIM_ATTACHED.getTypeID(),
114 ARTIFACT_TYPE.TSK_WIFI_NETWORK_ADAPTER.getTypeID()
120 private final java.util.logging.Logger
logger;
143 java.util.logging.Logger
logger) {
145 this.caseProvider = provider;
159 if (sources == null) {
163 return sources.stream().anyMatch((str) -> {
164 return str != null && CENTRAL_REPO_INGEST_NAME.equalsIgnoreCase(str.trim());
177 if (artifact == null) {
178 return Collections.emptyList();
181 BlackboardAttribute commentAttr = null;
184 }
catch (TskCoreException ignored) {
188 if (commentAttr == null) {
189 return Collections.emptyList();
193 return Collections.emptyList();
196 String justCasesStr = commentAttr.getValueString().trim();
197 return Stream.of(justCasesStr.split(CASE_SEPARATOR))
199 .collect(Collectors.toList());
213 private static List<Pair<String, Long>>
getCaseCounts(Stream<String> cases) {
214 Collection<List<String>> groupedCases = cases
216 .collect(Collectors.groupingBy((caseStr) -> caseStr.toUpperCase().trim()))
222 .filter((lst) -> lst != null && lst.size() > 0)
224 .map((lst) -> Pair.of(lst.get(0), (long) lst.size()))
226 .sorted((a, b) -> -Long.compare(a.getValue(), b.getValue()))
227 .collect(Collectors.toList());
242 BlackboardArtifact sourceArtifact = null;
243 SleuthkitCase skCase = caseProvider.
get();
244 Content content = skCase.getContentById(artifact.getObjectID());
245 if (content instanceof BlackboardArtifact) {
246 sourceArtifact = (BlackboardArtifact) content;
248 return sourceArtifact;
263 if (parent == null) {
267 return CR_DEVICE_TYPE_IDS.contains(parent.getArtifactTypeID());
284 if (dataSource == null) {
288 SleuthkitCase skCase = caseProvider.
get();
290 List<String> deviceArtifactCases =
new ArrayList<>();
291 List<String> nonDeviceArtifactCases =
new ArrayList<>();
292 for (Integer typeId : ARTIFACT_UPDATE_TYPE_IDS) {
293 for (BlackboardArtifact artifact : skCase.getBlackboard().getArtifacts(typeId, dataSource.getId())) {
295 if (cases == null || cases.isEmpty()) {
300 deviceArtifactCases.addAll(cases);
302 nonDeviceArtifactCases.addAll(cases);
static final Set< Integer > ARTIFACT_UPDATE_TYPE_IDS
SleuthkitCaseProvider DEFAULT
List< Pair< String, Long > > getSameIdsResults()
static final String CENTRAL_REPO_INGEST_NAME
PastCasesResult getPastCasesData(DataSource dataSource)
final List< Pair< String, Long > > sameIdsResults
BlackboardArtifact getParentArtifact(BlackboardArtifact artifact)
boolean hasDeviceAssociatedArtifact(BlackboardArtifact artifact)
final SleuthkitCaseProvider caseProvider
PastCasesResult(List< Pair< String, Long >> sameIdsResults, List< Pair< String, Long >> taggedNotable)
static List< Pair< String, Long > > getCaseCounts(Stream< String > cases)
static boolean isCentralRepoGenerated(List< String > sources)
static final String CASE_SEPARATOR
final java.util.logging.Logger logger
static String getModuleName()
static List< String > getCasesFromArtifact(BlackboardArtifact artifact)
List< Pair< String, Long > > getTaggedNotable()
synchronized static Logger getLogger(String name)
static final Set< Integer > CR_DEVICE_TYPE_IDS
static final BlackboardAttribute.Type TYPE_COMMENT
PastCasesSummary(SleuthkitCaseProvider provider, java.util.logging.Logger logger)
final List< Pair< String, Long > > taggedNotable