mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
Merge pull request #6972 from kellykelly3/7597-metadata-content-viewer-edt-change
7597 - Removed the db calls for metadata content pane from edt
This commit is contained in:
commit
91cc8934f3
@ -85,6 +85,7 @@ MediaViewVideoPanel.progressLabel.text=00:00
|
|||||||
MediaViewVideoPanel.infoLabel.text=info
|
MediaViewVideoPanel.infoLabel.text=info
|
||||||
MediaViewImagePanel.imgFileTooLarge.msg=Could not load image file (too large): {0}
|
MediaViewImagePanel.imgFileTooLarge.msg=Could not load image file (too large): {0}
|
||||||
|
|
||||||
|
Metadata.nodeText.loading=Metadata loading...
|
||||||
Metadata.nodeText.none=None
|
Metadata.nodeText.none=None
|
||||||
Metadata.nodeText.truncated=(results truncated)
|
Metadata.nodeText.truncated=(results truncated)
|
||||||
Metadata.nodeText.unknown=Unknown
|
Metadata.nodeText.unknown=Unknown
|
||||||
|
@ -19,10 +19,14 @@
|
|||||||
package org.sleuthkit.autopsy.contentviewers;
|
package org.sleuthkit.autopsy.contentviewers;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
|
import java.awt.Cursor;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
import javax.swing.SwingWorker;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.openide.nodes.Node;
|
import org.openide.nodes.Node;
|
||||||
|
import org.openide.util.Exceptions;
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
import org.openide.util.NbBundle.Messages;
|
import org.openide.util.NbBundle.Messages;
|
||||||
import org.openide.util.lookup.ServiceProvider;
|
import org.openide.util.lookup.ServiceProvider;
|
||||||
@ -51,6 +55,8 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer {
|
|||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(Metadata.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(Metadata.class.getName());
|
||||||
|
|
||||||
|
private MetaDataWorker worker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form Metadata
|
* Creates new form Metadata
|
||||||
*/
|
*/
|
||||||
@ -145,173 +151,54 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer {
|
|||||||
"Metadata.tableRowTitle.acquisitionDetails=Acquisition Details",
|
"Metadata.tableRowTitle.acquisitionDetails=Acquisition Details",
|
||||||
"Metadata.tableRowTitle.downloadSource=Downloaded From",
|
"Metadata.tableRowTitle.downloadSource=Downloaded From",
|
||||||
"Metadata.nodeText.unknown=Unknown",
|
"Metadata.nodeText.unknown=Unknown",
|
||||||
"Metadata.nodeText.none=None"})
|
"Metadata.nodeText.none=None",
|
||||||
|
"Metadata.nodeText.loading=Metadata loading..."})
|
||||||
@Override
|
@Override
|
||||||
public void setNode(Node node) {
|
public void setNode(Node node) {
|
||||||
AbstractFile file = node.getLookup().lookup(AbstractFile.class);
|
|
||||||
Image image = node.getLookup().lookup(Image.class);
|
if (worker != null) {
|
||||||
DataSource dataSource = node.getLookup().lookup(DataSource.class);
|
worker.cancel(true);
|
||||||
if (file == null && image == null) {
|
worker = null;
|
||||||
setText(NbBundle.getMessage(this.getClass(), "Metadata.nodeText.nonFilePassedIn"));
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
if (node != null) {
|
||||||
startTable(sb);
|
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||||
|
setText(Bundle.Metadata_nodeText_loading());
|
||||||
if (file != null) {
|
worker = new MetaDataWorker(node) {
|
||||||
try {
|
@Override
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.name"), file.getUniquePath());
|
public void done() {
|
||||||
} catch (TskCoreException ex) {
|
try {
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.name"), file.getParentPath() + "/" + file.getName());
|
if (!isCancelled()) {
|
||||||
}
|
setText(get());
|
||||||
|
jTextPane1.setCaretPosition(0);
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.type"), file.getType().getName());
|
|
||||||
addRow(sb, Bundle.Metadata_tableRowTitle_mimeType(), file.getMIMEType());
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.size"), Long.toString(file.getSize()));
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.fileNameAlloc"), file.getDirFlagAsString());
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.metadataAlloc"), file.getMetaFlagsAsString());
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.modified"), ContentUtils.getStringTime(file.getMtime(), file));
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.accessed"), ContentUtils.getStringTime(file.getAtime(), file));
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.created"), ContentUtils.getStringTime(file.getCrtime(), file));
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.changed"), ContentUtils.getStringTime(file.getCtime(), file));
|
|
||||||
|
|
||||||
|
|
||||||
String md5 = file.getMd5Hash();
|
|
||||||
if (md5 == null) {
|
|
||||||
md5 = NbBundle.getMessage(this.getClass(), "Metadata.tableRowContent.md5notCalc");
|
|
||||||
}
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.md5"), md5);
|
|
||||||
String sha256 = file.getSha256Hash();
|
|
||||||
if (sha256 == null) {
|
|
||||||
sha256 = NbBundle.getMessage(this.getClass(), "Metadata.tableRowContent.md5notCalc");
|
|
||||||
}
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.sha256"), sha256);
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.hashLookupResults"), file.getKnown().toString());
|
|
||||||
addAcquisitionDetails(sb, dataSource);
|
|
||||||
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.internalid"), Long.toString(file.getId()));
|
|
||||||
if (file.getType().compareTo(TSK_DB_FILES_TYPE_ENUM.LOCAL) == 0) {
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.localPath"), file.getLocalAbsPath());
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
List<BlackboardArtifact> associatedObjectArtifacts = file.getArtifacts(ARTIFACT_TYPE.TSK_ASSOCIATED_OBJECT);
|
|
||||||
if (!associatedObjectArtifacts.isEmpty()) {
|
|
||||||
BlackboardArtifact artifact = associatedObjectArtifacts.get(0);
|
|
||||||
BlackboardAttribute associatedArtifactAttribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT));
|
|
||||||
if (associatedArtifactAttribute != null) {
|
|
||||||
long artifactId = associatedArtifactAttribute.getValueLong();
|
|
||||||
BlackboardArtifact associatedArtifact = artifact.getSleuthkitCase().getBlackboardArtifact(artifactId);
|
|
||||||
addDownloadSourceRow(sb, associatedArtifact);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (TskCoreException ex) {
|
|
||||||
sb.append(NbBundle.getMessage(this.getClass(), "Metadata.nodeText.exceptionNotice.text")).append(ex.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
endTable(sb);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If we have a file system file, grab the more detailed metadata text
|
|
||||||
* too
|
|
||||||
*/
|
|
||||||
try {
|
|
||||||
if (file instanceof FsContent) {
|
|
||||||
FsContent fsFile = (FsContent) file;
|
|
||||||
|
|
||||||
sb.append("<hr /><pre>\n"); //NON-NLS
|
|
||||||
sb.append(NbBundle.getMessage(this.getClass(), "Metadata.nodeText.text"));
|
|
||||||
sb.append(" <br /><br />"); // NON-NLS
|
|
||||||
for (String str : fsFile.getMetaDataText()) {
|
|
||||||
sb.append(str).append("<br />"); //NON-NLS
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Very long results can cause the UI to hang before displaying,
|
|
||||||
* so truncate the results if necessary.
|
|
||||||
*/
|
|
||||||
if(sb.length() > 50000){
|
|
||||||
sb.append(NbBundle.getMessage(this.getClass(), "Metadata.nodeText.truncated"));
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
} catch (InterruptedException | ExecutionException ex) {
|
||||||
|
LOGGER.log(Level.SEVERE, "Failed to get metaData for node " + node.getName(), ex);
|
||||||
}
|
}
|
||||||
sb.append("</pre>\n"); //NON-NLS
|
|
||||||
|
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
||||||
}
|
}
|
||||||
} catch (TskCoreException ex) {
|
};
|
||||||
sb.append(NbBundle.getMessage(this.getClass(), "Metadata.nodeText.exceptionNotice.text")).append(ex.getLocalizedMessage());
|
|
||||||
}
|
worker.execute();
|
||||||
} else {
|
} else {
|
||||||
try {
|
setText("");
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.name"), image.getUniquePath());
|
|
||||||
} catch (TskCoreException ex) {
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.name"), image.getName());
|
|
||||||
}
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.imageType"), image.getType().getName());
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.size"), Long.toString(image.getSize()));
|
|
||||||
|
|
||||||
try {
|
|
||||||
String md5 = image.getMd5();
|
|
||||||
if (md5 == null || md5.isEmpty()) {
|
|
||||||
md5 = NbBundle.getMessage(this.getClass(), "Metadata.tableRowContent.md5notCalc");
|
|
||||||
}
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.md5"), md5);
|
|
||||||
|
|
||||||
String sha1 = image.getSha1();
|
|
||||||
if (sha1 == null || sha1.isEmpty()) {
|
|
||||||
sha1 = NbBundle.getMessage(this.getClass(), "Metadata.tableRowContent.md5notCalc");
|
|
||||||
}
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.sha1"), sha1);
|
|
||||||
|
|
||||||
String sha256 = image.getSha256();
|
|
||||||
if (sha256 == null || sha256.isEmpty()) {
|
|
||||||
sha256 = NbBundle.getMessage(this.getClass(), "Metadata.tableRowContent.md5notCalc");
|
|
||||||
}
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.sha256"), sha256);
|
|
||||||
} catch (TskCoreException ex) {
|
|
||||||
sb.append(NbBundle.getMessage(this.getClass(), "Metadata.nodeText.exceptionNotice.text")).append(ex.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.sectorSize"), Long.toString(image.getSsize()));
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.timezone"), image.getTimeZone());
|
|
||||||
addAcquisitionDetails(sb, dataSource);
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.deviceId"), image.getDeviceId());
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.internalid"), Long.toString(image.getId()));
|
|
||||||
|
|
||||||
// Add all the data source paths to the "Local Path" value cell.
|
|
||||||
String[] imagePaths = image.getPaths();
|
|
||||||
if (imagePaths.length > 0) {
|
|
||||||
StringBuilder pathValues = new StringBuilder("<div>");
|
|
||||||
pathValues.append(imagePaths[0]);
|
|
||||||
pathValues.append("</div>");
|
|
||||||
for (int i=1; i < imagePaths.length; i++) {
|
|
||||||
pathValues.append("<div>");
|
|
||||||
pathValues.append(imagePaths[i]);
|
|
||||||
pathValues.append("</div>");
|
|
||||||
}
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.localPath"), pathValues.toString());
|
|
||||||
} else {
|
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.localPath"),
|
|
||||||
NbBundle.getMessage(this.getClass(), "Metadata.nodeText.none"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setText(sb.toString());
|
|
||||||
jTextPane1.setCaretPosition(0);
|
|
||||||
this.setCursor(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a row for download source from the given associated artifact,
|
* Adds a row for download source from the given associated artifact, if the
|
||||||
* if the associated artifacts specifies a source.
|
* associated artifacts specifies a source.
|
||||||
*
|
*
|
||||||
* @param sb string builder.
|
* @param sb string builder.
|
||||||
* @param associatedArtifact
|
* @param associatedArtifact
|
||||||
*
|
*
|
||||||
* @throws TskCoreException if there is an error
|
* @throws TskCoreException if there is an error
|
||||||
*/
|
*/
|
||||||
private void addDownloadSourceRow(StringBuilder sb, BlackboardArtifact associatedArtifact ) throws TskCoreException {
|
private void addDownloadSourceRow(StringBuilder sb, BlackboardArtifact associatedArtifact) throws TskCoreException {
|
||||||
if (associatedArtifact != null &&
|
if (associatedArtifact != null
|
||||||
((associatedArtifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()) ||
|
&& ((associatedArtifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID())
|
||||||
(associatedArtifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID())) ) {
|
|| (associatedArtifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID()))) {
|
||||||
BlackboardAttribute urlAttr = associatedArtifact.getAttribute(new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_URL));
|
BlackboardAttribute urlAttr = associatedArtifact.getAttribute(new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_URL));
|
||||||
if (urlAttr != null) {
|
if (urlAttr != null) {
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.downloadSource"), urlAttr.getValueString());
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.downloadSource"), urlAttr.getValueString());
|
||||||
@ -376,4 +263,169 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer {
|
|||||||
public int isPreferred(Node node) {
|
public int isPreferred(Node node) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SwingWorker for gathering the file metadata.
|
||||||
|
*/
|
||||||
|
private class MetaDataWorker extends SwingWorker<String, Void> {
|
||||||
|
|
||||||
|
private final Node node;
|
||||||
|
|
||||||
|
MetaDataWorker(Node node) {
|
||||||
|
this.node = node;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String doInBackground() throws Exception {
|
||||||
|
AbstractFile file = node.getLookup().lookup(AbstractFile.class);
|
||||||
|
Image image = node.getLookup().lookup(Image.class);
|
||||||
|
DataSource dataSource = node.getLookup().lookup(DataSource.class);
|
||||||
|
if (file == null && image == null) {
|
||||||
|
return NbBundle.getMessage(this.getClass(), "Metadata.nodeText.nonFilePassedIn");
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
startTable(sb);
|
||||||
|
|
||||||
|
if (file != null) {
|
||||||
|
try {
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.name"), file.getUniquePath());
|
||||||
|
} catch (TskCoreException ex) {
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.name"), file.getParentPath() + "/" + file.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.type"), file.getType().getName());
|
||||||
|
addRow(sb, Bundle.Metadata_tableRowTitle_mimeType(), file.getMIMEType());
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.size"), Long.toString(file.getSize()));
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.fileNameAlloc"), file.getDirFlagAsString());
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.metadataAlloc"), file.getMetaFlagsAsString());
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.modified"), ContentUtils.getStringTime(file.getMtime(), file));
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.accessed"), ContentUtils.getStringTime(file.getAtime(), file));
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.created"), ContentUtils.getStringTime(file.getCrtime(), file));
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.changed"), ContentUtils.getStringTime(file.getCtime(), file));
|
||||||
|
|
||||||
|
String md5 = file.getMd5Hash();
|
||||||
|
if (md5 == null) {
|
||||||
|
md5 = NbBundle.getMessage(this.getClass(), "Metadata.tableRowContent.md5notCalc");
|
||||||
|
}
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.md5"), md5);
|
||||||
|
String sha256 = file.getSha256Hash();
|
||||||
|
if (sha256 == null) {
|
||||||
|
sha256 = NbBundle.getMessage(this.getClass(), "Metadata.tableRowContent.md5notCalc");
|
||||||
|
}
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.sha256"), sha256);
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.hashLookupResults"), file.getKnown().toString());
|
||||||
|
addAcquisitionDetails(sb, dataSource);
|
||||||
|
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.internalid"), Long.toString(file.getId()));
|
||||||
|
if (file.getType().compareTo(TSK_DB_FILES_TYPE_ENUM.LOCAL) == 0) {
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.localPath"), file.getLocalAbsPath());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
List<BlackboardArtifact> associatedObjectArtifacts = file.getArtifacts(ARTIFACT_TYPE.TSK_ASSOCIATED_OBJECT);
|
||||||
|
if (!associatedObjectArtifacts.isEmpty()) {
|
||||||
|
BlackboardArtifact artifact = associatedObjectArtifacts.get(0);
|
||||||
|
BlackboardAttribute associatedArtifactAttribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT));
|
||||||
|
if (associatedArtifactAttribute != null) {
|
||||||
|
long artifactId = associatedArtifactAttribute.getValueLong();
|
||||||
|
BlackboardArtifact associatedArtifact = artifact.getSleuthkitCase().getBlackboardArtifact(artifactId);
|
||||||
|
addDownloadSourceRow(sb, associatedArtifact);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (TskCoreException ex) {
|
||||||
|
sb.append(NbBundle.getMessage(this.getClass(), "Metadata.nodeText.exceptionNotice.text")).append(ex.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
endTable(sb);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we have a file system file, grab the more detailed
|
||||||
|
* metadata text too
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
if (file instanceof FsContent) {
|
||||||
|
FsContent fsFile = (FsContent) file;
|
||||||
|
|
||||||
|
sb.append("<hr /><pre>\n"); //NON-NLS
|
||||||
|
sb.append(NbBundle.getMessage(this.getClass(), "Metadata.nodeText.text"));
|
||||||
|
sb.append(" <br /><br />"); // NON-NLS
|
||||||
|
for (String str : fsFile.getMetaDataText()) {
|
||||||
|
sb.append(str).append("<br />"); //NON-NLS
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Very long results can cause the UI to hang before
|
||||||
|
* displaying, so truncate the results if necessary.
|
||||||
|
*/
|
||||||
|
if (sb.length() > 50000) {
|
||||||
|
sb.append(NbBundle.getMessage(this.getClass(), "Metadata.nodeText.truncated"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sb.append("</pre>\n"); //NON-NLS
|
||||||
|
}
|
||||||
|
} catch (TskCoreException ex) {
|
||||||
|
sb.append(NbBundle.getMessage(this.getClass(), "Metadata.nodeText.exceptionNotice.text")).append(ex.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.name"), image.getUniquePath());
|
||||||
|
} catch (TskCoreException ex) {
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.name"), image.getName());
|
||||||
|
}
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.imageType"), image.getType().getName());
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.size"), Long.toString(image.getSize()));
|
||||||
|
|
||||||
|
try {
|
||||||
|
String md5 = image.getMd5();
|
||||||
|
if (md5 == null || md5.isEmpty()) {
|
||||||
|
md5 = NbBundle.getMessage(this.getClass(), "Metadata.tableRowContent.md5notCalc");
|
||||||
|
}
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.md5"), md5);
|
||||||
|
|
||||||
|
String sha1 = image.getSha1();
|
||||||
|
if (sha1 == null || sha1.isEmpty()) {
|
||||||
|
sha1 = NbBundle.getMessage(this.getClass(), "Metadata.tableRowContent.md5notCalc");
|
||||||
|
}
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.sha1"), sha1);
|
||||||
|
|
||||||
|
String sha256 = image.getSha256();
|
||||||
|
if (sha256 == null || sha256.isEmpty()) {
|
||||||
|
sha256 = NbBundle.getMessage(this.getClass(), "Metadata.tableRowContent.md5notCalc");
|
||||||
|
}
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.sha256"), sha256);
|
||||||
|
} catch (TskCoreException ex) {
|
||||||
|
sb.append(NbBundle.getMessage(this.getClass(), "Metadata.nodeText.exceptionNotice.text")).append(ex.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.sectorSize"), Long.toString(image.getSsize()));
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.timezone"), image.getTimeZone());
|
||||||
|
addAcquisitionDetails(sb, dataSource);
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.deviceId"), image.getDeviceId());
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.internalid"), Long.toString(image.getId()));
|
||||||
|
|
||||||
|
// Add all the data source paths to the "Local Path" value cell.
|
||||||
|
String[] imagePaths = image.getPaths();
|
||||||
|
if (imagePaths.length > 0) {
|
||||||
|
StringBuilder pathValues = new StringBuilder("<div>");
|
||||||
|
pathValues.append(imagePaths[0]);
|
||||||
|
pathValues.append("</div>");
|
||||||
|
for (int i = 1; i < imagePaths.length; i++) {
|
||||||
|
pathValues.append("<div>");
|
||||||
|
pathValues.append(imagePaths[i]);
|
||||||
|
pathValues.append("</div>");
|
||||||
|
}
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.localPath"), pathValues.toString());
|
||||||
|
} else {
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.localPath"),
|
||||||
|
NbBundle.getMessage(this.getClass(), "Metadata.nodeText.none"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isCancelled()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user