19 package org.sleuthkit.autopsy.datamodel;
21 import java.text.SimpleDateFormat;
22 import java.util.Arrays;
23 import java.util.TimeZone;
24 import java.util.logging.Level;
26 import org.openide.util.NbBundle;
42 BlackboardArtifact artifact;
45 private static SimpleDateFormat
dateFormatter =
new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
52 @SuppressWarnings(
"deprecation")
54 if (stringContent.isEmpty()) {
56 StringBuilder buffer =
new StringBuilder();
57 buffer.append(
"<html>\n");
58 buffer.append(
"<body>\n");
61 buffer.append(
"<h4>");
62 buffer.append(artifact.getDisplayName());
63 buffer.append(
"</h4>\n");
66 buffer.append(
"<table border='0'>");
67 buffer.append(
"<tr>");
68 buffer.append(
"</tr>\n");
71 for (BlackboardAttribute attr : artifact.getAttributes()) {
74 buffer.append(
"<tr><td>");
75 buffer.append(attr.getAttributeType().getDisplayName());
76 buffer.append(
"</td>");
79 buffer.append(
"<td>");
80 switch (attr.getAttributeType().getValueType()) {
82 String str = attr.getValueString();
83 str = str.replaceAll(
" ",
" ");
84 str = str.replaceAll(
"<",
"<");
85 str = str.replaceAll(
">",
">");
86 str = str.replaceAll(
"(\r\n|\n)",
"<br />");
93 buffer.append(attr.getDisplayString());
96 long epoch = attr.getValueLong();
97 String time =
"0000-00-00 00:00:00";
100 time = dateFormatter.format(
new java.util.Date(epoch * 1000));
105 if (!
"".equals(attr.getContext())) {
107 buffer.append(attr.getContext());
110 buffer.append(
"</td>");
111 buffer.append(
"</tr>\n");
118 path = content.getUniquePath();
119 }
catch (TskCoreException ex) {
120 logger.log(Level.SEVERE,
"Exception while calling Content.getUniquePath() on {0} : {1}",
new Object[]{content, ex.getLocalizedMessage()});
124 buffer.append(
"<tr>");
125 buffer.append(
"<td>");
126 buffer.append(NbBundle.getMessage(
this.getClass(),
"ArtifactStringContent.getStr.srcFilePath.text"));
127 buffer.append(
"</td>");
128 buffer.append(
"<td>");
130 buffer.append(
"</td>");
131 buffer.append(
"</tr>\n");
134 buffer.append(
"<tr><td>");
135 buffer.append(NbBundle.getMessage(
this.getClass(),
"ArtifactStringContent.getStr.artifactId.text"));
136 buffer.append(
"</td><td>");
137 buffer.append(artifact.getArtifactID());
138 buffer.append(
"</td>");
139 buffer.append(
"</tr>\n");
141 buffer.append(
"</table>");
142 buffer.append(
"</html>\n");
144 stringContent = buffer.toString();
145 }
catch (TskException ex) {
146 stringContent = NbBundle.getMessage(this.getClass(),
"ArtifactStringContent.getStr.err");
155 return artifact.getSleuthkitCase().getContentById(artifact.getObjectID());
156 }
catch (TskException ex) {
157 logger.log(Level.WARNING,
"Getting file failed", ex);
159 throw new IllegalArgumentException(NbBundle.getMessage(
ArtifactStringContent.class,
"ArtifactStringContent.exception.msg"));
162 private static TimeZone
getTimeZone(BlackboardArtifact artifact) {
static SimpleDateFormat dateFormatter
static Content getAssociatedContent(BlackboardArtifact artifact)
static TimeZone getTimeZone(BlackboardArtifact artifact)
synchronized static Logger getLogger(String name)
static TimeZone getTimeZone(Content c)
ArtifactStringContent(BlackboardArtifact art)