Autopsy  4.19.3
Graphical digital forensics platform for The Sleuth Kit and other tools.
FileReportDataTypes.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2013 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.report.infrastructure;
20 
21 import org.openide.util.NbBundle;
22 import org.sleuthkit.datamodel.AbstractFile;
23 import org.sleuthkit.datamodel.TskCoreException;
24 import org.sleuthkit.datamodel.TskData;
25 
33 public enum FileReportDataTypes {
34 
35  NAME(NbBundle.getMessage(FileReportDataTypes.class, "FileReportDataTypes.filename.text")) {
36  @Override
37  public String getValue(AbstractFile file) {
38  return file.getName();
39  }
40  },
41  FILE_EXT(NbBundle.getMessage(FileReportDataTypes.class, "FileReportDataTypes.fileExt.text")) {
42  @Override
43  public String getValue(AbstractFile file) {
44  String name = file.getName();
45  int extIndex = name.lastIndexOf(".");
46  return (extIndex == -1 ? "" : name.substring(extIndex));
47  }
48  },
49  FILE_TYPE(NbBundle.getMessage(FileReportDataTypes.class, "FileReportDataTypes.fileType.text")) {
50  @Override
51  public String getValue(AbstractFile file) {
52  return file.getMetaTypeAsString();
53  }
54  },
55  DELETED(NbBundle.getMessage(FileReportDataTypes.class, "FileReportDataTypes.isDel.text")) {
56  @Override
57  public String getValue(AbstractFile file) {
58  if (file.getMetaFlagsAsString().equals(TskData.TSK_FS_META_FLAG_ENUM.UNALLOC.toString())) {
59  return "yes"; //NON-NLS
60  }
61  return "";
62  }
63  },
64  A_TIME(NbBundle.getMessage(FileReportDataTypes.class, "FileReportDataTypes.aTime.text")) {
65  @Override
66  public String getValue(AbstractFile file) {
67  return file.getAtimeAsDate();
68  }
69  },
70  CR_TIME(NbBundle.getMessage(FileReportDataTypes.class, "FileReportDataTypes.crTime.text")) {
71  @Override
72  public String getValue(AbstractFile file) {
73  return file.getCrtimeAsDate();
74  }
75  },
76  M_TIME(NbBundle.getMessage(FileReportDataTypes.class, "FileReportDataTypes.mTime.text")) {
77  @Override
78  public String getValue(AbstractFile file) {
79  return file.getMtimeAsDate();
80  }
81  },
82  SIZE(NbBundle.getMessage(FileReportDataTypes.class, "FileReportDataTypes.size.text")) {
83  @Override
84  public String getValue(AbstractFile file) {
85  return String.valueOf(file.getSize());
86  }
87  },
88  ADDRESS(NbBundle.getMessage(FileReportDataTypes.class, "FileReportDataTypes.address.text")) {
89  @Override
90  public String getValue(AbstractFile file) {
91  return String.valueOf(file.getMetaAddr());
92  }
93  },
94  HASH_VALUE(NbBundle.getMessage(FileReportDataTypes.class, "FileReportDataTypes.hash.text")) {
95  @Override
96  public String getValue(AbstractFile file) {
97  return file.getMd5Hash();
98  }
99  },
100  KNOWN_STATUS(NbBundle.getMessage(FileReportDataTypes.class, "FileReportDataTypes.knownStatus.text")) {
101  @Override
102  public String getValue(AbstractFile file) {
103  return file.getKnown().getName();
104  }
105  },
106  PERMISSIONS(NbBundle.getMessage(FileReportDataTypes.class, "FileReportDataTypes.perms.text")) {
107  @Override
108  public String getValue(AbstractFile file) {
109  return file.getModesAsString();
110  }
111  },
112  FULL_PATH(NbBundle.getMessage(FileReportDataTypes.class, "FileReportDataTypes.path.text")) {
113  @Override
114  public String getValue(AbstractFile file) {
115  try {
116  return file.getUniquePath();
117  } catch (TskCoreException ex) {
118  return "";
119  }
120  }
121  };
122 
123  private String name;
124 
125  FileReportDataTypes(String name) {
126  this.name = name;
127  }
128 
129  public String getName() {
130  return this.name;
131  }
132 
138  public abstract String getValue(AbstractFile file);
139 }

Copyright © 2012-2022 Basis Technology. Generated on: Sat Sep 24 2022
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.