Autopsy  3.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
WebTypes.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2014 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.autopsy.timeline.events.type;
20 
21 import java.util.Collections;
22 import java.util.List;
23 import java.util.Map;
24 import java.util.function.BiFunction;
25 import javafx.scene.image.Image;
26 import org.apache.commons.lang3.StringUtils;
27 import org.openide.util.NbBundle;
31 
35 public enum WebTypes implements EventType, ArtifactEventType {
36 
37  WEB_DOWNLOADS(NbBundle.getMessage(WebTypes.class, "WebTypes.webDownloads.name"),
38  "downloads.png", // NON-NLS
44 
48  @Override
49  public AttributeEventDescription parseAttributesHelper(BlackboardArtifact artf, Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attrMap) {
50  long time = attrMap.get(getDateTimeAttrubuteType()).getValueLong();
51  String domain = getShortExtractor().apply(artf, attrMap);
52  String path = getMedExtractor().apply(artf, attrMap);
53  String fileName = StringUtils.substringAfterLast(path, "/");
54  String url = getFullExtractor().apply(artf, attrMap);
55 
56  //TODO: review non default description construction
57  String shortDescription = fileName + " from " + domain; // NON-NLS
58  String medDescription = fileName + " from " + url; // NON-NLS
59  String fullDescription = path + " from " + url; // NON-NLS
60  return new AttributeEventDescription(time, shortDescription, medDescription, fullDescription);
61  }
62  },
63  //TODO: review description separators
64  WEB_COOKIE(NbBundle.getMessage(WebTypes.class, "WebTypes.webCookies.name"),
65  "cookies.png", // NON-NLS
71  //TODO: review description separators
72  WEB_BOOKMARK(NbBundle.getMessage(WebTypes.class, "WebTypes.webBookmarks.name"),
73  "bookmarks.png", // NON-NLS
79  //TODO: review description separators
80  WEB_HISTORY(NbBundle.getMessage(WebTypes.class, "WebTypes.webHistory.name"),
81  "history.png", // NON-NLS
87  //TODO: review description separators
88  WEB_SEARCH(NbBundle.getMessage(WebTypes.class, "WebTypes.webSearch.name"),
89  "searchquery.png", // NON-NLS
95 
97 
98  private final String iconBase;
99 
100  private final Image image;
101 
102  @Override
103  public Image getFXImage() {
104  return image;
105  }
106 
107  @Override
109  return dateTimeAttributeType;
110  }
111 
112  @Override
115  }
116 
118 
119  private final BiFunction<BlackboardArtifact, Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute>, String> medExtractor;
120 
121  private final BiFunction<BlackboardArtifact, Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute>, String> shortExtractor;
122 
123  @Override
124  public BiFunction<BlackboardArtifact, Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute>, String> getFullExtractor() {
125  return longExtractor;
126  }
127 
128  @Override
129  public BiFunction<BlackboardArtifact, Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute>, String> getMedExtractor() {
130  return medExtractor;
131  }
132 
133  @Override
134  public BiFunction<BlackboardArtifact, Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute>, String> getShortExtractor() {
135  return shortExtractor;
136  }
137 
138  private final String displayName;
139 
140  BlackboardArtifact.ARTIFACT_TYPE artifactType;
141 
142  @Override
143  public String getIconBase() {
144  return iconBase;
145  }
146 
147  @Override
148  public BlackboardArtifact.ARTIFACT_TYPE getArtifactType() {
149  return artifactType;
150  }
151 
152  private WebTypes(String displayName, String iconBase, BlackboardArtifact.ARTIFACT_TYPE artifactType,
153  BlackboardAttribute.ATTRIBUTE_TYPE dateTimeAttributeType,
154  BiFunction<BlackboardArtifact, Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute>, String> shortExtractor,
155  BiFunction<BlackboardArtifact, Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute>, String> medExtractor,
156  BiFunction<BlackboardArtifact, Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute>, String> longExtractor) {
157  this.displayName = displayName;
158  this.iconBase = iconBase;
159  this.artifactType = artifactType;
160  this.dateTimeAttributeType = dateTimeAttributeType;
161  this.shortExtractor = shortExtractor;
162  this.medExtractor = medExtractor;
163  this.longExtractor = longExtractor;
164  this.image = new Image("org/sleuthkit/autopsy/timeline/images/" + iconBase, true); // NON-NLS
165  }
166 
167  @Override
168  public EventType getSuperType() {
169  return BaseTypes.WEB_ACTIVITY;
170  }
171 
172  @Override
173  public String getDisplayName() {
174  return displayName;
175  }
176 
177  @Override
178  public EventType getSubType(String string) {
179  return WebTypes.valueOf(string);
180  }
181 
182  @Override
183  public List<? extends EventType> getSubTypes() {
184  return Collections.emptyList();
185  }
186 
187 }
BlackboardArtifact.ARTIFACT_TYPE artifactType
Definition: WebTypes.java:140
final BiFunction< BlackboardArtifact, Map< BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute >, String > longExtractor
Definition: WebTypes.java:117
BiFunction< BlackboardArtifact, Map< BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute >, String > getFullExtractor()
Definition: WebTypes.java:124
final BlackboardAttribute.ATTRIBUTE_TYPE dateTimeAttributeType
Definition: WebTypes.java:96
BlackboardAttribute.ATTRIBUTE_TYPE getDateTimeAttrubuteType()
Definition: WebTypes.java:108
BiFunction< BlackboardArtifact, Map< BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute >, String > getMedExtractor()
Definition: WebTypes.java:129
BiFunction< BlackboardArtifact, Map< BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute >, String > getShortExtractor()
Definition: WebTypes.java:134
final BiFunction< BlackboardArtifact, Map< BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute >, String > medExtractor
Definition: WebTypes.java:119
WebTypes(String displayName, String iconBase, BlackboardArtifact.ARTIFACT_TYPE artifactType, BlackboardAttribute.ATTRIBUTE_TYPE dateTimeAttributeType, BiFunction< BlackboardArtifact, Map< BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute >, String > shortExtractor, BiFunction< BlackboardArtifact, Map< BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute >, String > medExtractor, BiFunction< BlackboardArtifact, Map< BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute >, String > longExtractor)
Definition: WebTypes.java:152
final BiFunction< BlackboardArtifact, Map< BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute >, String > shortExtractor
Definition: WebTypes.java:121
BlackboardArtifact.ARTIFACT_TYPE getArtifactType()
Definition: WebTypes.java:148

Copyright © 2012-2015 Basis Technology. Generated on: Mon Oct 19 2015
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.