Autopsy  4.21.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
TypesSummary.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2019 - 2021 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.datasourcesummary.datamodel;
20 
21 import java.awt.Color;
22 import java.sql.SQLException;
23 import java.util.Set;
25 import org.sleuthkit.datamodel.DataSource;
26 import org.sleuthkit.datamodel.TskCoreException;
27 import org.sleuthkit.datamodel.TskData;
28 
33 public class TypesSummary {
34 
36 
40  public TypesSummary() {
42  }
43 
50  this.provider = provider;
51  }
52 
53 
65  public Long getCountOfFiles(DataSource currentDataSource)
66  throws SleuthkitCaseProvider.SleuthkitCaseProviderException, TskCoreException, SQLException {
67  return DataSourceInfoUtilities.getCountOfRegularFiles(
68  provider.get(),
69  currentDataSource,
70  null
71  );
72  }
73 
85  public Long getCountOfAllocatedFiles(DataSource currentDataSource)
86  throws SleuthkitCaseProvider.SleuthkitCaseProviderException, TskCoreException, SQLException {
87 
88  return DataSourceInfoUtilities.getCountOfRegNonSlackFiles(provider.get(), currentDataSource,
89  DataSourceInfoUtilities.getMetaFlagsContainsStatement(TskData.TSK_FS_META_FLAG_ENUM.ALLOC));
90  }
91 
103  public Long getCountOfUnallocatedFiles(DataSource currentDataSource)
104  throws SleuthkitCaseProvider.SleuthkitCaseProviderException, TskCoreException, SQLException {
105 
106  return DataSourceInfoUtilities.getCountOfRegNonSlackFiles(provider.get(), currentDataSource,
107  DataSourceInfoUtilities.getMetaFlagsContainsStatement(TskData.TSK_FS_META_FLAG_ENUM.UNALLOC));
108  }
109 
121  public Long getCountOfDirectories(DataSource currentDataSource)
122  throws SleuthkitCaseProvider.SleuthkitCaseProviderException, TskCoreException, SQLException {
123 
124  return DataSourceInfoUtilities.getCountOfTskFiles(provider.get(), currentDataSource,
125  "meta_type=" + TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_DIR.getValue()
126  + " AND type<>" + TskData.TSK_DB_FILES_TYPE_ENUM.VIRTUAL_DIR.getFileType());
127  }
128 
140  public Long getCountOfSlackFiles(DataSource currentDataSource)
141  throws SleuthkitCaseProvider.SleuthkitCaseProviderException, TskCoreException, SQLException {
142 
143  return DataSourceInfoUtilities.getCountOfRegularFiles(provider.get(), currentDataSource,
144  "type=" + TskData.TSK_DB_FILES_TYPE_ENUM.SLACK.getFileType());
145  }
146 
150  public static class FileTypeCategoryData {
151 
152  private final String label;
153  private final Set<String> mimeTypes;
154  private final Color color;
155 
163  public FileTypeCategoryData(String label, Set<String> mimeTypes, Color color) {
164  this.label = label;
165  this.mimeTypes = mimeTypes;
166  this.color = color;
167  }
168 
176  public FileTypeCategoryData(String label, FileTypeUtils.FileTypeCategory fileCategory, Color color) {
177  this(label, fileCategory.getMediaTypes(), color);
178  }
179 
183  public String getLabel() {
184  return label;
185  }
186 
190  public Set<String> getMimeTypes() {
191  return mimeTypes;
192  }
193 
197  public Color getColor() {
198  return color;
199  }
200  }
201 }
static Long getCountOfRegNonSlackFiles(SleuthkitCase skCase, DataSource currentDataSource, String additionalWhere)
FileTypeCategoryData(String label, Set< String > mimeTypes, Color color)
FileTypeCategoryData(String label, FileTypeUtils.FileTypeCategory fileCategory, Color color)

Copyright © 2012-2022 Basis Technology. Generated on: Tue Feb 6 2024
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.