mirror of
https://github.com/elisspace/autopsy.git
synced 2026-09-06 02:24:30 +00:00
renamed and refactored file type views to make them easier to navigate
This commit is contained in:
@@ -122,8 +122,8 @@ abstract class AbstractContentChildren<T> extends Keys<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(SearchFilters sf) {
|
||||
return new SearchFiltersNode(sf.getSleuthkitCase(), null);
|
||||
public AbstractNode visit(FileTypeExtensionFilters sf) {
|
||||
return new FileTypesNode(sf.getSleuthkitCase(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,13 +26,13 @@ public interface AutopsyItemVisitor<T> {
|
||||
|
||||
T visit(ExtractedContent ec);
|
||||
|
||||
T visit(SearchFilters sf);
|
||||
T visit(FileTypeExtensionFilters sf);
|
||||
|
||||
T visit(SearchFilters.FileSearchFilter fsf);
|
||||
T visit(FileTypeExtensionFilters.RootFilter fsf);
|
||||
|
||||
T visit(SearchFilters.DocumentFilter df);
|
||||
T visit(FileTypeExtensionFilters.DocumentFilter df);
|
||||
|
||||
T visit(SearchFilters.ExecutableFilter ef);
|
||||
T visit(FileTypeExtensionFilters.ExecutableFilter ef);
|
||||
|
||||
T visit(RecentFiles rf);
|
||||
|
||||
@@ -70,22 +70,22 @@ public interface AutopsyItemVisitor<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public T visit(SearchFilters sf) {
|
||||
public T visit(FileTypeExtensionFilters sf) {
|
||||
return defaultVisit(sf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T visit(SearchFilters.FileSearchFilter fsf) {
|
||||
public T visit(FileTypeExtensionFilters.RootFilter fsf) {
|
||||
return defaultVisit(fsf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T visit(SearchFilters.DocumentFilter df) {
|
||||
public T visit(FileTypeExtensionFilters.DocumentFilter df) {
|
||||
return defaultVisit(df);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T visit(SearchFilters.ExecutableFilter ef) {
|
||||
public T visit(FileTypeExtensionFilters.ExecutableFilter ef) {
|
||||
return defaultVisit(ef);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public interface DisplayableItemNodeVisitor<T> {
|
||||
|
||||
T visit(ExtractedContentNode ecn);
|
||||
|
||||
T visit(FileSearchFilterNode fsfn);
|
||||
T visit(FileTypeNode fsfn);
|
||||
|
||||
T visit(DeletedContentNode dcn);
|
||||
|
||||
@@ -63,7 +63,7 @@ public interface DisplayableItemNodeVisitor<T> {
|
||||
|
||||
T visit(FileSizeNode fsn);
|
||||
|
||||
T visit(SearchFiltersNode sfn);
|
||||
T visit(FileTypesNode sfn);
|
||||
|
||||
T visit(RecentFilesNode rfn);
|
||||
|
||||
@@ -155,7 +155,7 @@ public interface DisplayableItemNodeVisitor<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public T visit(FileSearchFilterNode fsfn) {
|
||||
public T visit(FileTypeNode fsfn) {
|
||||
return defaultVisit(fsfn);
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ public interface DisplayableItemNodeVisitor<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public T visit(SearchFiltersNode sfn) {
|
||||
public T visit(FileTypesNode sfn) {
|
||||
return defaultVisit(sfn);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,16 +38,16 @@ import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.datamodel.TskData;
|
||||
|
||||
/**
|
||||
* Children factory for the file by type view in dir tree
|
||||
* Children factory for a specific file type - does the database query.
|
||||
*/
|
||||
class FileSearchFilterChildren extends ChildFactory<Content> {
|
||||
class FileTypeChildren extends ChildFactory<Content> {
|
||||
|
||||
private SleuthkitCase skCase;
|
||||
private SearchFilters.SearchFilterInterface filter;
|
||||
private static final Logger logger = Logger.getLogger(FileSearchFilterChildren.class.getName());
|
||||
private FileTypeExtensionFilters.SearchFilterInterface filter;
|
||||
private static final Logger logger = Logger.getLogger(FileTypeChildren.class.getName());
|
||||
//private final static int MAX_OBJECTS = 2000;
|
||||
|
||||
public FileSearchFilterChildren(SearchFilters.SearchFilterInterface filter, SleuthkitCase skCase) {
|
||||
public FileTypeChildren(FileTypeExtensionFilters.SearchFilterInterface filter, SleuthkitCase skCase) {
|
||||
this.filter = filter;
|
||||
this.skCase = skCase;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ class FileSearchFilterChildren extends ChildFactory<Content> {
|
||||
|
||||
private String createQuery(){
|
||||
String query = "(dir_type = " + TskData.TSK_FS_NAME_TYPE_ENUM.REG.getValue() + ")"
|
||||
+ " AND (known IS NULL OR known != 1) AND (0";
|
||||
+ " AND (known IS NULL OR known != " + TskData.FileKnown.KNOWN + ") AND (0";
|
||||
for(String s : filter.getFilter()){
|
||||
query += " OR name LIKE '%" + s + "'";
|
||||
}
|
||||
@@ -72,7 +72,7 @@ class FileSearchFilterChildren extends ChildFactory<Content> {
|
||||
|
||||
|
||||
private List<AbstractFile> runQuery(){
|
||||
List<AbstractFile> list = new ArrayList<AbstractFile>();
|
||||
List<AbstractFile> list = new ArrayList<>();
|
||||
try {
|
||||
List<AbstractFile> res = skCase.findAllFilesWhere(createQuery());
|
||||
for(AbstractFile c : res){
|
||||
@@ -25,11 +25,12 @@ import org.sleuthkit.datamodel.SleuthkitCase;
|
||||
/**
|
||||
* Filters database results by file extension.
|
||||
*/
|
||||
public class SearchFilters implements AutopsyVisitableItem {
|
||||
public class FileTypeExtensionFilters implements AutopsyVisitableItem {
|
||||
|
||||
private SleuthkitCase skCase;
|
||||
|
||||
public enum FileSearchFilter implements AutopsyVisitableItem,SearchFilterInterface {
|
||||
// root node filters
|
||||
public enum RootFilter implements AutopsyVisitableItem,SearchFilterInterface {
|
||||
TSK_IMAGE_FILTER(0, "TSK_IMAGE_FILTER", "Images", FileTypeExtensions.getImageExtensions()),
|
||||
TSK_VIDEO_FILTER(1, "TSK_VIDEO_FILTER", "Videos", FileTypeExtensions.getVideoExtensions()),
|
||||
TSK_AUDIO_FILTER(2, "TSK_AUDIO_FILTER", "Audio", FileTypeExtensions.getAudioExtensions()),
|
||||
@@ -42,7 +43,7 @@ public class SearchFilters implements AutopsyVisitableItem {
|
||||
private String displayName;
|
||||
private List<String> filter;
|
||||
|
||||
private FileSearchFilter(int id, String name, String displayName, List<String> filter){
|
||||
private RootFilter(int id, String name, String displayName, List<String> filter){
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.displayName = displayName;
|
||||
@@ -75,6 +76,7 @@ public class SearchFilters implements AutopsyVisitableItem {
|
||||
}
|
||||
}
|
||||
|
||||
// document sub-node filters
|
||||
public enum DocumentFilter implements AutopsyVisitableItem,SearchFilterInterface {
|
||||
AUT_DOC_HTML(0, "AUT_DOC_HTML", "HTML", Arrays.asList(".htm", ".html")),
|
||||
AUT_DOC_OFFICE(1, "AUT_DOC_OFFICE", "Office", Arrays.asList(".doc", ".docx",
|
||||
@@ -122,6 +124,7 @@ public class SearchFilters implements AutopsyVisitableItem {
|
||||
}
|
||||
|
||||
|
||||
// executable sub-node filters
|
||||
public enum ExecutableFilter implements AutopsyVisitableItem,SearchFilterInterface {
|
||||
ExecutableFilter_EXE(0, "ExecutableFilter_EXE", ".exe", Arrays.asList(".exe")),
|
||||
ExecutableFilter_DLL(1, "ExecutableFilter_DLL", ".dll", Arrays.asList(".dll")),
|
||||
@@ -167,7 +170,7 @@ public class SearchFilters implements AutopsyVisitableItem {
|
||||
}
|
||||
}
|
||||
|
||||
public SearchFilters(SleuthkitCase skCase){
|
||||
public FileTypeExtensionFilters(SleuthkitCase skCase){
|
||||
this.skCase = skCase;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011-2013 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.datamodel;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -24,15 +24,15 @@ import org.openide.util.lookup.Lookups;
|
||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||
|
||||
/**
|
||||
* Node for the file search filter
|
||||
* Node for a specific file type / extension
|
||||
*/
|
||||
public class FileSearchFilterNode extends DisplayableItemNode {
|
||||
public class FileTypeNode extends DisplayableItemNode {
|
||||
|
||||
SearchFilters.SearchFilterInterface filter;
|
||||
FileTypeExtensionFilters.SearchFilterInterface filter;
|
||||
SleuthkitCase skCase;
|
||||
|
||||
FileSearchFilterNode(SearchFilters.SearchFilterInterface filter, SleuthkitCase skCase) {
|
||||
super(Children.create(new FileSearchFilterChildren(filter, skCase), true), Lookups.singleton(filter.getDisplayName()));
|
||||
FileTypeNode(FileTypeExtensionFilters.SearchFilterInterface filter, SleuthkitCase skCase) {
|
||||
super(Children.create(new FileTypeChildren(filter, skCase), true), Lookups.singleton(filter.getDisplayName()));
|
||||
|
||||
this.filter = filter;
|
||||
this.skCase = skCase;
|
||||
@@ -40,7 +40,7 @@ public class FileSearchFilterNode extends DisplayableItemNode {
|
||||
super.setName(filter.getName());
|
||||
|
||||
//get count of children without preloading all children nodes
|
||||
final long count = new FileSearchFilterChildren(filter, skCase).calculateItems();
|
||||
final long count = new FileTypeChildren(filter, skCase).calculateItems();
|
||||
//final long count = getChildren().getNodesCount(true);
|
||||
super.setDisplayName(filter.getDisplayName() + " (" + count + ")");
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011 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.datamodel;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.openide.nodes.ChildFactory;
|
||||
import org.openide.nodes.Node;
|
||||
import org.sleuthkit.autopsy.datamodel.FileTypeExtensionFilters.RootFilter;
|
||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class FileTypesChildren extends ChildFactory<FileTypeExtensionFilters.SearchFilterInterface> {
|
||||
|
||||
private SleuthkitCase skCase;
|
||||
private FileTypeExtensionFilters.RootFilter filter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param skCase
|
||||
* @param filter Is null for root node
|
||||
*/
|
||||
public FileTypesChildren(SleuthkitCase skCase, FileTypeExtensionFilters.RootFilter filter) {
|
||||
this.skCase = skCase;
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean createKeys(List<FileTypeExtensionFilters.SearchFilterInterface> list) {
|
||||
// root node
|
||||
if (filter == null) {
|
||||
list.addAll(Arrays.asList(RootFilter.values()));
|
||||
}
|
||||
// document and executable has another level of nodes
|
||||
else if (filter.equals(RootFilter.TSK_DOCUMENT_FILTER) ){
|
||||
list.addAll(Arrays.asList(FileTypeExtensionFilters.DocumentFilter.values()));
|
||||
}
|
||||
else if (filter.equals(RootFilter.TSK_EXECUTABLE_FILTER) ){
|
||||
list.addAll(Arrays.asList(FileTypeExtensionFilters.ExecutableFilter.values()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Node createNodeForKey(FileTypeExtensionFilters.SearchFilterInterface key){
|
||||
// make new nodes for the sub-nodes
|
||||
if(key.getName().equals(FileTypeExtensionFilters.RootFilter.TSK_DOCUMENT_FILTER.getName())){
|
||||
return new FileTypesNode(skCase, FileTypeExtensionFilters.RootFilter.TSK_DOCUMENT_FILTER);
|
||||
}
|
||||
else if(key.getName().equals(FileTypeExtensionFilters.RootFilter.TSK_EXECUTABLE_FILTER.getName())){
|
||||
return new FileTypesNode(skCase, FileTypeExtensionFilters.RootFilter.TSK_EXECUTABLE_FILTER);
|
||||
}
|
||||
else {
|
||||
return new FileTypeNode(key, skCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,19 +24,27 @@ import org.openide.util.lookup.Lookups;
|
||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||
|
||||
/**
|
||||
* Node for search filter
|
||||
* Node for extension/file type filter view
|
||||
*/
|
||||
public class SearchFiltersNode extends DisplayableItemNode {
|
||||
public class FileTypesNode extends DisplayableItemNode {
|
||||
|
||||
private static final String FNAME = "File Types";
|
||||
private SleuthkitCase skCase;
|
||||
|
||||
SearchFiltersNode(SleuthkitCase skCase, SearchFilters.FileSearchFilter filter) {
|
||||
super(Children.create(new SearchFiltersChildren(skCase, filter), true), Lookups.singleton(filter == null ? FNAME : filter.getName()));
|
||||
/**
|
||||
*
|
||||
* @param skCase
|
||||
* @param filter null to display root node of file type tree, pass in something to provide a sub-node.
|
||||
*/
|
||||
FileTypesNode(SleuthkitCase skCase, FileTypeExtensionFilters.RootFilter filter) {
|
||||
super(Children.create(new FileTypesChildren(skCase, filter), true), Lookups.singleton(filter == null ? FNAME : filter.getName()));
|
||||
// root node of tree
|
||||
if (filter == null) {
|
||||
super.setName(FNAME);
|
||||
super.setDisplayName(FNAME);
|
||||
} else {
|
||||
}
|
||||
// sub-node in file tree (i.e. documents, exec, etc.)
|
||||
else {
|
||||
super.setName(filter.getName());
|
||||
super.setDisplayName(filter.getDisplayName());
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011 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.datamodel;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.openide.nodes.ChildFactory;
|
||||
import org.openide.nodes.Node;
|
||||
import org.sleuthkit.autopsy.datamodel.SearchFilters.FileSearchFilter;
|
||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class SearchFiltersChildren extends ChildFactory<SearchFilters.SearchFilterInterface> {
|
||||
|
||||
private SleuthkitCase skCase;
|
||||
private SearchFilters.FileSearchFilter filter;
|
||||
|
||||
public SearchFiltersChildren(SleuthkitCase skCase, SearchFilters.FileSearchFilter filter) {
|
||||
this.skCase = skCase;
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean createKeys(List<SearchFilters.SearchFilterInterface> list) {
|
||||
if (filter == null) {
|
||||
list.addAll(Arrays.asList(FileSearchFilter.values()));
|
||||
}
|
||||
else if (filter.equals(FileSearchFilter.TSK_DOCUMENT_FILTER) ){
|
||||
list.addAll(Arrays.asList(SearchFilters.DocumentFilter.values()));
|
||||
}
|
||||
else if (filter.equals(FileSearchFilter.TSK_EXECUTABLE_FILTER) ){
|
||||
list.addAll(Arrays.asList(SearchFilters.ExecutableFilter.values()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Node createNodeForKey(SearchFilters.SearchFilterInterface key){
|
||||
if(key.getName().equals(SearchFilters.FileSearchFilter.TSK_DOCUMENT_FILTER.getName())){
|
||||
return new SearchFiltersNode(skCase, SearchFilters.FileSearchFilter.TSK_DOCUMENT_FILTER);
|
||||
}
|
||||
else if(key.getName().equals(SearchFilters.FileSearchFilter.TSK_EXECUTABLE_FILTER.getName())){
|
||||
return new SearchFiltersNode(skCase, SearchFilters.FileSearchFilter.TSK_EXECUTABLE_FILTER);
|
||||
}
|
||||
else {
|
||||
return new FileSearchFilterNode(key, skCase);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public class ViewsNode extends DisplayableItemNode {
|
||||
|
||||
public ViewsNode(SleuthkitCase sleuthkitCase) {
|
||||
super(new RootContentChildren(Arrays.asList(
|
||||
new SearchFilters(sleuthkitCase),
|
||||
new FileTypeExtensionFilters(sleuthkitCase),
|
||||
new RecentFiles(sleuthkitCase),
|
||||
new DeletedContent(sleuthkitCase),
|
||||
new FileSize(sleuthkitCase)
|
||||
|
||||
Reference in New Issue
Block a user