Autopsy  4.18.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
EventTypeUtils.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2018 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.ui;
20 
21 import java.util.ArrayList;
22 import java.util.HashMap;
23 import java.util.Map;
24 import javafx.scene.image.Image;
25 import javafx.scene.paint.Color;
26 import org.sleuthkit.datamodel.TimelineEventType;
27 
32 final public class EventTypeUtils {
33 
34  static final private String IMAGE_BASE_PATH = "org/sleuthkit/autopsy/timeline/images/";
35  static private final Map<TimelineEventType, Image> imageMap = new HashMap<>();
36 
37  public static Image getImage(TimelineEventType type) {
38  return imageMap.computeIfAbsent(type, type2 -> new Image(getImagePath(type2)));
39  }
40 
41  public static String getImagePath(TimelineEventType type) {
42  long typeID = type.getTypeID();
43  String imageFileName;
44  if (typeID == TimelineEventType.FILE_SYSTEM.getTypeID()) {
45  imageFileName = "blue-document.png";
46  } else if (typeID == TimelineEventType.MISC_TYPES.getTypeID()) {
47  imageFileName = "block.png";
48  } else if (typeID == TimelineEventType.WEB_ACTIVITY.getTypeID()) {
49  imageFileName = "web-file.png";
50  } else if (typeID == TimelineEventType.MISC_TYPES.getTypeID()) {
51  imageFileName = "block.png";
52  } else if (typeID == TimelineEventType.FILE_ACCESSED.getTypeID()) {
53  imageFileName = "blue-document-attribute-a.png";
54  } else if (typeID == TimelineEventType.FILE_CHANGED.getTypeID()) {
55  imageFileName = "blue-document-attribute-c.png";
56  } else if (typeID == TimelineEventType.FILE_MODIFIED.getTypeID()) {
57  imageFileName = "blue-document-attribute-m.png";
58  } else if (typeID == TimelineEventType.FILE_CREATED.getTypeID()) {
59  imageFileName = "blue-document-attribute-b.png";
60  } else if (typeID == TimelineEventType.WEB_DOWNLOADS.getTypeID()) {
61  imageFileName = "downloads.png";
62  } else if (typeID == TimelineEventType.WEB_COOKIE.getTypeID()) {
63  imageFileName = "cookies.png";
64  } else if (typeID == TimelineEventType.WEB_BOOKMARK.getTypeID()) {
65  imageFileName = "bookmarks.png";
66  } else if (typeID == TimelineEventType.WEB_HISTORY.getTypeID()) {
67  imageFileName = "history.png";
68  } else if (typeID == TimelineEventType.WEB_SEARCH.getTypeID()) {
69  imageFileName = "searchquery.png";
70  } else if (typeID == TimelineEventType.CALL_LOG.getTypeID()) {
71  imageFileName = "calllog.png";
72  } else if (typeID == TimelineEventType.DEVICES_ATTACHED.getTypeID()) {
73  imageFileName = "usb_devices.png";
74  } else if (typeID == TimelineEventType.EMAIL.getTypeID()) {
75  imageFileName = "mail-icon-16.png";
76  } else if (typeID == TimelineEventType.EXIF.getTypeID()) {
77  imageFileName = "camera-icon-16.png";
78  } else if (typeID == TimelineEventType.GPS_ROUTE.getTypeID()) {
79  imageFileName = "gps-search.png";
80  } else if (typeID == TimelineEventType.GPS_TRACKPOINT.getTypeID()) {
81  imageFileName = "gps-trackpoint.png";
82  } else if (typeID == TimelineEventType.INSTALLED_PROGRAM.getTypeID()) {
83  imageFileName = "programs.png";
84  } else if (typeID == TimelineEventType.MESSAGE.getTypeID()) {
85  imageFileName = "message.png";
86  } else if (typeID == TimelineEventType.RECENT_DOCUMENTS.getTypeID()) {
87  imageFileName = "recent_docs.png";
88  } else if (typeID == TimelineEventType.REGISTRY.getTypeID()) {
89  imageFileName = "registry.png";
90  } else if (typeID == TimelineEventType.LOG_ENTRY.getTypeID()) {
91  imageFileName = "raw_access_logs.png";
92  } else if (typeID == TimelineEventType.USER_CREATED.getTypeID()) {
93  imageFileName = "hand_point.png";
94  } else if (typeID == TimelineEventType.WEB_FORM_AUTOFILL.getTypeID()) {
95  imageFileName = "artifact-icon.png";
96  } else if (typeID == TimelineEventType.WEB_FORM_ADDRESSES.getTypeID()) {
97  imageFileName = "artifact-icon.png";
98  } else if (typeID == TimelineEventType.METADATA_CREATED.getTypeID()) {
99  imageFileName = "blue-document-attribute-b.png";
100  } else if (typeID == TimelineEventType.METADATA_LAST_SAVED.getTypeID()) {
101  imageFileName = "blue-document-attribute-m.png";
102  } else if (typeID == TimelineEventType.METADATA_LAST_PRINTED.getTypeID()) {
103  imageFileName = "blue-document.png";
104  }else {
105  imageFileName = "timeline_marker.png";
106  }
107 
108  return IMAGE_BASE_PATH + imageFileName;
109  }
110 
111  public static Color getColor(TimelineEventType type) {
112  if (type.equals(TimelineEventType.ROOT_EVENT_TYPE)) {
113  return Color.hsb(359, .9, .9, 0);
114  }
115 
116  TimelineEventType superType = type.getParent();
117 
118  Color baseColor = getColor(superType);
119  int siblings = superType.getSiblings().stream()
120  .max((type1, type2) -> Integer.compare(type1.getChildren().size(), type2.getChildren().size()))
121  .get().getChildren().size() + 1;
122  int superSiblingsCount = superType.getSiblings().size();
123 
124  int ordinal = new ArrayList<>(type.getSiblings()).indexOf(type);
125  double offset = (360.0 / superSiblingsCount) / siblings;
126  Color deriveColor = baseColor.deriveColor(ordinal * offset, 1, 1, 1);
127 
128  return Color.hsb(deriveColor.getHue(), deriveColor.getSaturation(), deriveColor.getBrightness());
129  }
130 
131  private EventTypeUtils() {
132  }
133 }
static Image getImage(TimelineEventType type)
static String getImagePath(TimelineEventType type)
static Color getColor(TimelineEventType type)
static final Map< TimelineEventType, Image > imageMap

Copyright © 2012-2021 Basis Technology. Generated on: Thu Jul 8 2021
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.