Merge pull request #5422 from APriestman/5387_poolObject

5387 Add pool node
This commit is contained in:
Richard Cordovano 2019-11-25 15:46:07 -05:00 committed by GitHub
commit 1c9b0f7202
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 250 additions and 4 deletions

View File

@ -268,10 +268,10 @@ ImageNode.getActions.viewInNewWin.text=View in New Window
ImageNode.createSheet.name.name=Name
ImageNode.createSheet.name.displayName=Name
ImageNode.createSheet.name.desc=no description
Installer.exception.tskVerStringNull.msg=Sleuth Kit JNI test call returned without error, but version string was null!
Installer.exception.taskVerStringBang.msg=Sleuth Kit JNI test call returned without error, but version string was ""!
Installer.tskLibErr.msg=Problem with Sleuth Kit JNI. Test call failed!\n\nDetails: {0}
Installer.tskLibErr.err=Fatal Error!
Installer.exception.tskVerStringNull.msg=Sleuth Kit JNI test call returned without error, but version string was null\!
Installer.exception.taskVerStringBang.msg=Sleuth Kit JNI test call returned without error, but version string was ""\!
Installer.tskLibErr.msg=Problem with Sleuth Kit JNI. Test call failed\!\n\nDetails: {0}
Installer.tskLibErr.err=Fatal Error\!
InterestingHits.interestingItems.text=INTERESTING ITEMS
InterestingHits.displayName.text=Interesting Items
InterestingHits.createSheet.name.name=Name
@ -301,6 +301,15 @@ OpenReportAction.actionPerformed.NoAssociatedEditorMessage=There is no associate
OpenReportAction.actionPerformed.NoOpenInEditorSupportMessage=This platform (operating system) does not support opening a file in an editor this way.
OpenReportAction.actionPerformed.MissingReportFileMessage=The report file no longer exists.
OpenReportAction.actionPerformed.ReportFileOpenPermissionDeniedMessage=Permission to open the report file was denied.
PoolNode.createSheet.name.desc=no description
PoolNode.createSheet.name.displayName=Name
PoolNode.createSheet.name.name=Name
PoolNode.createSheet.offset.desc=no description
PoolNode.createSheet.offset.displayName=Starting offset
PoolNode.createSheet.offset.name=Starting offset
PoolNode.createSheet.type.desc=no description
PoolNode.createSheet.type.displayName=Type
PoolNode.createSheet.type.name=Type
RecentFiles.aut0DayFilter.displayName.text=Final Day
RecentFiles.aut1dayFilter.displayName.text=Final Day - 1
RecentFiles.aut2dayFilter.displayName.text=Final Day - 2

View File

@ -35,6 +35,8 @@ interface ContentNodeVisitor<T> {
T visit(LocalDirectoryNode ldn);
T visit(VolumeNode vn);
T visit(PoolNode pn);
T visit(DirectoryNode dn);
@ -85,6 +87,11 @@ interface ContentNodeVisitor<T> {
public T visit(VolumeNode vn) {
return defaultVisit(vn);
}
@Override
public T visit(PoolNode pn) {
return defaultVisit(pn);
}
@Override
public T visit(LayoutFileNode lcn) {

View File

@ -28,6 +28,7 @@ import org.sleuthkit.datamodel.Image;
import org.sleuthkit.datamodel.LayoutFile;
import org.sleuthkit.datamodel.LocalDirectory;
import org.sleuthkit.datamodel.LocalFile;
import org.sleuthkit.datamodel.Pool;
import org.sleuthkit.datamodel.SlackFile;
import org.sleuthkit.datamodel.SleuthkitItemVisitor;
import org.sleuthkit.datamodel.SleuthkitVisitableItem;
@ -58,6 +59,11 @@ public class CreateSleuthkitNodeVisitor extends SleuthkitItemVisitor.Default<Abs
public AbstractContentNode<? extends Content> visit(Volume volume) {
return new VolumeNode(volume);
}
@Override
public AbstractContentNode<? extends Content> visit(Pool pool) {
return new PoolNode(pool);
}
@Override
public AbstractContentNode<? extends Content> visit(LayoutFile lf) {

View File

@ -59,6 +59,8 @@ public interface DisplayableItemNodeVisitor<T> {
T visit(ImageNode in);
T visit(VolumeNode vn);
T visit(PoolNode pn);
T visit(SlackFileNode sfn);
@ -262,6 +264,11 @@ public interface DisplayableItemNodeVisitor<T> {
public T visit(ImageNode in) {
return defaultVisit(in);
}
@Override
public T visit(PoolNode pn) {
return defaultVisit(pn);
}
@Override
public T visit(VolumeNode vn) {

View File

@ -0,0 +1,211 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2019 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.ArrayList;
import java.util.List;
import javax.swing.Action;
import org.apache.commons.lang3.tuple.Pair;
import org.openide.nodes.Sheet;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable;
import static org.sleuthkit.autopsy.datamodel.AbstractContentNode.NO_DESCR;
import org.sleuthkit.datamodel.Pool;
import org.sleuthkit.datamodel.Tag;
/**
* This class is used to represent the "Node" for the pool.
*/
public class PoolNode extends AbstractContentNode<Pool> {
/**
* Helper so that the display name and the name used in building the path
* are determined the same way.
*
* @param pool Pool to get the name of
*
* @return short name for the pool
*/
static String nameForPool(Pool pool) {
return pool.getType().getName();
}
/**
*
* @param pool underlying Content instance
*/
public PoolNode(Pool pool) {
super(pool);
// set name, display name, and icon
String poolName = nameForPool(pool);
this.setDisplayName(poolName);
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/pool-icon.png"); //NON-NLS
}
/**
* Right click action for volume node
*
* @param popup
*
* @return
*/
@Override
public Action[] getActions(boolean popup) {
List<Action> actionsList = new ArrayList<>();
for (Action a : super.getActions(true)) {
actionsList.add(a);
}
return actionsList.toArray(new Action[actionsList.size()]);
}
@NbBundle.Messages({
"PoolNode.createSheet.name.name=Name",
"PoolNode.createSheet.name.displayName=Name",
"PoolNode.createSheet.name.desc=no description",
"PoolNode.createSheet.offset.name=Starting offset",
"PoolNode.createSheet.offset.displayName=Starting offset",
"PoolNode.createSheet.offset.desc=no description",
"PoolNode.createSheet.type.name=Type",
"PoolNode.createSheet.type.displayName=Type",
"PoolNode.createSheet.type.desc=no description",
})
@Override
protected Sheet createSheet() {
Sheet sheet = super.createSheet();
Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
if (sheetSet == null) {
sheetSet = Sheet.createPropertiesSet();
sheet.put(sheetSet);
}
Pool pool = this.getContent();
sheetSet.put(new NodeProperty<>(Bundle.PoolNode_createSheet_name_name(),
Bundle.PoolNode_createSheet_name_displayName(),
Bundle.PoolNode_createSheet_name_desc(),
this.getDisplayName()));
sheetSet.put(new NodeProperty<>(Bundle.PoolNode_createSheet_offset_name(),
Bundle.PoolNode_createSheet_offset_displayName(),
Bundle.PoolNode_createSheet_offset_desc(),
pool.getOffset()));
sheetSet.put(new NodeProperty<>(Bundle.PoolNode_createSheet_type_name(),
Bundle.PoolNode_createSheet_type_displayName(),
Bundle.PoolNode_createSheet_type_desc(),
pool.getType().getName()));
return sheet;
}
@Override
public <T> T accept(ContentNodeVisitor<T> visitor) {
return visitor.visit(this);
}
@Override
public boolean isLeafTypeNode() {
return false;
}
@Override
public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
return visitor.visit(this);
}
@Override
public String getItemType() {
return getClass().getName();
}
/**
* Reads and returns a list of all tags associated with this content node.
*
* Null implementation of an abstract method.
*
* @return list of tags associated with the node.
*/
@Override
protected List<Tag> getAllTagsFromDatabase() {
return new ArrayList<>();
}
/**
* Returns correlation attribute instance for the underlying content of the
* node.
*
* Null implementation of an abstract method.
*
* @return correlation attribute instance for the underlying content of the
* node.
*/
@Override
protected CorrelationAttributeInstance getCorrelationAttributeInstance() {
return null;
}
/**
* Returns Score property for the node.
*
* Null implementation of an abstract method.
*
* @param tags list of tags.
*
* @return Score property for the underlying content of the node.
*/
@Override
protected Pair<DataResultViewerTable.Score, String> getScorePropertyAndDescription(List<Tag> tags) {
return Pair.of(DataResultViewerTable.Score.NO_SCORE, NO_DESCR);
}
/**
* Returns comment property for the node.
*
* Null implementation of an abstract method.
*
* @param tags list of tags
* @param attribute correlation attribute instance
*
* @return Comment property for the underlying content of the node.
*/
@Override
protected DataResultViewerTable.HasCommentStatus getCommentProperty(List<Tag> tags, CorrelationAttributeInstance attribute) {
return DataResultViewerTable.HasCommentStatus.NO_COMMENT;
}
/**
* Returns occurrences/count property for the node.
*
* Null implementation of an abstract method.
*
* @param attributeType the type of the attribute to count
* @param attributeValue the value of the attribute to coun
* @param defaultDescription a description to use when none is determined by
* the getCountPropertyAndDescription method
*
* @return count property for the underlying content of the node.
*/
@Override
protected Pair<Long, String> getCountPropertyAndDescription(CorrelationAttributeInstance.Type attributeType, String attributeValue, String defaultDescription) {
return Pair.of(-1L, NO_DESCR);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -30,6 +30,7 @@ import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Image;
import org.sleuthkit.datamodel.VirtualDirectory;
import org.sleuthkit.datamodel.LocalDirectory;
import org.sleuthkit.datamodel.Pool;
import org.sleuthkit.datamodel.Report;
import org.sleuthkit.datamodel.TskException;
import org.sleuthkit.datamodel.Volume;
@ -71,6 +72,11 @@ abstract class GetFilesContentVisitor implements ContentVisitor<Collection<Abstr
public Collection<AbstractFile> visit(VolumeSystem vs) {
return getAllFromChildren(vs);
}
@Override
public Collection<AbstractFile> visit(Pool pool) {
return getAllFromChildren(pool);
}
@Override
public Collection<AbstractFile> visit(Report r) {