mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
updates
This commit is contained in:
parent
6b683a5813
commit
1333001b94
@ -150,15 +150,16 @@ abstract class BlackboardArtifactDAO extends AbstractDAO {
|
||||
return IGNORED_TYPES;
|
||||
}
|
||||
|
||||
TableData createTableData(BlackboardArtifact.Type artType, List<BlackboardArtifact> arts) throws TskCoreException, NoCurrentCaseException {
|
||||
TableData createTableData(BlackboardArtifact.Type artType, List<? extends BlackboardArtifact> arts) throws TskCoreException, NoCurrentCaseException {
|
||||
// A linked hashmap is being used for artifactAttributes to ensure that artifact order
|
||||
// as well as attribute orders within those artifacts are preserved. This is to maintain
|
||||
// a consistent ordering of attribute columns as received from BlackboardArtifact.getAttributes
|
||||
Map<Long, Map<BlackboardAttribute.Type, Object>> artifactAttributes = new LinkedHashMap<>();
|
||||
for (BlackboardArtifact art : arts) {
|
||||
BlackboardArtifact.Type thisArtType = artType != null ? artType : art.getType();
|
||||
Map<BlackboardAttribute.Type, Object> attrs = art.getAttributes().stream()
|
||||
.filter(attr -> isRenderedAttr(artType, attr.getAttributeType()))
|
||||
.collect(Collectors.toMap(attr -> attr.getAttributeType(), attr -> getAttrValue(artType, attr), (attr1, attr2) -> attr1, LinkedHashMap::new));
|
||||
.filter(attr -> isRenderedAttr(thisArtType, attr.getAttributeType()))
|
||||
.collect(Collectors.toMap(attr -> attr.getAttributeType(), attr -> getAttrValue(thisArtType, attr), (attr1, attr2) -> attr1, LinkedHashMap::new));
|
||||
|
||||
artifactAttributes.put(art.getId(), attrs);
|
||||
}
|
||||
@ -205,7 +206,8 @@ abstract class BlackboardArtifactDAO extends AbstractDAO {
|
||||
cellValues.add(dataSourceName);
|
||||
|
||||
AbstractFile linkedFile = null;
|
||||
if (artType.getCategory().equals(BlackboardArtifact.Category.DATA_ARTIFACT)) {
|
||||
BlackboardArtifact.Type thisArtType = artType != null ? artType : artifact.getType();
|
||||
if (thisArtType.getCategory().equals(BlackboardArtifact.Category.DATA_ARTIFACT)) {
|
||||
// Note that we need to get the attribute from the original artifact since it is not displayed.
|
||||
if (artifact.getAttribute(BlackboardAttribute.Type.TSK_PATH_ID) != null) {
|
||||
long linkedId = artifact.getAttribute(BlackboardAttribute.Type.TSK_PATH_ID).getValueLong();
|
||||
@ -469,7 +471,7 @@ abstract class BlackboardArtifactDAO extends AbstractDAO {
|
||||
return pagedArtsStream.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
class TableData {
|
||||
static class TableData {
|
||||
|
||||
final List<ColumnKey> columnKeys;
|
||||
final List<RowDTO> rows;
|
||||
|
@ -51,6 +51,7 @@ import org.sleuthkit.autopsy.ingest.ModuleDataEvent;
|
||||
import static org.sleuthkit.autopsy.mainui.datamodel.AbstractDAO.CACHE_DURATION;
|
||||
import static org.sleuthkit.autopsy.mainui.datamodel.AbstractDAO.CACHE_DURATION_UNITS;
|
||||
import static org.sleuthkit.autopsy.mainui.datamodel.AbstractDAO.CACHE_SIZE;
|
||||
import org.sleuthkit.autopsy.mainui.datamodel.BlackboardArtifactDAO.TableData;
|
||||
import org.sleuthkit.autopsy.mainui.datamodel.TreeResultsDTO.TreeDisplayCount;
|
||||
import org.sleuthkit.autopsy.mainui.datamodel.TreeResultsDTO.TreeItemDTO;
|
||||
import org.sleuthkit.autopsy.mainui.datamodel.events.DAOEventUtils;
|
||||
@ -232,13 +233,13 @@ public class ScoreDAO extends AbstractDAO {
|
||||
|
||||
String countQuery = " COUNT(art_files.obj_id) AS count\n" + baseQuery;
|
||||
|
||||
AtomicLong count = new AtomicLong(0);
|
||||
AtomicLong totalCountRef = new AtomicLong(0);
|
||||
AtomicReference<SQLException> countException = new AtomicReference<>(null);
|
||||
getCase().getCaseDbAccessManager()
|
||||
.select(countQuery, (rs) -> {
|
||||
try {
|
||||
if (rs.next()) {
|
||||
count.set(rs.getLong("count"));
|
||||
totalCountRef.set(rs.getLong("count"));
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
countException.set(ex);
|
||||
@ -295,20 +296,20 @@ public class ScoreDAO extends AbstractDAO {
|
||||
|
||||
List<AbstractFile> files = getCase().findAllFilesWhere("obj_id IN (" + joinedFileIds + ")");
|
||||
|
||||
// for (AbstractFile file : files) {
|
||||
//
|
||||
// List<Object> cellValues = FileSystemColumnUtils.getCellValuesForAbstractFile(file);
|
||||
//
|
||||
// dataRows.add(new FileRowDTO(
|
||||
// file,
|
||||
// file.getId(),
|
||||
// file.getName(),
|
||||
// file.getNameExtension(),
|
||||
// MediaTypeUtils.getExtensionMediaType(file.getNameExtension()),
|
||||
// file.isDirNameFlagSet(TSK_FS_NAME_FLAG_ENUM.ALLOC),
|
||||
// file.getType(),
|
||||
// cellValues));
|
||||
// }
|
||||
for (AbstractFile file : files) {
|
||||
|
||||
List<Object> cellValues = FileSystemColumnUtils.getCellValuesForAbstractFile(file);
|
||||
|
||||
dataRows.add(new FileRowDTO(
|
||||
file,
|
||||
file.getId(),
|
||||
file.getName(),
|
||||
file.getNameExtension(),
|
||||
MediaTypeUtils.getExtensionMediaType(file.getNameExtension()),
|
||||
file.isDirNameFlagSet(TSK_FS_NAME_FLAG_ENUM.ALLOC),
|
||||
file.getType(),
|
||||
cellValues));
|
||||
}
|
||||
}
|
||||
|
||||
if (!artifactIds.isEmpty()) {
|
||||
@ -317,14 +318,18 @@ public class ScoreDAO extends AbstractDAO {
|
||||
.collect(Collectors.joining(", "));
|
||||
|
||||
List<DataArtifact> dataArtifacts = getCase().getBlackboard().getDataArtifactsWhere("obj_id IN (" + joinedArtifactIds + ")");
|
||||
// for (DataArtifact dataArt: dataArtifacts) {
|
||||
// MainDAO.getInstance().getDataArtifactsDAO().create
|
||||
// dataRows.add(new DataArtifactRowDTO(dataArt, srcContent, linkedFile, isTimelineSupported, cellValues, id));
|
||||
// }
|
||||
|
||||
TableData artTableData = MainDAO.getInstance().getDataArtifactsDAO().createTableData(null, dataArtifacts);
|
||||
dataRows.addAll(artTableData.rows);
|
||||
}
|
||||
//
|
||||
return new BaseSearchResultsDTO(FILE_VIEW_EXT_TYPE_ID, displayName, FileSystemColumnUtils.getColumnKeysForAbstractfile(), fileRows, AbstractFile.class.getName(), startItem, totalResultsCount);
|
||||
return new BaseSearchResultsDTO(
|
||||
SCORE_TYPE_ID,
|
||||
SCORE_DISPLAY_NAME,
|
||||
SCORE_COLUMNS,
|
||||
dataRows,
|
||||
signature,
|
||||
startItem,
|
||||
totalCountRef.get());
|
||||
}
|
||||
|
||||
private TreeItemDTO<?> createTreeItem(DAOEvent daoEvent, TreeDisplayCount count) {
|
||||
|
@ -50,6 +50,7 @@ import org.sleuthkit.autopsy.mainui.datamodel.events.DAOAggregateEvent;
|
||||
import org.sleuthkit.autopsy.mainui.datamodel.events.DAOEvent;
|
||||
import org.sleuthkit.autopsy.mainui.datamodel.events.HostPersonEvent;
|
||||
import org.sleuthkit.autopsy.mainui.datamodel.events.TreeEvent;
|
||||
import org.sleuthkit.autopsy.mainui.nodes.ScoreTypeFactory.ScoreParentNode;
|
||||
import org.sleuthkit.autopsy.mainui.nodes.TreeNode.StaticTreeNode;
|
||||
import org.sleuthkit.datamodel.DataSource;
|
||||
import org.sleuthkit.datamodel.Host;
|
||||
@ -194,6 +195,7 @@ public class RootFactory {
|
||||
new AnalysisResultsRootNode(null),
|
||||
new OsAccountsRootNode(null),
|
||||
new TagsRootNode(null),
|
||||
|
||||
new ReportsRootNode()
|
||||
));
|
||||
}
|
||||
@ -505,6 +507,7 @@ public class RootFactory {
|
||||
new DataArtifactsRootNode(dataSourceObjId),
|
||||
new AnalysisResultsRootNode(dataSourceObjId),
|
||||
new OsAccountsRootNode(dataSourceObjId),
|
||||
new ScoreParentNode(dataSourceObjId),
|
||||
new TagsRootNode(dataSourceObjId)
|
||||
));
|
||||
}
|
||||
@ -722,38 +725,6 @@ public class RootFactory {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Root node for displaying "Score" for file types.
|
||||
*/
|
||||
@Messages({"RootFactory_ScoresRootNode_displayName=Score"})
|
||||
public static class ScoresRootNode extends StaticTreeNode {
|
||||
|
||||
private static final String NAME_PREFIX = "VIEWS";
|
||||
|
||||
/**
|
||||
* Returns the name prefix of this node.
|
||||
*
|
||||
* @return The name prefix.
|
||||
*/
|
||||
public static final String getNamePrefix() {
|
||||
return NAME_PREFIX;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main constructor.
|
||||
*
|
||||
* @param dataSourceObjId The data source object id or null for no
|
||||
* filter.
|
||||
*/
|
||||
public ScoresRootNode(Long dataSourceObjId) {
|
||||
super(NAME_PREFIX + "_" + getLongString(dataSourceObjId),
|
||||
Bundle.RootFactory_ScoresRootNode_displayName(),
|
||||
"org/sleuthkit/autopsy/images/red-circle-exclamation.png",
|
||||
new ScoreTypeFactory.ScoreChildren(dataSourceObjId));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Root node for reports in the tree.
|
||||
*/
|
||||
|
@ -54,10 +54,10 @@ public class ScoreTypeFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parent of file size nodes in the tree.
|
||||
* Parent of score nodes in the tree.
|
||||
*/
|
||||
@Messages({"ScoreTypeFactory_ScoreParentNode_displayName=Score"})
|
||||
static class ScoreParentNode extends StaticTreeNode {
|
||||
public static class ScoreParentNode extends StaticTreeNode {
|
||||
|
||||
ScoreParentNode(Long dataSourceId) {
|
||||
super(
|
||||
|
Loading…
x
Reference in New Issue
Block a user