mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 16:36:15 +00:00
Adding file metadata content viewer support for Images
This commit is contained in:
parent
83aa813a16
commit
e952b32921
@ -26,6 +26,8 @@ import org.openide.util.lookup.ServiceProvider;
|
|||||||
import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
|
import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
|
||||||
import org.sleuthkit.autopsy.datamodel.ContentUtils;
|
import org.sleuthkit.autopsy.datamodel.ContentUtils;
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
|
import org.sleuthkit.datamodel.Image;
|
||||||
|
import org.sleuthkit.datamodel.DataSource;
|
||||||
import org.sleuthkit.datamodel.FsContent;
|
import org.sleuthkit.datamodel.FsContent;
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
import org.sleuthkit.datamodel.TskData.TSK_DB_FILES_TYPE_ENUM;
|
import org.sleuthkit.datamodel.TskData.TSK_DB_FILES_TYPE_ENUM;
|
||||||
@ -123,11 +125,14 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer {
|
|||||||
|
|
||||||
@Messages({
|
@Messages({
|
||||||
"Metadata.tableRowTitle.mimeType=MIME Type",
|
"Metadata.tableRowTitle.mimeType=MIME Type",
|
||||||
"Metadata.nodeText.truncated=(results truncated)"})
|
"Metadata.nodeText.truncated=(results truncated)",
|
||||||
|
"Metadata.tableRowTitle.sha1=SHA1",
|
||||||
|
"Metadata.tableRowTitle.sha256=SHA256"})
|
||||||
@Override
|
@Override
|
||||||
public void setNode(Node node) {
|
public void setNode(Node node) {
|
||||||
AbstractFile file = node.getLookup().lookup(AbstractFile.class);
|
AbstractFile file = node.getLookup().lookup(AbstractFile.class);
|
||||||
if (file == null) {
|
Image image = node.getLookup().lookup((Image.class));
|
||||||
|
if (file == null && image == null) {
|
||||||
setText(NbBundle.getMessage(this.getClass(), "Metadata.nodeText.nonFilePassedIn"));
|
setText(NbBundle.getMessage(this.getClass(), "Metadata.nodeText.nonFilePassedIn"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -135,6 +140,7 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer {
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
startTable(sb);
|
startTable(sb);
|
||||||
|
|
||||||
|
if (file != null) {
|
||||||
try {
|
try {
|
||||||
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.name"), file.getUniquePath());
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.name"), file.getUniquePath());
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
@ -194,6 +200,34 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer {
|
|||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
sb.append(NbBundle.getMessage(this.getClass(), "Metadata.nodeText.exceptionNotice.text")).append(ex.getLocalizedMessage());
|
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.size"), Long.toString(image.getSize()));
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.internalid"), Long.toString(image.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
setText(sb.toString());
|
setText(sb.toString());
|
||||||
jTextPane1.setCaretPosition(0);
|
jTextPane1.setCaretPosition(0);
|
||||||
@ -227,8 +261,9 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSupported(Node node) {
|
public boolean isSupported(Node node) {
|
||||||
|
Image image = node.getLookup().lookup(Image.class);
|
||||||
AbstractFile file = node.getLookup().lookup(AbstractFile.class);
|
AbstractFile file = node.getLookup().lookup(AbstractFile.class);
|
||||||
return file != null;
|
return (file != null) || (image != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user