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;
34 final class XRYWebBookmarksFileParser
extends AbstractSingleEntityParser {
37 private static final Map<String, BlackboardAttribute.ATTRIBUTE_TYPE> XRY_KEYS
38 =
new HashMap<String, BlackboardAttribute.ATTRIBUTE_TYPE>() {
40 put(
"web address", BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL);
41 put(
"domain", BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN);
42 put(
"application", BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME);
47 boolean canProcess(XRYKeyValuePair pair) {
48 String normalizedKey = pair.getKey().toLowerCase();
49 return XRY_KEYS.containsKey(normalizedKey);
53 boolean isNamespace(String nameSpace) {
62 private Optional<BlackboardAttribute> getBlackboardAttribute(XRYKeyValuePair pair) {
63 String normalizedKey = pair.getKey().toLowerCase();
64 return Optional.of(
new BlackboardAttribute(
65 XRY_KEYS.get(normalizedKey),
66 PARSER_NAME, pair.getValue()));
70 void makeArtifact(List<XRYKeyValuePair> keyValuePairs, Content parent)
throws TskCoreException {
71 List<BlackboardAttribute> attributes =
new ArrayList<>();
72 for(XRYKeyValuePair pair : keyValuePairs) {
73 Optional<BlackboardAttribute> attribute = getBlackboardAttribute(pair);
74 if(attribute.isPresent()) {
75 attributes.add(attribute.get());
78 if(!attributes.isEmpty()) {
79 BlackboardArtifact artifact = parent.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK);
80 artifact.addAttributes(attributes);