Keyword search: message formatting improved

This commit is contained in:
adam-m 2012-03-08 14:49:41 -05:00
parent 810a8742b0
commit 37ba8bcf7b
2 changed files with 39 additions and 23 deletions

View File

@ -614,8 +614,8 @@ class IngestMessagePanel extends javax.swing.JPanel {
continue; continue;
} }
b.append(details); b.append(details);
//b.append("<hr />");
b.append("<br />"); b.append("<br />");
b.append("<hr />");
} }
return b.toString(); return b.toString();

View File

@ -80,7 +80,6 @@ public final class KeywordSearchIngestService implements IngestServiceFsContent
"gz", "tgz", "doc", "xls", "ppt", "rtf", "pdf", "html", "htm", "xhtml", "txt", "gz", "tgz", "doc", "xls", "ppt", "rtf", "pdf", "html", "htm", "xhtml", "txt",
"bmp", "gif", "png", "jpeg", "tiff", "mp3", "aiff", "au", "midi", "wav", "bmp", "gif", "png", "jpeg", "tiff", "mp3", "aiff", "au", "midi", "wav",
"pst", "xml", "class"}; "pst", "xml", "class"};
public enum IngestStatus { public enum IngestStatus {
@ -104,7 +103,7 @@ public final class KeywordSearchIngestService implements IngestServiceFsContent
if (hashDBResult == IngestServiceFsContent.ProcessResult.COND_STOP) { if (hashDBResult == IngestServiceFsContent.ProcessResult.COND_STOP) {
return ProcessResult.OK; return ProcessResult.OK;
} }
//check if time to commit and previous search is not running //check if time to commit and previous search is not running
//commiting while searching causes performance issues //commiting while searching causes performance issues
if (commitIndex && searcherDone) { if (commitIndex && searcherDone) {
@ -122,7 +121,7 @@ public final class KeywordSearchIngestService implements IngestServiceFsContent
} }
indexer.indexFile(fsContent); indexer.indexFile(fsContent);
return ProcessResult.OK; return ProcessResult.OK;
} }
@Override @Override
@ -231,27 +230,27 @@ public final class KeywordSearchIngestService implements IngestServiceFsContent
public boolean hasSimpleConfiguration() { public boolean hasSimpleConfiguration() {
return true; return true;
} }
@Override @Override
public boolean hasAdvancedConfiguration() { public boolean hasAdvancedConfiguration() {
return true; return true;
} }
@Override @Override
public javax.swing.JPanel getSimpleConfiguration() { public javax.swing.JPanel getSimpleConfiguration() {
return new KeywordSearchIngestSimplePanel(); return new KeywordSearchIngestSimplePanel();
} }
@Override @Override
public javax.swing.JPanel getAdvancedConfiguration() { public javax.swing.JPanel getAdvancedConfiguration() {
return KeywordSearchConfigurationPanel.getDefault(); return KeywordSearchConfigurationPanel.getDefault();
} }
@Override @Override
public void saveAdvancedConfiguration() { public void saveAdvancedConfiguration() {
KeywordSearchConfigurationPanel.getDefault().editListPanel.save(); KeywordSearchConfigurationPanel.getDefault().editListPanel.save();
} }
@Override @Override
public void saveSimpleConfiguration() { public void saveSimpleConfiguration() {
} }
@ -567,7 +566,12 @@ public final class KeywordSearchIngestService implements IngestServiceFsContent
StringBuilder detailsSb = new StringBuilder(); StringBuilder detailsSb = new StringBuilder();
//final int hitFiles = newResults.size(); //final int hitFiles = newResults.size();
subjectSb.append("Keyword hit: ").append("<"); if (!query.isLiteral()) {
subjectSb.append("RegExp hit: ");
} else {
subjectSb.append("Keyword hit: ");
}
subjectSb.append("<");
String uniqueKey = null; String uniqueKey = null;
BlackboardAttribute attr = res.getAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD.getTypeID()); BlackboardAttribute attr = res.getAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD.getTypeID());
if (attr != null) { if (attr != null) {
@ -580,37 +584,49 @@ public final class KeywordSearchIngestService implements IngestServiceFsContent
//String uniqueKey = queryStr; //String uniqueKey = queryStr;
//details //details
//title detailsSb.append("<table border='0' cellpadding='4' width='280'>");
detailsSb.append("<table border='1' width='200'><tr><th>Keyword hit</th><th>Preview</th>");
detailsSb.append("<th>File</th><th>List</th>");
if (! query.isLiteral())
detailsSb.append("<th>Regex</th>");
detailsSb.append("</tr><tr>");
//hit //hit
detailsSb.append("<tr>");
detailsSb.append("<th>Keyword hit</th>");
detailsSb.append("<td>").append(StringEscapeUtils.escapeHtml(attr.getValueString())).append("</td>"); detailsSb.append("<td>").append(StringEscapeUtils.escapeHtml(attr.getValueString())).append("</td>");
detailsSb.append("</tr>");
//preview
//preview
attr = res.getAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_PREVIEW.getTypeID()); attr = res.getAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_PREVIEW.getTypeID());
if (attr != null) { if (attr != null) {
detailsSb.append("<tr>");
detailsSb.append("<th>Preview</th>");
detailsSb.append("<td>").append(StringEscapeUtils.escapeHtml(attr.getValueString())).append("</td>"); detailsSb.append("<td>").append(StringEscapeUtils.escapeHtml(attr.getValueString())).append("</td>");
detailsSb.append("</tr>");
} }
//file //file
detailsSb.append("<tr>");
detailsSb.append("<th>File</th>");
detailsSb.append("<td>").append(hitFile.getParentPath()).append(hitFile.getName()).append("</td>"); detailsSb.append("<td>").append(hitFile.getParentPath()).append(hitFile.getName()).append("</td>");
detailsSb.append("</tr>");
//list //list
attr = res.getAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_SET.getTypeID()); attr = res.getAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_SET.getTypeID());
detailsSb.append("<tr>");
detailsSb.append("<th>List</th>");
detailsSb.append("<td>").append(attr.getValueString()).append("</td>"); detailsSb.append("<td>").append(attr.getValueString()).append("</td>");
detailsSb.append("</tr>");
//regex //regex
if (!query.isLiteral()) { if (!query.isLiteral()) {
attr = res.getAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_REGEXP.getTypeID()); attr = res.getAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_REGEXP.getTypeID());
if (attr != null) { if (attr != null) {
detailsSb.append("<tr>");
detailsSb.append("<th>List</th>");
detailsSb.append("<td>").append(attr.getValueString()).append("</td>"); detailsSb.append("<td>").append(attr.getValueString()).append("</td>");
detailsSb.append("</tr>");
} }
} }
detailsSb.append("</tr></table>"); detailsSb.append("</table>");
managerProxy.postMessage(IngestMessage.createDataMessage(++messageID, instance, subjectSb.toString(), detailsSb.toString(), uniqueKey, res.getArtifact())); managerProxy.postMessage(IngestMessage.createDataMessage(++messageID, instance, subjectSb.toString(), detailsSb.toString(), uniqueKey, res.getArtifact()));
} }