mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 01:07:42 +00:00
refactoring
This commit is contained in:
parent
f2175a3f6d
commit
2a43a2a859
@ -1,159 +0,0 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2019 - 2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.datasourcesummary.datamodel;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.datasourcesummary.datamodel.DataSourceInfoUtilities.ResultSetHandler;
|
||||
import org.sleuthkit.datamodel.DataSource;
|
||||
import org.sleuthkit.datamodel.TskData;
|
||||
|
||||
/**
|
||||
* Provides information for the DataSourceSummaryCountsPanel.
|
||||
*/
|
||||
public class DataSourceTypesSummary {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(DataSourceTypesSummary.class.getName());
|
||||
|
||||
/**
|
||||
* Get count of regular files (not directories) in a data source.
|
||||
*
|
||||
* @param currentDataSource The data source.
|
||||
*
|
||||
* @return The count.
|
||||
*/
|
||||
public static Long getCountOfFiles(DataSource currentDataSource) {
|
||||
return DataSourceInfoUtilities.getCountOfRegularFiles(currentDataSource,
|
||||
null,
|
||||
"Unable to get count of files, providing empty results");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count of allocated files in a data source.
|
||||
*
|
||||
* @param currentDataSource The data source.
|
||||
*
|
||||
* @return The count.
|
||||
*/
|
||||
public static Long getCountOfAllocatedFiles(DataSource currentDataSource) {
|
||||
return DataSourceInfoUtilities.getCountOfRegNonSlackFiles(currentDataSource,
|
||||
DataSourceInfoUtilities.getMetaFlagsContainsStatement(TskData.TSK_FS_META_FLAG_ENUM.ALLOC),
|
||||
"Unable to get counts of unallocated files for datasource, providing empty results");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count of unallocated files in a data source.
|
||||
*
|
||||
* @param currentDataSource The data source.
|
||||
*
|
||||
* @return The count.
|
||||
*/
|
||||
public static Long getCountOfUnallocatedFiles(DataSource currentDataSource) {
|
||||
return DataSourceInfoUtilities.getCountOfRegNonSlackFiles(currentDataSource,
|
||||
DataSourceInfoUtilities.getMetaFlagsContainsStatement(TskData.TSK_FS_META_FLAG_ENUM.UNALLOC),
|
||||
"Unable to get counts of unallocated files for datasource, providing empty results");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count of directories in a data source.
|
||||
*
|
||||
* @param currentDataSource The data source.
|
||||
*
|
||||
* @return The count.
|
||||
*/
|
||||
public static Long getCountOfDirectories(DataSource currentDataSource) {
|
||||
return DataSourceInfoUtilities.getCountOfTskFiles(currentDataSource,
|
||||
"meta_type=" + TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_DIR.getValue()
|
||||
+ " AND type<>" + TskData.TSK_DB_FILES_TYPE_ENUM.VIRTUAL_DIR.getFileType(),
|
||||
"Unable to get count of directories for datasource, providing empty results");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count of slack files in a data source.
|
||||
*
|
||||
* @param currentDataSource The data source.
|
||||
*
|
||||
* @return The count.
|
||||
*/
|
||||
public static Long getCountOfSlackFiles(DataSource currentDataSource) {
|
||||
return DataSourceInfoUtilities.getCountOfRegularFiles(currentDataSource,
|
||||
"type=" + TskData.TSK_DB_FILES_TYPE_ENUM.SLACK.getFileType(),
|
||||
"Unable to get count of slack files for datasources, providing empty results");
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves counts for each artifact type in a data source.
|
||||
*
|
||||
* @param selectedDataSource The data source.
|
||||
*
|
||||
* @return A mapping of artifact type name to the counts or null if there
|
||||
* was an error executing the query.
|
||||
*/
|
||||
public static Map<String, Long> getCountsOfArtifactsByType(DataSource selectedDataSource) {
|
||||
if (selectedDataSource == null) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
final String nameParam = "name";
|
||||
final String valueParam = "value";
|
||||
String query
|
||||
= "SELECT bbt.display_name AS " + nameParam + ", COUNT(*) AS " + valueParam
|
||||
+ " FROM blackboard_artifacts bba "
|
||||
+ " INNER JOIN blackboard_artifact_types bbt ON bba.artifact_type_id = bbt.artifact_type_id"
|
||||
+ " WHERE bba.data_source_obj_id =" + selectedDataSource.getId()
|
||||
+ " GROUP BY bbt.display_name";
|
||||
|
||||
String errorMessage = "Unable to get artifact type counts; returning null.";
|
||||
return DataSourceInfoUtilities.getBaseQueryResult(query,
|
||||
getStringLongResultSetHandler(nameParam, valueParam),
|
||||
errorMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a result set handler that will return a map of string to long.
|
||||
*
|
||||
* @param keyParam The named parameter in the result set representing the
|
||||
* key.
|
||||
* @param valueParam The named parameter in the result set representing the
|
||||
* value.
|
||||
*
|
||||
* @return The result set handler to generate the map of string to long.
|
||||
*/
|
||||
private static ResultSetHandler<LinkedHashMap<String, Long>> getStringLongResultSetHandler(String keyParam, String valueParam) {
|
||||
return (resultSet) -> {
|
||||
LinkedHashMap<String, Long> toRet = new LinkedHashMap<>();
|
||||
while (resultSet.next()) {
|
||||
try {
|
||||
toRet.put(resultSet.getString(keyParam), resultSet.getLong(valueParam));
|
||||
} catch (SQLException ex) {
|
||||
logger.log(Level.WARNING, "Failed to get a result pair from the result set.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
return toRet;
|
||||
};
|
||||
}
|
||||
|
||||
private DataSourceTypesSummary() {
|
||||
}
|
||||
}
|
@ -30,9 +30,9 @@ import org.sleuthkit.datamodel.TskData;
|
||||
/**
|
||||
* Provides methods to query for data source overview details.
|
||||
*/
|
||||
public class DataSourceDetailsSummary {
|
||||
public class DetailsSummary {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(DataSourceDetailsSummary.class.getName());
|
||||
private static final Logger logger = Logger.getLogger(DetailsSummary.class.getName());
|
||||
|
||||
/**
|
||||
* Gets the size of unallocated files in a particular datasource.
|
||||
@ -124,27 +124,23 @@ public class DataSourceDetailsSummary {
|
||||
* @return The concatenated string or null if the query could not be
|
||||
* executed.
|
||||
*/
|
||||
private static String getConcattedStringsResult(String query, String valueParam, String separator, String errorMessage, String singleErrorMessage) {
|
||||
private static String getConcattedStringsResult(String query, String valueParam, String separator) {
|
||||
DataSourceInfoUtilities.ResultSetHandler<String> handler = (resultSet) -> {
|
||||
String toRet = "";
|
||||
boolean first = true;
|
||||
while (resultSet.next()) {
|
||||
try {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
toRet += separator;
|
||||
}
|
||||
toRet += resultSet.getString(valueParam);
|
||||
} catch (SQLException ex) {
|
||||
logger.log(Level.WARNING, singleErrorMessage, ex);
|
||||
}
|
||||
}
|
||||
|
||||
return toRet;
|
||||
};
|
||||
|
||||
return getBaseQueryResult(query, handler, errorMessage);
|
||||
return DataSourceInfoUtilities.getBaseQueryResult(provider.get(), query, handler);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -158,7 +154,7 @@ public class DataSourceDetailsSummary {
|
||||
* @return The concatenated value or null if the query could not be
|
||||
* executed.
|
||||
*/
|
||||
private static String getConcattedAttrValue(long dataSourceId, int artifactTypeId, int attributeTypeId) {
|
||||
private String getConcattedAttrValue(long dataSourceId, int artifactTypeId, int attributeTypeId) {
|
||||
final String valueParam = "concatted_attribute_value";
|
||||
String query = "SELECT attr.value_text AS " + valueParam
|
||||
+ " FROM blackboard_artifacts bba "
|
||||
@ -167,12 +163,7 @@ public class DataSourceDetailsSummary {
|
||||
+ " AND bba.artifact_type_id = " + artifactTypeId
|
||||
+ " AND attr.attribute_type_id = " + attributeTypeId;
|
||||
|
||||
String errorMessage = "Unable to execute query to retrieve concatted attribute values.";
|
||||
String singleErrorMessage = "There was an error retrieving one of the results. That result will be omitted from concatted value.";
|
||||
String separator = ", ";
|
||||
return getConcattedStringsResult(query, valueParam, separator, errorMessage, singleErrorMessage);
|
||||
}
|
||||
|
||||
private DataSourceDetailsSummary() {
|
||||
return getConcattedStringsResult(query, valueParam, separator);
|
||||
}
|
||||
}
|
@ -18,15 +18,40 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.datasourcesummary.datamodel;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.sleuthkit.datamodel.DataSource;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
/**
|
||||
* Provides methods to query for datasource files by mime type.
|
||||
*/
|
||||
public class DataSourceMimeTypeSummary {
|
||||
public class MimeTypeSummary implements DataSourceSummaryDataModel {
|
||||
|
||||
private final SleuthkitCaseProvider provider;
|
||||
|
||||
/**
|
||||
* Main constructor.
|
||||
*/
|
||||
public MimeTypeSummary() {
|
||||
this(SleuthkitCaseProvider.DEFAULT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Main constructor.
|
||||
*
|
||||
* @param provider The means of obtaining a sleuthkit case.
|
||||
*/
|
||||
public MimeTypeSummary(SleuthkitCaseProvider provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRefreshOnNewContent() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of files in the case database for the current data source
|
||||
@ -41,11 +66,19 @@ public class DataSourceMimeTypeSummary {
|
||||
* @return a Long value which represents the number of occurrences of the
|
||||
* specified mime types in the current case for the specified data
|
||||
* source, null if no count was retrieved
|
||||
*
|
||||
* @throws SleuthkitCaseProviderException
|
||||
* @throws TskCoreException
|
||||
* @throws SQLException
|
||||
*/
|
||||
public static Long getCountOfFilesForMimeTypes(DataSource currentDataSource, Set<String> setOfMimeTypes) {
|
||||
return DataSourceInfoUtilities.getCountOfRegNonSlackFiles(currentDataSource,
|
||||
"mime_type IN " + getSqlSet(setOfMimeTypes),
|
||||
"Unable to get count of files for specified mime types");
|
||||
public Long getCountOfFilesForMimeTypes(DataSource currentDataSource, Set<String> setOfMimeTypes)
|
||||
throws SleuthkitCaseProvider.SleuthkitCaseProviderException, TskCoreException, SQLException {
|
||||
|
||||
return DataSourceInfoUtilities.getCountOfRegNonSlackFiles(
|
||||
provider.get(),
|
||||
currentDataSource,
|
||||
"mime_type IN " + getSqlSet(setOfMimeTypes)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,23 +92,37 @@ public class DataSourceMimeTypeSummary {
|
||||
*
|
||||
* @return a Long value which represents the number of files that do not
|
||||
* have the specific mime type, but do have a mime type.
|
||||
*
|
||||
* @throws SleuthkitCaseProviderException
|
||||
* @throws TskCoreException
|
||||
* @throws SQLException
|
||||
*/
|
||||
public static Long getCountOfFilesNotInMimeTypes(DataSource currentDataSource, Set<String> setOfMimeTypes) {
|
||||
return DataSourceInfoUtilities.getCountOfRegNonSlackFiles(currentDataSource,
|
||||
"mime_type NOT IN " + getSqlSet(setOfMimeTypes)
|
||||
+ " AND mime_type IS NOT NULL AND mime_type <> '' ",
|
||||
"Unable to get count of files without specified mime types");
|
||||
}
|
||||
public Long getCountOfFilesNotInMimeTypes(DataSource currentDataSource, Set<String> setOfMimeTypes)
|
||||
throws SleuthkitCaseProvider.SleuthkitCaseProviderException, TskCoreException, SQLException {
|
||||
|
||||
return DataSourceInfoUtilities.getCountOfRegNonSlackFiles(
|
||||
provider.get(),
|
||||
currentDataSource,
|
||||
"mime_type NOT IN " + getSqlSet(setOfMimeTypes)
|
||||
+ " AND mime_type IS NOT NULL AND mime_type <> '' "
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a count of all regular files in a datasource.
|
||||
*
|
||||
* @param dataSource The datasource.
|
||||
*
|
||||
* @return The count of regular files.
|
||||
*
|
||||
* @throws SleuthkitCaseProviderException
|
||||
* @throws TskCoreException
|
||||
* @throws SQLException
|
||||
*/
|
||||
public static Long getCountOfAllRegularFiles(DataSource dataSource) {
|
||||
return DataSourceInfoUtilities.getCountOfRegNonSlackFiles(dataSource, null,
|
||||
"Unable to get count of all regular files");
|
||||
public Long getCountOfAllRegularFiles(DataSource dataSource)
|
||||
throws SleuthkitCaseProvider.SleuthkitCaseProviderException, TskCoreException, SQLException {
|
||||
|
||||
return DataSourceInfoUtilities.getCountOfRegNonSlackFiles(provider.get(), dataSource, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -86,11 +133,18 @@ public class DataSourceMimeTypeSummary {
|
||||
* @return The number of files with no mime type or null if there is an
|
||||
* issue searching the data source.
|
||||
*
|
||||
* @throws SleuthkitCaseProviderException
|
||||
* @throws TskCoreException
|
||||
* @throws SQLException
|
||||
*/
|
||||
public static Long getCountOfFilesWithNoMimeType(DataSource currentDataSource) {
|
||||
return DataSourceInfoUtilities.getCountOfRegNonSlackFiles(currentDataSource,
|
||||
"(mime_type IS NULL OR mime_type = '') ",
|
||||
"Unable to get count of files without a mime type");
|
||||
public Long getCountOfFilesWithNoMimeType(DataSource currentDataSource)
|
||||
throws SleuthkitCaseProvider.SleuthkitCaseProviderException, TskCoreException, SQLException {
|
||||
|
||||
return DataSourceInfoUtilities.getCountOfRegNonSlackFiles(
|
||||
provider.get(),
|
||||
currentDataSource,
|
||||
"(mime_type IS NULL OR mime_type = '') "
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -103,7 +157,7 @@ public class DataSourceMimeTypeSummary {
|
||||
*
|
||||
* @return The sql set string.
|
||||
*/
|
||||
private static String getSqlSet(Set<String> setValues) {
|
||||
private String getSqlSet(Set<String> setValues) {
|
||||
List<String> quotedValues = setValues
|
||||
.stream()
|
||||
.map(str -> String.format("'%s'", str.replace("'", "")))
|
||||
@ -112,7 +166,4 @@ public class DataSourceMimeTypeSummary {
|
||||
String commaSeparatedQuoted = String.join(", ", quotedValues);
|
||||
return String.format("(%s) ", commaSeparatedQuoted);
|
||||
}
|
||||
|
||||
private DataSourceMimeTypeSummary() {
|
||||
}
|
||||
}
|
@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2019 - 2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.datasourcesummary.datamodel;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import org.sleuthkit.autopsy.datasourcesummary.datamodel.SleuthkitCaseProvider.SleuthkitCaseProviderException;
|
||||
import org.sleuthkit.datamodel.DataSource;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.datamodel.TskData;
|
||||
|
||||
/**
|
||||
* Provides information for the DataSourceSummaryCountsPanel.
|
||||
*/
|
||||
public class TypesSummary implements DataSourceSummaryDataModel {
|
||||
|
||||
private final SleuthkitCaseProvider provider;
|
||||
|
||||
/**
|
||||
* Main constructor.
|
||||
*/
|
||||
public TypesSummary() {
|
||||
this(SleuthkitCaseProvider.DEFAULT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Main constructor.
|
||||
*
|
||||
* @param provider The means of obtaining a sleuthkit case.
|
||||
*/
|
||||
public TypesSummary(SleuthkitCaseProvider provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRefreshOnNewContent() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count of regular files (not directories) in a data source.
|
||||
*
|
||||
* @param currentDataSource The data source.
|
||||
*
|
||||
* @return The count.
|
||||
*
|
||||
* @throws SleuthkitCaseProviderException
|
||||
* @throws TskCoreException
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Long getCountOfFiles(DataSource currentDataSource)
|
||||
throws SleuthkitCaseProvider.SleuthkitCaseProviderException, TskCoreException, SQLException {
|
||||
return DataSourceInfoUtilities.getCountOfRegularFiles(
|
||||
provider.get(),
|
||||
currentDataSource,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count of allocated files in a data source.
|
||||
*
|
||||
* @param currentDataSource The data source.
|
||||
*
|
||||
* @return The count.
|
||||
*
|
||||
* @throws SleuthkitCaseProviderException
|
||||
* @throws TskCoreException
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Long getCountOfAllocatedFiles(DataSource currentDataSource)
|
||||
throws SleuthkitCaseProvider.SleuthkitCaseProviderException, TskCoreException, SQLException {
|
||||
|
||||
return DataSourceInfoUtilities.getCountOfRegNonSlackFiles(provider.get(), currentDataSource,
|
||||
DataSourceInfoUtilities.getMetaFlagsContainsStatement(TskData.TSK_FS_META_FLAG_ENUM.ALLOC));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count of unallocated files in a data source.
|
||||
*
|
||||
* @param currentDataSource The data source.
|
||||
*
|
||||
* @return The count.
|
||||
*
|
||||
* @throws SleuthkitCaseProviderException
|
||||
* @throws TskCoreException
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Long getCountOfUnallocatedFiles(DataSource currentDataSource)
|
||||
throws SleuthkitCaseProvider.SleuthkitCaseProviderException, TskCoreException, SQLException {
|
||||
|
||||
return DataSourceInfoUtilities.getCountOfRegNonSlackFiles(provider.get(), currentDataSource,
|
||||
DataSourceInfoUtilities.getMetaFlagsContainsStatement(TskData.TSK_FS_META_FLAG_ENUM.UNALLOC));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count of directories in a data source.
|
||||
*
|
||||
* @param currentDataSource The data source.
|
||||
*
|
||||
* @return The count.
|
||||
*
|
||||
* @throws SleuthkitCaseProviderException
|
||||
* @throws TskCoreException
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Long getCountOfDirectories(DataSource currentDataSource)
|
||||
throws SleuthkitCaseProvider.SleuthkitCaseProviderException, TskCoreException, SQLException {
|
||||
|
||||
return DataSourceInfoUtilities.getCountOfTskFiles(provider.get(), currentDataSource,
|
||||
"meta_type=" + TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_DIR.getValue()
|
||||
+ " AND type<>" + TskData.TSK_DB_FILES_TYPE_ENUM.VIRTUAL_DIR.getFileType());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count of slack files in a data source.
|
||||
*
|
||||
* @param currentDataSource The data source.
|
||||
*
|
||||
* @return The count.
|
||||
*
|
||||
* @throws SleuthkitCaseProviderException
|
||||
* @throws TskCoreException
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Long getCountOfSlackFiles(DataSource currentDataSource)
|
||||
throws SleuthkitCaseProvider.SleuthkitCaseProviderException, TskCoreException, SQLException {
|
||||
|
||||
return DataSourceInfoUtilities.getCountOfRegularFiles(provider.get(), currentDataSource,
|
||||
"type=" + TskData.TSK_DB_FILES_TYPE_ENUM.SLACK.getFileType());
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.datasourcesummary.datamodel.DataSourceDetailsSummary;
|
||||
import org.sleuthkit.autopsy.datasourcesummary.datamodel.DetailsSummary;
|
||||
import org.sleuthkit.datamodel.DataSource;
|
||||
import org.sleuthkit.datamodel.Image;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
@ -53,9 +53,9 @@ class DataSourceSummaryDetailsPanel extends BaseDataSourceSummaryPanel {
|
||||
updateDetailsPanelData(null, null, null, null);
|
||||
} else {
|
||||
updateDetailsPanelData(dataSource,
|
||||
DataSourceDetailsSummary.getSizeOfUnallocatedFiles(dataSource),
|
||||
DataSourceDetailsSummary.getOperatingSystems(dataSource),
|
||||
DataSourceDetailsSummary.getDataSourceType(dataSource));
|
||||
DetailsSummary.getSizeOfUnallocatedFiles(dataSource),
|
||||
DetailsSummary.getOperatingSystems(dataSource),
|
||||
DetailsSummary.getDataSourceType(dataSource));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,9 +31,9 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.coreutils.FileTypeUtils.FileTypeCategory;
|
||||
import org.sleuthkit.autopsy.datasourcesummary.datamodel.DataSourceTypesSummary;
|
||||
import org.sleuthkit.autopsy.datasourcesummary.datamodel.DataSourceDetailsSummary;
|
||||
import org.sleuthkit.autopsy.datasourcesummary.datamodel.DataSourceMimeTypeSummary;
|
||||
import org.sleuthkit.autopsy.datasourcesummary.datamodel.TypesSummary;
|
||||
import org.sleuthkit.autopsy.datasourcesummary.datamodel.DetailsSummary;
|
||||
import org.sleuthkit.autopsy.datasourcesummary.datamodel.MimeTypeSummary;
|
||||
import org.sleuthkit.autopsy.datasourcesummary.uiutils.AbstractLoadableComponent;
|
||||
import org.sleuthkit.autopsy.datasourcesummary.uiutils.DataFetchResult;
|
||||
import org.sleuthkit.autopsy.datasourcesummary.uiutils.DataFetchWorker;
|
||||
@ -149,11 +149,11 @@ class TypesPanel extends BaseDataSourceSummaryPanel {
|
||||
// all of the means for obtaining data for the gui components.
|
||||
private final List<DataFetchComponents<DataSource, ?>> dataFetchComponents = Arrays.asList(// usage label worker
|
||||
new DataFetchWorker.DataFetchComponents<>(
|
||||
DataSourceDetailsSummary::getDataSourceType,
|
||||
DetailsSummary::getDataSourceType,
|
||||
usageLabel::showDataFetchResult),
|
||||
// os label worker
|
||||
new DataFetchWorker.DataFetchComponents<>(
|
||||
DataSourceDetailsSummary::getOperatingSystems,
|
||||
DetailsSummary::getOperatingSystems,
|
||||
osLabel::showDataFetchResult),
|
||||
// size label worker
|
||||
new DataFetchWorker.DataFetchComponents<>(
|
||||
@ -168,19 +168,19 @@ class TypesPanel extends BaseDataSourceSummaryPanel {
|
||||
fileMimeTypesChart::showDataFetchResult),
|
||||
// allocated files worker
|
||||
new DataFetchWorker.DataFetchComponents<>(
|
||||
(dataSource) -> getStringOrZero(DataSourceTypesSummary.getCountOfAllocatedFiles(dataSource)),
|
||||
(dataSource) -> getStringOrZero(TypesSummary.getCountOfAllocatedFiles(dataSource)),
|
||||
allocatedLabel::showDataFetchResult),
|
||||
// unallocated files worker
|
||||
new DataFetchWorker.DataFetchComponents<>(
|
||||
(dataSource) -> getStringOrZero(DataSourceTypesSummary.getCountOfUnallocatedFiles(dataSource)),
|
||||
(dataSource) -> getStringOrZero(TypesSummary.getCountOfUnallocatedFiles(dataSource)),
|
||||
unallocatedLabel::showDataFetchResult),
|
||||
// slack files worker
|
||||
new DataFetchWorker.DataFetchComponents<>(
|
||||
(dataSource) -> getStringOrZero(DataSourceTypesSummary.getCountOfSlackFiles(dataSource)),
|
||||
(dataSource) -> getStringOrZero(TypesSummary.getCountOfSlackFiles(dataSource)),
|
||||
slackLabel::showDataFetchResult),
|
||||
// directories worker
|
||||
new DataFetchWorker.DataFetchComponents<>(
|
||||
(dataSource) -> getStringOrZero(DataSourceTypesSummary.getCountOfDirectories(dataSource)),
|
||||
(dataSource) -> getStringOrZero(TypesSummary.getCountOfDirectories(dataSource)),
|
||||
directoriesLabel::showDataFetchResult)
|
||||
);
|
||||
|
||||
@ -209,20 +209,20 @@ class TypesPanel extends BaseDataSourceSummaryPanel {
|
||||
.stream()
|
||||
.map((strCat) -> {
|
||||
return Pair.of(strCat.getLeft(),
|
||||
getLongOrZero(DataSourceMimeTypeSummary.getCountOfFilesForMimeTypes(
|
||||
getLongOrZero(MimeTypeSummary.getCountOfFilesForMimeTypes(
|
||||
dataSource, strCat.getRight())));
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// get a count of all files with no mime type
|
||||
Long noMimeTypeCount = getLongOrZero(DataSourceMimeTypeSummary.getCountOfFilesWithNoMimeType(dataSource));
|
||||
Long noMimeTypeCount = getLongOrZero(MimeTypeSummary.getCountOfFilesWithNoMimeType(dataSource));
|
||||
|
||||
// get the sum of all counts for the known categories
|
||||
Long categoryTotalCount = getLongOrZero(fileCategoryItems.stream()
|
||||
.collect(Collectors.summingLong((pair) -> pair.getValue())));
|
||||
|
||||
// get a count of all regular files
|
||||
Long allRegularFiles = getLongOrZero(DataSourceMimeTypeSummary.getCountOfAllRegularFiles(dataSource));
|
||||
Long allRegularFiles = getLongOrZero(MimeTypeSummary.getCountOfAllRegularFiles(dataSource));
|
||||
|
||||
// create entry for mime types in other category
|
||||
fileCategoryItems.add(Pair.of(Bundle.TypesPanel_fileMimeTypesChart_other_title(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user