mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
views updates
This commit is contained in:
parent
0161d6d373
commit
222e31c4e0
@ -1167,7 +1167,7 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
|
|||||||
|
|
||||||
void displayAnalysisResult(AnalysisResultSearchParam analysisResultParams) {
|
void displayAnalysisResult(AnalysisResultSearchParam analysisResultParams) {
|
||||||
try {
|
try {
|
||||||
this.searchResultManager = new SearchManager(new AnalysisResultFetcher(analysisResultParams), getPageSize());
|
this.searchResultManager = new SearchManager(MainDAO.getInstance().getAnalysisResultDAO().new AnalysisResultFetcher(analysisResultParams), getPageSize());
|
||||||
SearchResultsDTO results = searchResultManager.getResults();
|
SearchResultsDTO results = searchResultManager.getResults();
|
||||||
displaySearchResults(results, true);
|
displaySearchResults(results, true);
|
||||||
} catch (ExecutionException ex) {
|
} catch (ExecutionException ex) {
|
||||||
@ -1268,7 +1268,7 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
|
|||||||
*/
|
*/
|
||||||
void displayAnalysisResultSet(AnalysisResultSetSearchParam setKey) {
|
void displayAnalysisResultSet(AnalysisResultSetSearchParam setKey) {
|
||||||
try {
|
try {
|
||||||
this.searchResultManager = new SearchManager(new AnalysisResultSetFetcher(setKey), getPageSize());
|
this.searchResultManager = new SearchManager(MainDAO.getInstance().getAnalysisResultDAO().new AnalysisResultSetFetcher(setKey), getPageSize());
|
||||||
SearchResultsDTO results = searchResultManager.getResults();
|
SearchResultsDTO results = searchResultManager.getResults();
|
||||||
displaySearchResults(results, true);
|
displaySearchResults(results, true);
|
||||||
} catch (ExecutionException | IllegalArgumentException ex) {
|
} catch (ExecutionException | IllegalArgumentException ex) {
|
||||||
|
@ -722,20 +722,24 @@ public class AnalysisResultDAO extends BlackboardArtifactDAO {
|
|||||||
ModuleDataEvent dataEvt = DAOEventUtils.getModuleDataFromEvt(evt);
|
ModuleDataEvent dataEvt = DAOEventUtils.getModuleDataFromEvt(evt);
|
||||||
if (dataEvt != null) {
|
if (dataEvt != null) {
|
||||||
for (BlackboardArtifact art : dataEvt.getArtifacts()) {
|
for (BlackboardArtifact art : dataEvt.getArtifacts()) {
|
||||||
if (art.getArtifactTypeID() == BlackboardArtifact.Type.TSK_KEYWORD_HIT.getTypeID()) {
|
try {
|
||||||
// GVDTODO
|
if (art.getArtifactTypeID() == BlackboardArtifact.Type.TSK_KEYWORD_HIT.getTypeID()) {
|
||||||
} else if (art.getArtifactTypeID() == BlackboardArtifact.Type.TSK_INTERESTING_FILE_HIT.getTypeID()
|
// GVDTODO
|
||||||
|| art.getArtifactTypeID() == BlackboardArtifact.Type.TSK_INTERESTING_ARTIFACT_HIT.getTypeID()
|
} else if (art.getArtifactTypeID() == BlackboardArtifact.Type.TSK_INTERESTING_FILE_HIT.getTypeID()
|
||||||
|| art.getArtifactTypeID() == BlackboardArtifact.Type.TSK_HASHSET_HIT.getTypeID()) {
|
|| art.getArtifactTypeID() == BlackboardArtifact.Type.TSK_INTERESTING_ARTIFACT_HIT.getTypeID()
|
||||||
|
|| art.getArtifactTypeID() == BlackboardArtifact.Type.TSK_HASHSET_HIT.getTypeID()) {
|
||||||
|
|
||||||
BlackboardAttribute setAttr = art.getAttribute(BlackboardAttribute.Type.TSK_SET_NAME);
|
BlackboardAttribute setAttr = art.getAttribute(BlackboardAttribute.Type.TSK_SET_NAME);
|
||||||
String setName = setAttr == null ? null : setAttr.getValueString();
|
String setName = setAttr == null ? null : setAttr.getValueString();
|
||||||
setMap.computeIfAbsent(Pair.of(art.getArtifactTypeID(), setName), (k) -> new HashSet<>())
|
setMap.computeIfAbsent(Pair.of(art.getArtifactTypeID(), setName), (k) -> new HashSet<>())
|
||||||
.add(art.getDataSourceObjectID());
|
.add(art.getDataSourceObjectID());
|
||||||
|
|
||||||
} else if (BlackboardArtifact.Category.DATA_ARTIFACT.equals(art.getType().getCategory())) {
|
} else if (BlackboardArtifact.Category.DATA_ARTIFACT.equals(art.getType().getCategory())) {
|
||||||
analysisResultMap.computeIfAbsent(art.getArtifactTypeID(), (k) -> new HashSet<>())
|
analysisResultMap.computeIfAbsent(art.getArtifactTypeID(), (k) -> new HashSet<>())
|
||||||
.add(art.getDataSourceObjectID());
|
.add(art.getDataSourceObjectID());
|
||||||
|
}
|
||||||
|
} catch (TskCoreException ex) {
|
||||||
|
logger.log(Level.WARNING, "Unable to fetch necessary information for artifact id: " + art.getId(), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import java.beans.PropertyChangeEvent;
|
|||||||
import org.sleuthkit.autopsy.ingest.IngestManager;
|
import org.sleuthkit.autopsy.ingest.IngestManager;
|
||||||
import org.sleuthkit.autopsy.ingest.ModuleContentEvent;
|
import org.sleuthkit.autopsy.ingest.ModuleContentEvent;
|
||||||
import org.sleuthkit.autopsy.ingest.ModuleDataEvent;
|
import org.sleuthkit.autopsy.ingest.ModuleDataEvent;
|
||||||
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
import org.sleuthkit.datamodel.Content;
|
import org.sleuthkit.datamodel.Content;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,6 +56,13 @@ public class DAOEventUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static AbstractFile getFileFromEvt(PropertyChangeEvent evt) {
|
||||||
|
Content content = getContentFromEvt(evt);
|
||||||
|
return (content instanceof AbstractFile)
|
||||||
|
? ((AbstractFile) content)
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the ModuleDataEvent in the event if there is a child
|
* Returns the ModuleDataEvent in the event if there is a child
|
||||||
* ModuleDataEvent. If not, null is returned.
|
* ModuleDataEvent. If not, null is returned.
|
||||||
|
@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2021 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.mainui.datamodel;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An event where file type extensions could be affected.
|
||||||
|
*/
|
||||||
|
public class FileTypeExtensionsEvent {
|
||||||
|
|
||||||
|
private final FileExtSearchFilter filter;
|
||||||
|
private final long dataSourceId;
|
||||||
|
|
||||||
|
// TODO: This should ideally take in some kind of ENUM once we redo the tree.
|
||||||
|
// this assumes that filters implicitly or explicitly implement hashCode and equals to work
|
||||||
|
FileTypeExtensionsEvent(FileExtSearchFilter filter, long dataSourceId) {
|
||||||
|
this.filter = filter;
|
||||||
|
this.dataSourceId = dataSourceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileExtSearchFilter getFilter() {
|
||||||
|
return filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getDataSourceId() {
|
||||||
|
return dataSourceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 31 * hash + Objects.hashCode(this.filter);
|
||||||
|
hash = 31 * hash + Objects.hashCode(this.dataSourceId);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final FileTypeExtensionsEvent other = (FileTypeExtensionsEvent) obj;
|
||||||
|
if (!Objects.equals(this.filter, other.filter)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(this.dataSourceId, other.dataSourceId)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
74
Core/src/org/sleuthkit/autopsy/mainui/datamodel/FileTypeMimeEvent.java
Executable file
74
Core/src/org/sleuthkit/autopsy/mainui/datamodel/FileTypeMimeEvent.java
Executable file
@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2021 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.mainui.datamodel;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An event pertaining to MIME types view from the DAO.
|
||||||
|
*/
|
||||||
|
public class FileTypeMimeEvent {
|
||||||
|
|
||||||
|
private final String mimeType;
|
||||||
|
private final long dataSourceId;
|
||||||
|
|
||||||
|
FileTypeMimeEvent(String mimeType, long dataSourceId) {
|
||||||
|
this.mimeType = mimeType;
|
||||||
|
this.dataSourceId = dataSourceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMimeType() {
|
||||||
|
return mimeType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getDataSourceId() {
|
||||||
|
return dataSourceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 29 * hash + Objects.hashCode(this.mimeType);
|
||||||
|
hash = 29 * hash + Objects.hashCode(this.dataSourceId);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final FileTypeMimeEvent other = (FileTypeMimeEvent) obj;
|
||||||
|
if (!Objects.equals(this.mimeType, other.mimeType)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(this.dataSourceId, other.dataSourceId)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
73
Core/src/org/sleuthkit/autopsy/mainui/datamodel/FileTypeSizeEvent.java
Executable file
73
Core/src/org/sleuthkit/autopsy/mainui/datamodel/FileTypeSizeEvent.java
Executable file
@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2021 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.mainui.datamodel;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Key for accessing data about file sizeFilter from the DAO.
|
||||||
|
*/
|
||||||
|
public class FileTypeSizeEvent {
|
||||||
|
|
||||||
|
private final FileSizeFilter sizeFilter;
|
||||||
|
private final Long dataSourceId;
|
||||||
|
|
||||||
|
FileTypeSizeEvent(FileSizeFilter sizeFilter, Long dataSourceId) {
|
||||||
|
this.sizeFilter = sizeFilter;
|
||||||
|
this.dataSourceId = dataSourceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileSizeFilter getSizeFilter() {
|
||||||
|
return sizeFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDataSourceId() {
|
||||||
|
return dataSourceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 53 * hash + Objects.hashCode(this.sizeFilter);
|
||||||
|
hash = 53 * hash + Objects.hashCode(this.dataSourceId);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final FileTypeSizeEvent other = (FileTypeSizeEvent) obj;
|
||||||
|
if (this.sizeFilter != other.sizeFilter) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(this.dataSourceId, other.dataSourceId)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -25,51 +25,6 @@ import java.util.Objects;
|
|||||||
*/
|
*/
|
||||||
public class FileTypeSizeSearchParams {
|
public class FileTypeSizeSearchParams {
|
||||||
|
|
||||||
public enum FileSizeFilter {
|
|
||||||
SIZE_50_200(0, "SIZE_50_200", "50 - 200MB", 50_000_000L, 200_000_000L), //NON-NLS
|
|
||||||
SIZE_200_1000(1, "SIZE_200_1GB", "200MB - 1GB", 200_000_000L, 1_000_000_000L), //NON-NLS
|
|
||||||
SIZE_1000_(2, "SIZE_1000+", "1GB+", 1_000_000_000L, null); //NON-NLS
|
|
||||||
private final int id;
|
|
||||||
private final String name;
|
|
||||||
private final String displayName;
|
|
||||||
private long minBound;
|
|
||||||
private Long maxBound;
|
|
||||||
|
|
||||||
private FileSizeFilter(int id, String name, String displayName, long minBound, Long maxBound) {
|
|
||||||
this.id = id;
|
|
||||||
this.name = name;
|
|
||||||
this.displayName = displayName;
|
|
||||||
this.minBound = minBound;
|
|
||||||
this.maxBound = maxBound;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDisplayName() {
|
|
||||||
return this.displayName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The minimum inclusive bound (non-null).
|
|
||||||
*/
|
|
||||||
public long getMinBound() {
|
|
||||||
return minBound;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The maximum exclusive bound (if null, no upper limit).
|
|
||||||
*/
|
|
||||||
public Long getMaxBound() {
|
|
||||||
return maxBound;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private final FileSizeFilter sizeFilter;
|
private final FileSizeFilter sizeFilter;
|
||||||
private final Long dataSourceId;
|
private final Long dataSourceId;
|
||||||
|
@ -20,13 +20,16 @@ package org.sleuthkit.autopsy.mainui.datamodel;
|
|||||||
|
|
||||||
import com.google.common.cache.Cache;
|
import com.google.common.cache.Cache;
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
|
import java.beans.PropertyChangeEvent;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@ -285,7 +288,7 @@ public class ViewsDAO extends AbstractDAO {
|
|||||||
*
|
*
|
||||||
* @return The clause to be proceeded with 'where' or 'and'.
|
* @return The clause to be proceeded with 'where' or 'and'.
|
||||||
*/
|
*/
|
||||||
private static String getFileSizeClause(FileTypeSizeSearchParams.FileSizeFilter filter) {
|
private static String getFileSizeClause(FileSizeFilter filter) {
|
||||||
return filter.getMaxBound() == null
|
return filter.getMaxBound() == null
|
||||||
? "(size >= " + filter.getMinBound() + ")"
|
? "(size >= " + filter.getMinBound() + ")"
|
||||||
: "(size >= " + filter.getMinBound() + " AND size < " + filter.getMaxBound() + ")";
|
: "(size >= " + filter.getMinBound() + " AND size < " + filter.getMaxBound() + ")";
|
||||||
@ -313,7 +316,7 @@ public class ViewsDAO extends AbstractDAO {
|
|||||||
*
|
*
|
||||||
* @return The clause to be proceeded with 'where' or 'and'.
|
* @return The clause to be proceeded with 'where' or 'and'.
|
||||||
*/
|
*/
|
||||||
private String getFileSizesWhereStatement(FileTypeSizeSearchParams.FileSizeFilter filter, Long dataSourceId) {
|
private String getFileSizesWhereStatement(FileSizeFilter filter, Long dataSourceId) {
|
||||||
String query = getBaseFileSizeFilter()
|
String query = getBaseFileSizeFilter()
|
||||||
+ " AND " + getFileSizeClause(filter)
|
+ " AND " + getFileSizeClause(filter)
|
||||||
+ getDataSourceAndClause(dataSourceId);
|
+ getDataSourceAndClause(dataSourceId);
|
||||||
@ -369,12 +372,12 @@ public class ViewsDAO extends AbstractDAO {
|
|||||||
* @throws ExecutionException
|
* @throws ExecutionException
|
||||||
*/
|
*/
|
||||||
public TreeResultsDTO<FileTypeSizeSearchParams> getFileSizeCounts(Long dataSourceId) throws IllegalArgumentException, ExecutionException {
|
public TreeResultsDTO<FileTypeSizeSearchParams> getFileSizeCounts(Long dataSourceId) throws IllegalArgumentException, ExecutionException {
|
||||||
Map<FileTypeSizeSearchParams.FileSizeFilter, String> whereClauses = Stream.of(FileTypeSizeSearchParams.FileSizeFilter.values())
|
Map<FileSizeFilter, String> whereClauses = Stream.of(FileSizeFilter.values())
|
||||||
.collect(Collectors.toMap(
|
.collect(Collectors.toMap(
|
||||||
filter -> filter,
|
filter -> filter,
|
||||||
filter -> getFileSizeClause(filter)));
|
filter -> getFileSizeClause(filter)));
|
||||||
|
|
||||||
Map<FileTypeSizeSearchParams.FileSizeFilter, Long> countsByFilter = getFilesCounts(whereClauses, getBaseFileSizeFilter(), dataSourceId, true);
|
Map<FileSizeFilter, Long> countsByFilter = getFilesCounts(whereClauses, getBaseFileSizeFilter(), dataSourceId, true);
|
||||||
|
|
||||||
List<TreeItemDTO<FileTypeSizeSearchParams>> treeList = countsByFilter.entrySet().stream()
|
List<TreeItemDTO<FileTypeSizeSearchParams>> treeList = countsByFilter.entrySet().stream()
|
||||||
.map(entry -> {
|
.map(entry -> {
|
||||||
@ -596,7 +599,7 @@ public class ViewsDAO extends AbstractDAO {
|
|||||||
return fetchFileViewFiles(whereStatement, MIME_TYPE_DISPLAY_NAME, startItem, maxResultCount);
|
return fetchFileViewFiles(whereStatement, MIME_TYPE_DISPLAY_NAME, startItem, maxResultCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SearchResultsDTO fetchSizeSearchResultsDTOs(FileTypeSizeSearchParams.FileSizeFilter filter, Long dataSourceId, long startItem, Long maxResultCount) throws NoCurrentCaseException, TskCoreException {
|
private SearchResultsDTO fetchSizeSearchResultsDTOs(FileSizeFilter filter, Long dataSourceId, long startItem, Long maxResultCount) throws NoCurrentCaseException, TskCoreException {
|
||||||
String whereStatement = getFileSizesWhereStatement(filter, dataSourceId);
|
String whereStatement = getFileSizesWhereStatement(filter, dataSourceId);
|
||||||
return fetchFileViewFiles(whereStatement, filter.getDisplayName(), startItem, maxResultCount);
|
return fetchFileViewFiles(whereStatement, filter.getDisplayName(), startItem, maxResultCount);
|
||||||
}
|
}
|
||||||
@ -641,6 +644,51 @@ public class ViewsDAO extends AbstractDAO {
|
|||||||
return new BaseSearchResultsDTO(FILE_VIEW_EXT_TYPE_ID, displayName, FileSystemColumnUtils.getColumnKeysForAbstractfile(), fileRows, startItem, totalResultsCount);
|
return new BaseSearchResultsDTO(FILE_VIEW_EXT_TYPE_ID, displayName, FileSystemColumnUtils.getColumnKeysForAbstractfile(), fileRows, startItem, totalResultsCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void clearCaches() {
|
||||||
|
this.searchParamsCache.invalidateAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
List<DAOEvent> handleAutopsyEvent(Collection<PropertyChangeEvent> autopsyEvts) {
|
||||||
|
Map<String, Set<Long>> fileExtensionDsMap = new HashMap<>();
|
||||||
|
Map<String, Set<Long>> mimeTypeDsMap = new HashMap<>();
|
||||||
|
Map<FileSizeFilter, Set<Long>> fileSizeDsMap = new HashMap<>();
|
||||||
|
|
||||||
|
for (PropertyChangeEvent evt : autopsyEvts) {
|
||||||
|
AbstractFile af = DAOEventUtils.getFileFromEvt(evt);
|
||||||
|
if (af == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!StringUtils.isBlank(af.getNameExtension())) {
|
||||||
|
fileExtensionDsMap
|
||||||
|
.computeIfAbsent(af.getNameExtension(), (k) -> new HashSet<>())
|
||||||
|
.add(af.getDataSourceObjectId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!StringUtils.isBlank(af.getMIMEType())) {
|
||||||
|
mimeTypeDsMap
|
||||||
|
.computeIfAbsent(af.getMIMEType(), (k) -> new HashSet<>())
|
||||||
|
.add(af.getDataSourceObjectId());
|
||||||
|
}
|
||||||
|
|
||||||
|
FileSizeFilter sizeFilter = Stream.of(FileSizeFilter.values())
|
||||||
|
.filter(filter -> af.getSize() >= filter.getMinBound() && af.getSize() < filter.getMaxBound())
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
|
if (sizeFilter != null) {
|
||||||
|
fileSizeDsMap
|
||||||
|
.computeIfAbsent(sizeFilter, (k) -> new HashSet<>())
|
||||||
|
.add(af.getDataSourceObjectId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles fetching and paging of data for file types by extension.
|
* Handles fetching and paging of data for file types by extension.
|
||||||
*/
|
*/
|
||||||
@ -727,7 +775,7 @@ public class ViewsDAO extends AbstractDAO {
|
|||||||
@Override
|
@Override
|
||||||
public boolean isRefreshRequired(DAOEvent evt) {
|
public boolean isRefreshRequired(DAOEvent evt) {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// GVDTODO
|
// GVDTODO
|
||||||
// Content content = DAOEventUtils.getContentFromEvt(evt);
|
// Content content = DAOEventUtils.getContentFromEvt(evt);
|
||||||
// if (content == null) {
|
// if (content == null) {
|
||||||
|
@ -33,7 +33,7 @@ import org.sleuthkit.autopsy.mainui.datamodel.FileExtSearchFilter;
|
|||||||
import org.sleuthkit.autopsy.mainui.datamodel.FileTypeExtensionsSearchParams;
|
import org.sleuthkit.autopsy.mainui.datamodel.FileTypeExtensionsSearchParams;
|
||||||
import org.sleuthkit.autopsy.mainui.datamodel.FileTypeMimeSearchParams;
|
import org.sleuthkit.autopsy.mainui.datamodel.FileTypeMimeSearchParams;
|
||||||
import org.sleuthkit.autopsy.mainui.datamodel.FileTypeSizeSearchParams;
|
import org.sleuthkit.autopsy.mainui.datamodel.FileTypeSizeSearchParams;
|
||||||
import org.sleuthkit.autopsy.mainui.datamodel.FileTypeSizeSearchParams.FileSizeFilter;
|
import org.sleuthkit.autopsy.mainui.datamodel.FileSizeFilter;
|
||||||
import org.sleuthkit.autopsy.mainui.datamodel.MainDAO;
|
import org.sleuthkit.autopsy.mainui.datamodel.MainDAO;
|
||||||
import org.sleuthkit.autopsy.mainui.datamodel.TreeResultsDTO;
|
import org.sleuthkit.autopsy.mainui.datamodel.TreeResultsDTO;
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
|
@ -672,31 +672,31 @@ public class TableSearchTest extends NbTestCase {
|
|||||||
ViewsDAO viewsDAO = MainDAO.getInstance().getViewsDAO();
|
ViewsDAO viewsDAO = MainDAO.getInstance().getViewsDAO();
|
||||||
|
|
||||||
// Get "50 - 200MB" files from data source 1
|
// Get "50 - 200MB" files from data source 1
|
||||||
FileTypeSizeSearchParams param = new FileTypeSizeSearchParams(FileTypeSizeSearchParams.FileSizeFilter.SIZE_50_200, dataSource1.getId());
|
FileTypeSizeSearchParams param = new FileTypeSizeSearchParams(FileSizeFilter.SIZE_50_200, dataSource1.getId());
|
||||||
SearchResultsDTO results = viewsDAO.getFilesBySize(param, 0, null, false);
|
SearchResultsDTO results = viewsDAO.getFilesBySize(param, 0, null, false);
|
||||||
assertEquals(2, results.getTotalResultsCount());
|
assertEquals(2, results.getTotalResultsCount());
|
||||||
assertEquals(2, results.getItems().size());
|
assertEquals(2, results.getItems().size());
|
||||||
|
|
||||||
// Get "200MB - 1GB" files from data source 1
|
// Get "200MB - 1GB" files from data source 1
|
||||||
param = new FileTypeSizeSearchParams(FileTypeSizeSearchParams.FileSizeFilter.SIZE_200_1000, dataSource1.getId());
|
param = new FileTypeSizeSearchParams(FileSizeFilter.SIZE_200_1000, dataSource1.getId());
|
||||||
results = viewsDAO.getFilesBySize(param, 0, null, false);
|
results = viewsDAO.getFilesBySize(param, 0, null, false);
|
||||||
assertEquals(0, results.getTotalResultsCount());
|
assertEquals(0, results.getTotalResultsCount());
|
||||||
assertEquals(0, results.getItems().size());
|
assertEquals(0, results.getItems().size());
|
||||||
|
|
||||||
// Get "200MB - 1GB" files from data source 2
|
// Get "200MB - 1GB" files from data source 2
|
||||||
param = new FileTypeSizeSearchParams(FileTypeSizeSearchParams.FileSizeFilter.SIZE_200_1000, dataSource2.getId());
|
param = new FileTypeSizeSearchParams(FileSizeFilter.SIZE_200_1000, dataSource2.getId());
|
||||||
results = viewsDAO.getFilesBySize(param, 0, null, false);
|
results = viewsDAO.getFilesBySize(param, 0, null, false);
|
||||||
assertEquals(1, results.getTotalResultsCount());
|
assertEquals(1, results.getTotalResultsCount());
|
||||||
assertEquals(1, results.getItems().size());
|
assertEquals(1, results.getItems().size());
|
||||||
|
|
||||||
// Get "1GB+" files from all data sources
|
// Get "1GB+" files from all data sources
|
||||||
param = new FileTypeSizeSearchParams(FileTypeSizeSearchParams.FileSizeFilter.SIZE_1000_, null);
|
param = new FileTypeSizeSearchParams(FileSizeFilter.SIZE_1000_, null);
|
||||||
results = viewsDAO.getFilesBySize(param, 0, null, false);
|
results = viewsDAO.getFilesBySize(param, 0, null, false);
|
||||||
assertEquals(0, results.getTotalResultsCount());
|
assertEquals(0, results.getTotalResultsCount());
|
||||||
assertEquals(0, results.getItems().size());
|
assertEquals(0, results.getItems().size());
|
||||||
|
|
||||||
// Get "50 - 200MB" files from all data sources
|
// Get "50 - 200MB" files from all data sources
|
||||||
param = new FileTypeSizeSearchParams(FileTypeSizeSearchParams.FileSizeFilter.SIZE_50_200, null);
|
param = new FileTypeSizeSearchParams(FileSizeFilter.SIZE_50_200, null);
|
||||||
results = viewsDAO.getFilesBySize(param, 0, null, false);
|
results = viewsDAO.getFilesBySize(param, 0, null, false);
|
||||||
assertEquals(3, results.getTotalResultsCount());
|
assertEquals(3, results.getTotalResultsCount());
|
||||||
assertEquals(3, results.getItems().size());
|
assertEquals(3, results.getItems().size());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user