mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 01:07:42 +00:00
Added content to ArtifactData to optimize getting time, source file.
This commit is contained in:
parent
6c947ceaeb
commit
eb425bbfd9
@ -51,12 +51,15 @@ import javax.swing.JDialog;
|
|||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.SwingWorker;
|
import javax.swing.SwingWorker;
|
||||||
import org.openide.filesystems.FileUtil;
|
import org.openide.filesystems.FileUtil;
|
||||||
|
import org.openide.util.Exceptions;
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
import org.sleuthkit.autopsy.casemodule.Case;
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
|
import org.sleuthkit.autopsy.core.UserPreferences;
|
||||||
import org.sleuthkit.autopsy.coreutils.EscapeUtil;
|
import org.sleuthkit.autopsy.coreutils.EscapeUtil;
|
||||||
import org.sleuthkit.autopsy.coreutils.ImageUtils;
|
import org.sleuthkit.autopsy.coreutils.ImageUtils;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||||
|
import org.sleuthkit.autopsy.datamodel.ContentUtils;
|
||||||
import org.sleuthkit.autopsy.report.ReportProgressPanel.ReportStatus;
|
import org.sleuthkit.autopsy.report.ReportProgressPanel.ReportStatus;
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||||
@ -1759,11 +1762,10 @@ class ReportGenerator {
|
|||||||
*
|
*
|
||||||
* @return String unique path
|
* @return String unique path
|
||||||
*/
|
*/
|
||||||
private String getFileUniquePath(long objId) {
|
private String getFileUniquePath(Content content) {
|
||||||
try {
|
try {
|
||||||
AbstractFile af = skCase.getAbstractFileById(objId);
|
if (content != null) {
|
||||||
if (af != null) {
|
return content.getUniquePath();
|
||||||
return af.getUniquePath();
|
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -1785,11 +1787,17 @@ class ReportGenerator {
|
|||||||
private List<BlackboardAttribute> attributes;
|
private List<BlackboardAttribute> attributes;
|
||||||
private HashSet<String> tags;
|
private HashSet<String> tags;
|
||||||
private List<String> rowData = null;
|
private List<String> rowData = null;
|
||||||
|
private Content content;
|
||||||
|
|
||||||
ArtifactData(BlackboardArtifact artifact, List<BlackboardAttribute> attrs, HashSet<String> tags) {
|
ArtifactData(BlackboardArtifact artifact, List<BlackboardAttribute> attrs, HashSet<String> tags) {
|
||||||
this.artifact = artifact;
|
this.artifact = artifact;
|
||||||
this.attributes = attrs;
|
this.attributes = attrs;
|
||||||
this.tags = tags;
|
this.tags = tags;
|
||||||
|
try {
|
||||||
|
this.content = Case.getCurrentCase().getSleuthkitCase().getContentById(artifact.getObjectID());
|
||||||
|
} catch (TskCoreException ex) {
|
||||||
|
logger.log(Level.SEVERE, "Could not get content from database");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlackboardArtifact getArtifact() {
|
public BlackboardArtifact getArtifact() {
|
||||||
@ -1812,6 +1820,13 @@ class ReportGenerator {
|
|||||||
return artifact.getObjectID();
|
return artifact.getObjectID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the content
|
||||||
|
*/
|
||||||
|
public Content getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compares ArtifactData objects by the first attribute they have in
|
* Compares ArtifactData objects by the first attribute they have in
|
||||||
* common in their List<BlackboardAttribute>. Should only be used on two
|
* common in their List<BlackboardAttribute>. Should only be used on two
|
||||||
@ -1881,8 +1896,8 @@ class ReportGenerator {
|
|||||||
|
|
||||||
List<String> orderedRowData = new ArrayList<>();
|
List<String> orderedRowData = new ArrayList<>();
|
||||||
if (ARTIFACT_TYPE.TSK_EXT_MISMATCH_DETECTED.getTypeID() == getArtifact().getArtifactTypeID()) {
|
if (ARTIFACT_TYPE.TSK_EXT_MISMATCH_DETECTED.getTypeID() == getArtifact().getArtifactTypeID()) {
|
||||||
AbstractFile file = skCase.getAbstractFileById(getObjectID());
|
if (content != null && content instanceof AbstractFile) {
|
||||||
if (file != null) {
|
AbstractFile file = (AbstractFile) content;
|
||||||
orderedRowData.add(file.getName());
|
orderedRowData.add(file.getName());
|
||||||
orderedRowData.add(file.getNameExtension());
|
orderedRowData.add(file.getNameExtension());
|
||||||
String mimeType = file.getMIMEType();
|
String mimeType = file.getMIMEType();
|
||||||
@ -1913,7 +1928,7 @@ class ReportGenerator {
|
|||||||
} else if (attr.getAttributeType().equals(new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_PATH))) {
|
} else if (attr.getAttributeType().equals(new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_PATH))) {
|
||||||
String pathToShow = attr.getDisplayString();
|
String pathToShow = attr.getDisplayString();
|
||||||
if (pathToShow.isEmpty()) {
|
if (pathToShow.isEmpty()) {
|
||||||
pathToShow = getFileUniquePath(getObjectID());
|
pathToShow = getFileUniquePath(getContent());
|
||||||
}
|
}
|
||||||
attributeDataArray[2] = pathToShow;
|
attributeDataArray[2] = pathToShow;
|
||||||
}
|
}
|
||||||
@ -1933,6 +1948,7 @@ class ReportGenerator {
|
|||||||
|
|
||||||
return orderedRowData;
|
return orderedRowData;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1999,7 +2015,11 @@ class ReportGenerator {
|
|||||||
List<BlackboardAttribute> attributes = artData.getAttributes();
|
List<BlackboardAttribute> attributes = artData.getAttributes();
|
||||||
for (BlackboardAttribute attribute : attributes) {
|
for (BlackboardAttribute attribute : attributes) {
|
||||||
if (attribute.getAttributeType().equals(this.attributeType)) {
|
if (attribute.getAttributeType().equals(this.attributeType)) {
|
||||||
|
if (attribute.getAttributeType().getValueType() != BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME) {
|
||||||
return attribute.getDisplayString();
|
return attribute.getDisplayString();
|
||||||
|
} else {
|
||||||
|
return ContentUtils.getStringTime(attribute.getValueLong(), artData.getContent());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
@ -2027,7 +2047,7 @@ class ReportGenerator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCellData(ArtifactData artData) {
|
public String getCellData(ArtifactData artData) {
|
||||||
return getFileUniquePath(artData.getObjectID());
|
return getFileUniquePath(artData.getContent());
|
||||||
/*else if (this.columnHeader.equals(NbBundle.getMessage(this.getClass(), "ReportGenerator.artTableColHdr.tags"))) {
|
/*else if (this.columnHeader.equals(NbBundle.getMessage(this.getClass(), "ReportGenerator.artTableColHdr.tags"))) {
|
||||||
return makeCommaSeparatedList(artData.getTags());
|
return makeCommaSeparatedList(artData.getTags());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user