19 package org.sleuthkit.autopsy.datasourceprocessors.xry;
21 import java.util.ArrayList;
23 import java.util.HashMap;
24 import java.util.List;
25 import java.util.Optional;
26 import org.
sleuthkit.datamodel.Blackboard.BlackboardException;
36 final class XRYWebBookmarksFileParser
extends AbstractSingleEntityParser {
39 private static final Map<String, BlackboardAttribute.ATTRIBUTE_TYPE> XRY_KEYS
40 =
new HashMap<String, BlackboardAttribute.ATTRIBUTE_TYPE>() {
42 put(
"web address", BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL);
43 put(
"domain", BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN);
44 put(
"application", BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME);
49 boolean canProcess(XRYKeyValuePair pair) {
50 String normalizedKey = pair.getKey().toLowerCase();
51 return XRY_KEYS.containsKey(normalizedKey);
55 boolean isNamespace(String nameSpace) {
64 private Optional<BlackboardAttribute> getBlackboardAttribute(XRYKeyValuePair pair) {
65 String normalizedKey = pair.getKey().toLowerCase();
66 return Optional.of(
new BlackboardAttribute(
67 XRY_KEYS.get(normalizedKey),
68 PARSER_NAME, pair.getValue()));
72 void makeArtifact(List<XRYKeyValuePair> keyValuePairs, Content parent, SleuthkitCase currentCase)
throws TskCoreException, BlackboardException {
73 List<BlackboardAttribute> attributes =
new ArrayList<>();
74 for(XRYKeyValuePair pair : keyValuePairs) {
75 Optional<BlackboardAttribute> attribute = getBlackboardAttribute(pair);
76 if(attribute.isPresent()) {
77 attributes.add(attribute.get());
80 if(!attributes.isEmpty()) {
81 BlackboardArtifact artifact = parent.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK);
82 artifact.addAttributes(attributes);