Reformatted code.

This commit is contained in:
Nick Davis 2014-01-27 16:25:11 -05:00
parent c9d0ace569
commit d6e0366c73
55 changed files with 1791 additions and 1243 deletions

View File

@ -20,6 +20,7 @@
package org.sleuthkit.autopsy.keywordsearch; package org.sleuthkit.autopsy.keywordsearch;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import org.sleuthkit.autopsy.keywordsearch.Ingester.IngesterException; import org.sleuthkit.autopsy.keywordsearch.Ingester.IngesterException;
/** /**
@ -51,7 +52,8 @@ class AbstractFileChunk {
return Server.getChunkIdString(this.parent.getSourceFile().getId(), this.chunkID); return Server.getChunkIdString(this.parent.getSourceFile().getId(), this.chunkID);
} }
public boolean index(Ingester ingester, byte[] content, long contentSize, Charset indexCharset) throws IngesterException { public boolean index(Ingester ingester, byte[] content, long contentSize, Charset indexCharset)
throws IngesterException {
boolean success = true; boolean success = true;
ByteContentStream bcs = new ByteContentStream(content, contentSize, parent.getSourceFile(), indexCharset); ByteContentStream bcs = new ByteContentStream(content, contentSize, parent.getSourceFile(), indexCharset);
try { try {
@ -59,7 +61,9 @@ class AbstractFileChunk {
//logger.log(Level.INFO, "Ingesting string chunk: " + this.getName() + ": " + chunkID); //logger.log(Level.INFO, "Ingesting string chunk: " + this.getName() + ": " + chunkID);
} catch (Exception ingEx) { } catch (Exception ingEx) {
success = false; success = false;
throw new IngesterException("Problem ingesting file string chunk: " + parent.getSourceFile().getId() + ", chunk: " + chunkID, ingEx); throw new IngesterException("Problem ingesting file string chunk: "
+ parent.getSourceFile().getId()
+ ", chunk: " + chunkID, ingEx);
} }
return success; return success;
} }

View File

@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.keywordsearch;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT; import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT;
import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
@ -37,7 +38,9 @@ interface AbstractFileExtract {
EXTRACT_UTF16, ///< extract UTF16 text, possible values Boolean.TRUE.toString(), Boolean.FALSE.toString() EXTRACT_UTF16, ///< extract UTF16 text, possible values Boolean.TRUE.toString(), Boolean.FALSE.toString()
EXTRACT_UTF8, ///< extract UTF8 text, possible values Boolean.TRUE.toString(), Boolean.FALSE.toString() EXTRACT_UTF8, ///< extract UTF8 text, possible values Boolean.TRUE.toString(), Boolean.FALSE.toString()
}; }
;
//generally text extractors should ignore archives //generally text extractors should ignore archives
//and let unpacking modules take case of them //and let unpacking modules take case of them

View File

@ -26,6 +26,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT; import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT;
import org.sleuthkit.autopsy.keywordsearch.Ingester.IngesterException; import org.sleuthkit.autopsy.keywordsearch.Ingester.IngesterException;
@ -189,10 +190,12 @@ import org.sleuthkit.datamodel.ReadContentInputStream;
module.checkRunCommitSearch(); module.checkRunCommitSearch();
} }
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.WARNING, "Unable to read content stream from " + sourceFile.getId() + ": " + sourceFile.getName(), ex); logger.log(Level.WARNING, "Unable to read content stream from "
+ sourceFile.getId() + ": " + sourceFile.getName(), ex);
success = false; success = false;
} catch (Exception ex) { } catch (Exception ex) {
logger.log(Level.WARNING, "Unexpected error, can't read content stream from " + sourceFile.getId() + ": " + sourceFile.getName(), ex); logger.log(Level.WARNING, "Unexpected error, can't read content stream from "
+ sourceFile.getId() + ": " + sourceFile.getName(), ex);
success = false; success = false;
} finally { } finally {
try { try {

View File

@ -23,6 +23,7 @@ import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.Reader; import java.io.Reader;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.apache.solr.common.util.ContentStream; import org.apache.solr.common.util.ContentStream;
import org.sleuthkit.datamodel.AbstractContent; import org.sleuthkit.datamodel.AbstractContent;
@ -69,7 +70,8 @@ import org.sleuthkit.datamodel.AbstractFile;
@Override @Override
public Long getSize() { public Long getSize() {
//return convertedLength; //return convertedLength;
throw new UnsupportedOperationException("Cannot tell how many chars in converted string, until entire string is converted"); throw new UnsupportedOperationException(
"Cannot tell how many chars in converted string, until entire string is converted");
} }
@Override @Override

View File

@ -26,6 +26,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT; import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT;
import org.sleuthkit.autopsy.keywordsearch.Ingester.IngesterException; import org.sleuthkit.autopsy.keywordsearch.Ingester.IngesterException;
@ -132,7 +133,8 @@ class AbstractFileStringExtract implements AbstractFileExtract {
//break input stream into chunks //break input stream into chunks
long readSize = 0; long readSize = 0;
while ((readSize = stringStream.read(STRING_CHUNK_BUF, BOM_LEN, (int) MAX_STRING_CHUNK_SIZE - BOM_LEN)) != -1) { while ((readSize = stringStream.read(STRING_CHUNK_BUF, BOM_LEN, (int) MAX_STRING_CHUNK_SIZE - BOM_LEN))
!= -1) {
//FileOutputStream debug = new FileOutputStream("c:\\temp\\" + sourceFile.getName() + Integer.toString(this.numChunks+1)); //FileOutputStream debug = new FileOutputStream("c:\\temp\\" + sourceFile.getName() + Integer.toString(this.numChunks+1));
//debug.write(STRING_CHUNK_BUF, 0, (int)readSize); //debug.write(STRING_CHUNK_BUF, 0, (int)readSize);
@ -143,7 +145,9 @@ class AbstractFileStringExtract implements AbstractFileExtract {
++this.numChunks; ++this.numChunks;
} catch (IngesterException ingEx) { } catch (IngesterException ingEx) {
success = false; success = false;
logger.log(Level.WARNING, "Ingester had a problem with extracted strings from file '" + sourceFile.getName() + "' (id: " + sourceFile.getId() + ").", ingEx); logger.log(Level.WARNING,
"Ingester had a problem with extracted strings from file '" + sourceFile.getName()
+ "' (id: " + sourceFile.getId() + ").", ingEx);
throw ingEx; //need to rethrow/return to signal error and move on throw ingEx; //need to rethrow/return to signal error and move on
} }
@ -159,7 +163,8 @@ class AbstractFileStringExtract implements AbstractFileExtract {
ingester.ingest(this); ingester.ingest(this);
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.WARNING, "Unable to read input stream to divide and send to Solr, file: " + sourceFile.getName(), ex); logger.log(Level.WARNING,
"Unable to read input stream to divide and send to Solr, file: " + sourceFile.getName(), ex);
success = false; success = false;
} finally { } finally {
try { try {

View File

@ -22,6 +22,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.List; import java.util.List;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.StringExtract; import org.sleuthkit.autopsy.coreutils.StringExtract;
import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractResult; import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractResult;
@ -33,7 +34,7 @@ import org.sleuthkit.datamodel.TskCoreException;
* Wrapper over StringExtract to provide streaming API Given AbstractFile * Wrapper over StringExtract to provide streaming API Given AbstractFile
* object, extract international strings from the file and read output as a * object, extract international strings from the file and read output as a
* stream of UTF-8 strings as encoded bytes. * stream of UTF-8 strings as encoded bytes.
* * <p/>
* Currently not-thread safe (reusing static buffers for efficiency) * Currently not-thread safe (reusing static buffers for efficiency)
*/ */
class AbstractFileStringIntStream extends InputStream { class AbstractFileStringIntStream extends InputStream {
@ -42,7 +43,8 @@ import org.sleuthkit.datamodel.TskCoreException;
private final byte[] oneCharBuf = new byte[1]; private final byte[] oneCharBuf = new byte[1];
private final StringExtract stringExtractor; private final StringExtract stringExtractor;
private static final int FILE_BUF_SIZE = 1024 * 1024; private static final int FILE_BUF_SIZE = 1024 * 1024;
private static final byte[] fileReadBuff = new byte[FILE_BUF_SIZE]; //NOTE: need to run all stream extraction in same thread private static final byte[] fileReadBuff = new byte[FILE_BUF_SIZE];
//NOTE: need to run all stream extraction in same thread
private long fileReadOffset = 0L; private long fileReadOffset = 0L;
private byte[] convertBuff; //stores extracted string encoded as bytes, before returned to user private byte[] convertBuff; //stores extracted string encoded as bytes, before returned to user
private int convertBuffOffset = 0; //offset to start returning data to user on next read() private int convertBuffOffset = 0; //offset to start returning data to user on next read()

View File

@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.keywordsearch;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.StringExtract; import org.sleuthkit.autopsy.coreutils.StringExtract;
import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
@ -29,10 +30,10 @@ import org.sleuthkit.datamodel.TskException;
/** /**
* AbstractFile input string stream reader/converter - given AbstractFile, * AbstractFile input string stream reader/converter - given AbstractFile,
* extract strings from it and return encoded bytes via read() * extract strings from it and return encoded bytes via read()
* * <p/>
* Note: the utility supports extraction of only LATIN script and UTF8, UTF16LE, UTF16BE encodings * Note: the utility supports extraction of only LATIN script and UTF8, UTF16LE, UTF16BE encodings
* and uses a brute force encoding detection - it's fast but could apply multiple encodings on the same string. * and uses a brute force encoding detection - it's fast but could apply multiple encodings on the same string.
* * <p/>
* For other script/languages support and better encoding detection use AbstractFileStringIntStream streaming class, * For other script/languages support and better encoding detection use AbstractFileStringIntStream streaming class,
* which wraps around StringExtract extractor. * which wraps around StringExtract extractor.
*/ */
@ -53,7 +54,8 @@ import org.sleuthkit.datamodel.TskException;
private int tempStringLen = 0; private int tempStringLen = 0;
private boolean isEOF = false; private boolean isEOF = false;
private boolean stringAtTempBoundary = false; //if temp has part of string that didn't make it in previous read() private boolean stringAtTempBoundary = false; //if temp has part of string that didn't make it in previous read()
private boolean stringAtBufBoundary = false; //if read buffer has string being processed, continue as string from prev read() in next read() private boolean stringAtBufBoundary = false;
//if read buffer has string being processed, continue as string from prev read() in next read()
private boolean inString = false; //if current temp has min chars required private boolean inString = false; //if current temp has min chars required
private static final byte[] oneCharBuf = new byte[1]; private static final byte[] oneCharBuf = new byte[1];
private final int MIN_PRINTABLE_CHARS = 4; //num. of chars needed to qualify as a char string private final int MIN_PRINTABLE_CHARS = 4; //num. of chars needed to qualify as a char string

View File

@ -34,6 +34,7 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import java.util.logging.Level; import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.ingest.IngestModuleAbstractFile; import org.sleuthkit.autopsy.ingest.IngestModuleAbstractFile;
import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
@ -55,10 +56,9 @@ import org.sleuthkit.datamodel.TskCoreException;
* divided into chunks and indexed with Solr. Protects against Tika parser hangs * divided into chunks and indexed with Solr. Protects against Tika parser hangs
* (for unexpected/corrupt content) using a timeout mechanism. If Tika * (for unexpected/corrupt content) using a timeout mechanism. If Tika
* extraction succeeds, chunks are indexed with Solr. * extraction succeeds, chunks are indexed with Solr.
* * <p/>
* This Tika extraction/chunking utility is useful for large files of Tika * This Tika extraction/chunking utility is useful for large files of Tika
* parsers-supported content type. * parsers-supported content type.
*
*/ */
class AbstractFileTikaTextExtract implements AbstractFileExtract { class AbstractFileTikaTextExtract implements AbstractFileExtract {
@ -139,13 +139,15 @@ class AbstractFileTikaTextExtract implements AbstractFileExtract {
future.get(Ingester.getTimeout(sourceFile.getSize()), TimeUnit.SECONDS); future.get(Ingester.getTimeout(sourceFile.getSize()), TimeUnit.SECONDS);
} catch (TimeoutException te) { } catch (TimeoutException te) {
tika = null; tika = null;
final String msg = "Exception: Tika parse timeout for content: " + sourceFile.getId() + ", " + sourceFile.getName(); final String msg = "Exception: Tika parse timeout for content: " + sourceFile.getId() + ", "
+ sourceFile.getName();
KeywordSearch.getTikaLogger().log(Level.WARNING, msg, te); KeywordSearch.getTikaLogger().log(Level.WARNING, msg, te);
logger.log(Level.WARNING, msg); logger.log(Level.WARNING, msg);
throw new IngesterException(msg); throw new IngesterException(msg);
} catch (Exception ex) { } catch (Exception ex) {
tika = null; tika = null;
final String msg = "Exception: Unexpected exception from Tika parse task execution for file: " + sourceFile.getId() + ", " + sourceFile.getName(); final String msg = "Exception: Unexpected exception from Tika parse task execution for file: "
+ sourceFile.getId() + ", " + sourceFile.getName();
KeywordSearch.getTikaLogger().log(Level.WARNING, msg, ex); KeywordSearch.getTikaLogger().log(Level.WARNING, msg, ex);
logger.log(Level.WARNING, msg); logger.log(Level.WARNING, msg);
throw new IngesterException(msg); throw new IngesterException(msg);
@ -242,12 +244,14 @@ class AbstractFileTikaTextExtract implements AbstractFileExtract {
module.checkRunCommitSearch(); module.checkRunCommitSearch();
} }
} catch (IOException ex) { } catch (IOException ex) {
final String msg = "Exception: Unable to read Tika content stream from " + sourceFile.getId() + ": " + sourceFile.getName(); final String msg = "Exception: Unable to read Tika content stream from " + sourceFile.getId() + ": "
+ sourceFile.getName();
KeywordSearch.getTikaLogger().log(Level.WARNING, msg, ex); KeywordSearch.getTikaLogger().log(Level.WARNING, msg, ex);
logger.log(Level.WARNING, msg); logger.log(Level.WARNING, msg);
success = false; success = false;
} catch (Exception ex) { } catch (Exception ex) {
final String msg = "Exception: Unexpected error, can't read Tika content stream from " + sourceFile.getId() + ": " + sourceFile.getName(); final String msg = "Exception: Unexpected error, can't read Tika content stream from " + sourceFile.getId()
+ ": " + sourceFile.getName();
KeywordSearch.getTikaLogger().log(Level.WARNING, msg, ex); KeywordSearch.getTikaLogger().log(Level.WARNING, msg, ex);
logger.log(Level.WARNING, msg); logger.log(Level.WARNING, msg);
success = false; success = false;
@ -327,11 +331,15 @@ class AbstractFileTikaTextExtract implements AbstractFileExtract {
try { try {
reader = tika.parse(stream, meta); reader = tika.parse(stream, meta);
} catch (IOException ex) { } catch (IOException ex) {
KeywordSearch.getTikaLogger().log(Level.WARNING, "Exception: Unable to Tika parse the content" + sourceFile.getId() + ": " + sourceFile.getName(), ex); KeywordSearch.getTikaLogger().log(Level.WARNING,
"Exception: Unable to Tika parse the content" + sourceFile.getId()
+ ": " + sourceFile.getName(), ex);
tika = null; tika = null;
reader = null; reader = null;
} catch (Exception ex) { } catch (Exception ex) {
KeywordSearch.getTikaLogger().log(Level.WARNING, "Exception: Unable to Tika parse the content" + sourceFile.getId() + ": " + sourceFile.getName(), ex); KeywordSearch.getTikaLogger().log(Level.WARNING,
"Exception: Unable to Tika parse the content" + sourceFile.getId()
+ ": " + sourceFile.getName(), ex);
tika = null; tika = null;
reader = null; reader = null;
} }

View File

@ -33,7 +33,8 @@ import org.openide.util.NbBundle;
*/ */
abstract class AbstractKeywordSearchPerformer extends javax.swing.JPanel implements KeywordSearchPerformerInterface { abstract class AbstractKeywordSearchPerformer extends javax.swing.JPanel implements KeywordSearchPerformerInterface {
private final String keywordSearchErrorDialogHeader = org.openide.util.NbBundle.getMessage(this.getClass(), "AbstractKeywordSearchPerformer.search.dialogErrorHeader"); private final String keywordSearchErrorDialogHeader = org.openide.util.NbBundle.getMessage(this.getClass(),
"AbstractKeywordSearchPerformer.search.dialogErrorHeader");
protected int filesIndexed; protected int filesIndexed;
AbstractKeywordSearchPerformer() { AbstractKeywordSearchPerformer() {
@ -87,18 +88,25 @@ abstract class AbstractKeywordSearchPerformer extends javax.swing.JPanel impleme
if (isRunning) { if (isRunning) {
KeywordSearchUtil.displayDialog(keywordSearchErrorDialogHeader, NbBundle.getMessage(this.getClass(), KeywordSearchUtil.displayDialog(keywordSearchErrorDialogHeader, NbBundle.getMessage(this.getClass(),
"AbstractKeywordSearchPerformer.search.noFilesInIdxMsg", "AbstractKeywordSearchPerformer.search.noFilesInIdxMsg",
KeywordSearchSettings.getUpdateFrequency().getTime()), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR); KeywordSearchSettings
.getUpdateFrequency()
.getTime()),
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
} else { } else {
KeywordSearchUtil.displayDialog(keywordSearchErrorDialogHeader, NbBundle.getMessage(this.getClass(), KeywordSearchUtil.displayDialog(keywordSearchErrorDialogHeader, NbBundle.getMessage(this.getClass(),
"AbstractKeywordSearchPerformer.search.noFilesIdxdMsg"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR); "AbstractKeywordSearchPerformer.search.noFilesIdxdMsg"),
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
} }
return; return;
} }
//check if keyword search module ingest is running (indexing, etc) //check if keyword search module ingest is running (indexing, etc)
if (isRunning) { if (isRunning) {
if (KeywordSearchUtil.displayConfirmDialog(org.openide.util.NbBundle.getMessage(this.getClass(), "AbstractKeywordSearchPerformer.search.searchIngestInProgressTitle"), if (KeywordSearchUtil.displayConfirmDialog(org.openide.util.NbBundle.getMessage(this.getClass(),
NbBundle.getMessage(this.getClass(), "AbstractKeywordSearchPerformer.search.ingestInProgressBody"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN) == false) { "AbstractKeywordSearchPerformer.search.searchIngestInProgressTitle"),
NbBundle.getMessage(this.getClass(),
"AbstractKeywordSearchPerformer.search.ingestInProgressBody"),
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN) == false) {
return; return;
} }
} }
@ -123,7 +131,8 @@ abstract class AbstractKeywordSearchPerformer extends javax.swing.JPanel impleme
final String queryText = getQueryText(); final String queryText = getQueryText();
if (queryText == null || queryText.trim().equals("")) { if (queryText == null || queryText.trim().equals("")) {
KeywordSearchUtil.displayDialog(keywordSearchErrorDialogHeader, NbBundle.getMessage(this.getClass(), KeywordSearchUtil.displayDialog(keywordSearchErrorDialogHeader, NbBundle.getMessage(this.getClass(),
"AbstractKeywordSearchPerformer.search.pleaseEnterKeywordBody"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR); "AbstractKeywordSearchPerformer.search.pleaseEnterKeywordBody"),
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
return; return;
} }
man = new KeywordSearchQueryManager(getQueryText(), queryType, Presentation.FLAT); man = new KeywordSearchQueryManager(getQueryText(), queryType, Presentation.FLAT);
@ -133,7 +142,8 @@ abstract class AbstractKeywordSearchPerformer extends javax.swing.JPanel impleme
man.execute(); man.execute();
} else { } else {
KeywordSearchUtil.displayDialog(keywordSearchErrorDialogHeader, NbBundle.getMessage(this.getClass(), KeywordSearchUtil.displayDialog(keywordSearchErrorDialogHeader, NbBundle.getMessage(this.getClass(),
"AbstractKeywordSearchPerformer.search.invalidSyntaxHeader"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR); "AbstractKeywordSearchPerformer.search.invalidSyntaxHeader"),
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
} }
} }
} }

View File

@ -24,6 +24,7 @@ import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.Reader; import java.io.Reader;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.apache.solr.common.util.ContentStream; import org.apache.solr.common.util.ContentStream;
import org.sleuthkit.datamodel.AbstractContent; import org.sleuthkit.datamodel.AbstractContent;
@ -100,5 +101,4 @@ class ByteContentStream implements ContentStream {
} }
} }

View File

@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.keywordsearch;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
/** /**
@ -85,6 +86,7 @@ class ContentHit {
/** /**
* Identify the list of files with the first chunk that has a hit * Identify the list of files with the first chunk that has a hit
*
* @param hits * @param hits
* @return * @return
*/ */

View File

@ -29,6 +29,7 @@ import java.util.List;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import javax.swing.JMenuItem; import javax.swing.JMenuItem;
import javax.swing.JTextPane; import javax.swing.JTextPane;
import javax.swing.SizeRequirements; import javax.swing.SizeRequirements;
@ -41,6 +42,7 @@ import javax.swing.text.html.ParagraphView;
import javax.swing.text.html.HTMLEditorKit; import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.HTMLEditorKit.HTMLFactory; import javax.swing.text.html.HTMLEditorKit.HTMLFactory;
import javax.swing.text.html.StyleSheet; import javax.swing.text.html.StyleSheet;
import org.netbeans.api.progress.ProgressHandle; import org.netbeans.api.progress.ProgressHandle;
import org.netbeans.api.progress.ProgressHandleFactory; import org.netbeans.api.progress.ProgressHandleFactory;
import org.sleuthkit.autopsy.coreutils.EscapeUtil; import org.sleuthkit.autopsy.coreutils.EscapeUtil;
@ -92,7 +94,8 @@ class ExtractedContentPanel extends javax.swing.JPanel {
}; };
} else if (v instanceof ParagraphView) { } else if (v instanceof ParagraphView) {
return new ParagraphView(e) { return new ParagraphView(e) {
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r) { protected SizeRequirements calculateMinorAxisRequirements(int axis,
SizeRequirements r) {
if (r == null) { if (r == null) {
r = new SizeRequirements(); r = new SizeRequirements();
} }
@ -165,7 +168,8 @@ class ExtractedContentPanel extends javax.swing.JPanel {
extractedTextPane = new JTextPane() { extractedTextPane = new JTextPane() {
public boolean getScrollableTracksViewportWidth() { public boolean getScrollableTracksViewportWidth() {
return (getSize().width < 400); return (getSize().width < 400);
}}; }
};
sourceComboBox = new javax.swing.JComboBox(); sourceComboBox = new javax.swing.JComboBox();
hitLabel = new javax.swing.JLabel(); hitLabel = new javax.swing.JLabel();
hitCountLabel = new javax.swing.JLabel(); hitCountLabel = new javax.swing.JLabel();
@ -182,10 +186,12 @@ class ExtractedContentPanel extends javax.swing.JPanel {
pageOfLabel = new javax.swing.JLabel(); pageOfLabel = new javax.swing.JLabel();
pageTotalLabel = new javax.swing.JLabel(); pageTotalLabel = new javax.swing.JLabel();
copyMenuItem.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.copyMenuItem.text")); // NOI18N copyMenuItem.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.copyMenuItem.text")); // NOI18N
rightClickMenu.add(copyMenuItem); rightClickMenu.add(copyMenuItem);
selectAllMenuItem.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.selectAllMenuItem.text")); // NOI18N selectAllMenuItem.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.selectAllMenuItem.text")); // NOI18N
rightClickMenu.add(selectAllMenuItem); rightClickMenu.add(selectAllMenuItem);
setPreferredSize(new java.awt.Dimension(700, 400)); setPreferredSize(new java.awt.Dimension(700, 400));
@ -199,76 +205,103 @@ class ExtractedContentPanel extends javax.swing.JPanel {
extractedTextPane.setPreferredSize(new java.awt.Dimension(700, 400)); extractedTextPane.setPreferredSize(new java.awt.Dimension(700, 400));
jScrollPane1.setViewportView(extractedTextPane); jScrollPane1.setViewportView(extractedTextPane);
sourceComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); sourceComboBox
.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"Item 1", "Item 2", "Item 3", "Item 4"}));
hitLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.hitLabel.text")); // NOI18N hitLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
hitLabel.setToolTipText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.hitLabel.toolTipText")); // NOI18N "ExtractedContentPanel.hitLabel.text")); // NOI18N
hitLabel.setToolTipText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.hitLabel.toolTipText")); // NOI18N
hitCountLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); hitCountLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
hitCountLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.hitCountLabel.text")); // NOI18N hitCountLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.hitCountLabel.text")); // NOI18N
hitCountLabel.setMaximumSize(new java.awt.Dimension(18, 14)); hitCountLabel.setMaximumSize(new java.awt.Dimension(18, 14));
hitCountLabel.setMinimumSize(new java.awt.Dimension(18, 14)); hitCountLabel.setMinimumSize(new java.awt.Dimension(18, 14));
hitCountLabel.setPreferredSize(new java.awt.Dimension(18, 14)); hitCountLabel.setPreferredSize(new java.awt.Dimension(18, 14));
hitOfLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.hitOfLabel.text")); // NOI18N hitOfLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.hitOfLabel.text")); // NOI18N
hitTotalLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); hitTotalLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
hitTotalLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.hitTotalLabel.text")); // NOI18N hitTotalLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.hitTotalLabel.text")); // NOI18N
hitTotalLabel.setMaximumSize(new java.awt.Dimension(18, 14)); hitTotalLabel.setMaximumSize(new java.awt.Dimension(18, 14));
hitTotalLabel.setMinimumSize(new java.awt.Dimension(18, 14)); hitTotalLabel.setMinimumSize(new java.awt.Dimension(18, 14));
hitTotalLabel.setPreferredSize(new java.awt.Dimension(18, 14)); hitTotalLabel.setPreferredSize(new java.awt.Dimension(18, 14));
hitButtonsLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.hitButtonsLabel.text")); // NOI18N hitButtonsLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.hitButtonsLabel.text")); // NOI18N
hitPreviousButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_back.png"))); // NOI18N hitPreviousButton.setIcon(new javax.swing.ImageIcon(
hitPreviousButton.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.hitPreviousButton.text")); // NOI18N getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_back.png"))); // NOI18N
hitPreviousButton.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.hitPreviousButton.text")); // NOI18N
hitPreviousButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); hitPreviousButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
hitPreviousButton.setBorderPainted(false); hitPreviousButton.setBorderPainted(false);
hitPreviousButton.setContentAreaFilled(false); hitPreviousButton.setContentAreaFilled(false);
hitPreviousButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_back_disabled.png"))); // NOI18N hitPreviousButton.setDisabledIcon(new javax.swing.ImageIcon(
getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_back_disabled.png"))); // NOI18N
hitPreviousButton.setMargin(new java.awt.Insets(2, 0, 2, 0)); hitPreviousButton.setMargin(new java.awt.Insets(2, 0, 2, 0));
hitPreviousButton.setPreferredSize(new java.awt.Dimension(23, 23)); hitPreviousButton.setPreferredSize(new java.awt.Dimension(23, 23));
hitPreviousButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_back_hover.png"))); // NOI18N hitPreviousButton.setRolloverIcon(new javax.swing.ImageIcon(
getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_back_hover.png"))); // NOI18N
hitNextButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_forward.png"))); // NOI18N hitNextButton.setIcon(new javax.swing.ImageIcon(
hitNextButton.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.hitNextButton.text")); // NOI18N getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_forward.png"))); // NOI18N
hitNextButton.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.hitNextButton.text")); // NOI18N
hitNextButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); hitNextButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
hitNextButton.setBorderPainted(false); hitNextButton.setBorderPainted(false);
hitNextButton.setContentAreaFilled(false); hitNextButton.setContentAreaFilled(false);
hitNextButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_forward_disabled.png"))); // NOI18N hitNextButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/btn_step_forward_disabled.png"))); // NOI18N
hitNextButton.setMargin(new java.awt.Insets(2, 0, 2, 0)); hitNextButton.setMargin(new java.awt.Insets(2, 0, 2, 0));
hitNextButton.setPreferredSize(new java.awt.Dimension(23, 23)); hitNextButton.setPreferredSize(new java.awt.Dimension(23, 23));
hitNextButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_forward_hover.png"))); // NOI18N hitNextButton.setRolloverIcon(new javax.swing.ImageIcon(
getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_forward_hover.png"))); // NOI18N
pageButtonsLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.pageButtonsLabel.text")); // NOI18N pageButtonsLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.pageButtonsLabel.text")); // NOI18N
pagePreviousButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_back.png"))); // NOI18N pagePreviousButton.setIcon(new javax.swing.ImageIcon(
pagePreviousButton.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.pagePreviousButton.text")); // NOI18N getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_back.png"))); // NOI18N
pagePreviousButton.setActionCommand(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.pagePreviousButton.actionCommand")); // NOI18N pagePreviousButton.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.pagePreviousButton.text")); // NOI18N
pagePreviousButton.setActionCommand(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.pagePreviousButton.actionCommand")); // NOI18N
pagePreviousButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); pagePreviousButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
pagePreviousButton.setBorderPainted(false); pagePreviousButton.setBorderPainted(false);
pagePreviousButton.setContentAreaFilled(false); pagePreviousButton.setContentAreaFilled(false);
pagePreviousButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_back_disabled.png"))); // NOI18N pagePreviousButton.setDisabledIcon(new javax.swing.ImageIcon(
getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_back_disabled.png"))); // NOI18N
pagePreviousButton.setMargin(new java.awt.Insets(2, 0, 2, 0)); pagePreviousButton.setMargin(new java.awt.Insets(2, 0, 2, 0));
pageNextButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_forward.png"))); // NOI18N pageNextButton.setIcon(new javax.swing.ImageIcon(
pageNextButton.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.pageNextButton.text")); // NOI18N getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_forward.png"))); // NOI18N
pageNextButton.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.pageNextButton.text")); // NOI18N
pageNextButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); pageNextButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
pageNextButton.setBorderPainted(false); pageNextButton.setBorderPainted(false);
pageNextButton.setContentAreaFilled(false); pageNextButton.setContentAreaFilled(false);
pageNextButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/btn_step_forward_disabled.png"))); // NOI18N pageNextButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/keywordsearch/btn_step_forward_disabled.png"))); // NOI18N
pageNextButton.setMargin(new java.awt.Insets(2, 0, 2, 0)); pageNextButton.setMargin(new java.awt.Insets(2, 0, 2, 0));
pageNextButton.setPreferredSize(new java.awt.Dimension(23, 23)); pageNextButton.setPreferredSize(new java.awt.Dimension(23, 23));
pagesLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.pagesLabel.text")); // NOI18N pagesLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.pagesLabel.text")); // NOI18N
pageCurLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); pageCurLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
pageCurLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.pageCurLabel.text")); // NOI18N pageCurLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.pageCurLabel.text")); // NOI18N
pageOfLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.pageOfLabel.text")); // NOI18N pageOfLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.pageOfLabel.text")); // NOI18N
pageTotalLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); pageTotalLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
pageTotalLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.pageTotalLabel.text")); // NOI18N pageTotalLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class,
"ExtractedContentPanel.pageTotalLabel.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout); this.setLayout(layout);
@ -278,60 +311,93 @@ class ExtractedContentPanel extends javax.swing.JPanel {
.addContainerGap() .addContainerGap()
.addComponent(hitLabel) .addComponent(hitLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(hitCountLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(hitCountLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 30,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(hitOfLabel) .addComponent(hitOfLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(hitTotalLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(hitTotalLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 30,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(hitButtonsLabel) .addComponent(hitButtonsLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(hitPreviousButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(hitPreviousButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0) .addGap(0, 0, 0)
.addComponent(hitNextButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(hitNextButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(pagesLabel) .addComponent(pagesLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(pageCurLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(pageCurLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 30,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(pageOfLabel) .addComponent(pageOfLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(pageTotalLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(pageTotalLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 30,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18) .addGap(18, 18, 18)
.addComponent(pageButtonsLabel) .addComponent(pageButtonsLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(pagePreviousButton) .addComponent(pagePreviousButton)
.addGap(0, 0, 0) .addGap(0, 0, 0)
.addComponent(pageNextButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(pageNextButton, javax.swing.GroupLayout.PREFERRED_SIZE,
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 71, Short.MAX_VALUE) javax.swing.GroupLayout.DEFAULT_SIZE,
.addComponent(sourceComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 71,
Short.MAX_VALUE)
.addComponent(sourceComboBox, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(sourceComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(sourceComboBox,
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) javax.swing.GroupLayout.PREFERRED_SIZE,
.addComponent(hitCountLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(hitCountLabel,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(hitOfLabel) .addComponent(hitOfLabel)
.addComponent(hitTotalLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(hitTotalLabel,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(hitLabel) .addComponent(hitLabel)
.addComponent(hitButtonsLabel)) .addComponent(hitButtonsLabel))
.addComponent(hitPreviousButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(hitPreviousButton,
.addComponent(hitNextButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) javax.swing.GroupLayout.PREFERRED_SIZE, 23,
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(hitNextButton,
javax.swing.GroupLayout.PREFERRED_SIZE, 23,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(pageButtonsLabel) .addComponent(pageButtonsLabel)
.addComponent(pageTotalLabel) .addComponent(pageTotalLabel)
.addComponent(pagesLabel) .addComponent(pagesLabel)
.addComponent(pageCurLabel) .addComponent(pageCurLabel)
.addComponent(pageOfLabel)) .addComponent(pageOfLabel))
.addComponent(pageNextButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(pageNextButton,
.addComponent(pagePreviousButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)) javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(pagePreviousButton,
javax.swing.GroupLayout.PREFERRED_SIZE, 23,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, 0) .addGap(0, 0, 0)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 293, Short.MAX_VALUE)) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 293,
Short.MAX_VALUE))
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenuItem copyMenuItem; private javax.swing.JMenuItem copyMenuItem;
private javax.swing.JTextPane extractedTextPane; private javax.swing.JTextPane extractedTextPane;
@ -395,6 +461,7 @@ class ExtractedContentPanel extends javax.swing.JPanel {
/** /**
* Get the source selected in the combo box * Get the source selected in the combo box
*
* @return currently selected Source * @return currently selected Source
*/ */
public MarkupSource getSelectedSource() { public MarkupSource getSelectedSource() {
@ -438,7 +505,6 @@ class ExtractedContentPanel extends javax.swing.JPanel {
} }
/** /**
*
* @param current, current hit to update the display with * @param current, current hit to update the display with
*/ */
void updateCurrentMatchDisplay(int current) { void updateCurrentMatchDisplay(int current) {
@ -450,7 +516,6 @@ class ExtractedContentPanel extends javax.swing.JPanel {
} }
/** /**
*
* @param total total number of hits to update the display with * @param total total number of hits to update the display with
*/ */
void updateTotaMatcheslDisplay(int total) { void updateTotaMatcheslDisplay(int total) {
@ -462,7 +527,6 @@ class ExtractedContentPanel extends javax.swing.JPanel {
} }
/** /**
*
* @param current, current page to update the display with * @param current, current page to update the display with
*/ */
void updateCurrentPageDisplay(int current) { void updateCurrentPageDisplay(int current) {
@ -470,7 +534,6 @@ class ExtractedContentPanel extends javax.swing.JPanel {
} }
/** /**
*
* @param total total number of pages to update the display with * @param total total number of pages to update the display with
*/ */
void updateTotalPageslDisplay(int total) { void updateTotalPageslDisplay(int total) {

View File

@ -78,8 +78,7 @@ public class ExtractedContentViewer implements DataContentViewer {
//for now, do not update second time //for now, do not update second time
if (selectedNode == currentNode) { if (selectedNode == currentNode) {
return; return;
} } else {
else {
currentNode = selectedNode; currentNode = selectedNode;
} }
@ -415,8 +414,7 @@ public class ExtractedContentViewer implements DataContentViewer {
int chunkId = 0; int chunkId = 0;
if (hasChunks) { if (hasChunks) {
chunkId = currentPage; chunkId = currentPage;
} } else {
else {
//if no chunks, it is safe to assume there is no text content //if no chunks, it is safe to assume there is no text content
//because we are storing extracted text in chunks only //because we are storing extracted text in chunks only
//and the non-chunk stores meta-data only //and the non-chunk stores meta-data only
@ -426,13 +424,15 @@ public class ExtractedContentViewer implements DataContentViewer {
//we know it's AbstractFile, but do quick check to make sure if we index other objects in future //we know it's AbstractFile, but do quick check to make sure if we index other objects in future
boolean isKnown = FileKnown.KNOWN.equals(((AbstractFile) contentObj).getKnown()); boolean isKnown = FileKnown.KNOWN.equals(((AbstractFile) contentObj).getKnown());
if (isKnown && KeywordSearchSettings.getSkipKnown()) { if (isKnown && KeywordSearchSettings.getSkipKnown()) {
msg = NbBundle.getMessage(this.getClass(), "ExtractedContentViewer.getSolrContent.knownFileMsg", name); msg = NbBundle
.getMessage(this.getClass(), "ExtractedContentViewer.getSolrContent.knownFileMsg", name);
} }
} }
if (msg == null) { if (msg == null) {
msg = NbBundle.getMessage(this.getClass(), "ExtractedContentViewer.getSolrContent.noTxtYetMsg", name); msg = NbBundle.getMessage(this.getClass(), "ExtractedContentViewer.getSolrContent.noTxtYetMsg", name);
} }
String htmlMsg = NbBundle.getMessage(this.getClass(), "ExtractedContentViewer.getSolrContent.txtBodyItal", msg); String htmlMsg = NbBundle
.getMessage(this.getClass(), "ExtractedContentViewer.getSolrContent.txtBodyItal", msg);
return htmlMsg; return htmlMsg;
} }

View File

@ -94,7 +94,8 @@ class HighlightedMatchesSource implements MarkupSource, HighlightLookup {
this.hits = hits; this.hits = hits;
} }
HighlightedMatchesSource(Content content, String solrQuery, boolean isRegex, boolean group, Map<String, List<ContentHit>> hits) { HighlightedMatchesSource(Content content, String solrQuery, boolean isRegex, boolean group,
Map<String, List<ContentHit>> hits) {
this(content, solrQuery, isRegex, hits); this(content, solrQuery, isRegex, hits);
this.group = group; this.group = group;
} }
@ -345,11 +346,13 @@ class HighlightedMatchesSource implements MarkupSource, HighlightLookup {
final String filterQuery = Server.Schema.ID.toString() + ":" + contentIdStr; final String filterQuery = Server.Schema.ID.toString() + ":" + contentIdStr;
q.addFilterQuery(filterQuery); q.addFilterQuery(filterQuery);
q.addHighlightField(highLightField); //for exact highlighting, try content_ws field (with stored="true" in Solr schema) q.addHighlightField(
highLightField); //for exact highlighting, try content_ws field (with stored="true" in Solr schema)
//q.setHighlightSimplePre(HIGHLIGHT_PRE); //original highlighter only //q.setHighlightSimplePre(HIGHLIGHT_PRE); //original highlighter only
//q.setHighlightSimplePost(HIGHLIGHT_POST); //original highlighter only //q.setHighlightSimplePost(HIGHLIGHT_POST); //original highlighter only
q.setHighlightFragsize(0); // don't fragment the highlight, works with original highlighter, or needs "single" list builder with FVH q.setHighlightFragsize(
0); // don't fragment the highlight, works with original highlighter, or needs "single" list builder with FVH
//tune the highlighter //tune the highlighter
q.setParam("hl.useFastVectorHighlighter", "on"); //fast highlighter scales better than standard one q.setParam("hl.useFastVectorHighlighter", "on"); //fast highlighter scales better than standard one
@ -439,6 +442,7 @@ class HighlightedMatchesSource implements MarkupSource, HighlightLookup {
return buf.toString(); return buf.toString();
} }
//dummy instance for Lookup only //dummy instance for Lookup only
private static HighlightLookup instance = null; private static HighlightLookup instance = null;

View File

@ -32,6 +32,7 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import java.util.logging.Level; import java.util.logging.Level;
import org.apache.solr.client.solrj.SolrRequest.METHOD; import org.apache.solr.client.solrj.SolrRequest.METHOD;
import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.request.AbstractUpdateRequest; import org.apache.solr.client.solrj.request.AbstractUpdateRequest;
@ -265,7 +266,7 @@ class Ingester {
* It reads and converts the entire content stream to string, assuming UTF8 * It reads and converts the entire content stream to string, assuming UTF8
* since we can't use streaming approach for Solr /update handler. * since we can't use streaming approach for Solr /update handler.
* This should be safe, since all content is now in max 1MB chunks. * This should be safe, since all content is now in max 1MB chunks.
* * <p/>
* TODO see if can use a byte or string streaming way to add content to /update handler * TODO see if can use a byte or string streaming way to add content to /update handler
* e.g. with XMLUpdateRequestHandler (deprecated in SOlr 4.0.0), see if possible * e.g. with XMLUpdateRequestHandler (deprecated in SOlr 4.0.0), see if possible
* to stream with UpdateRequestHandler * to stream with UpdateRequestHandler
@ -306,7 +307,8 @@ class Ingester {
try { try {
is.close(); is.close();
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.WARNING, "Could not close input stream after reading content, " + cs.getName(), ex); logger.log(Level.WARNING, "Could not close input stream after reading content, " + cs.getName(),
ex);
} }
} }
@ -321,8 +323,7 @@ class Ingester {
} else { } else {
updateDoc.addField(Server.Schema.CONTENT.toString(), ""); updateDoc.addField(Server.Schema.CONTENT.toString(), "");
} }
} } else {
else {
//no content, such as case when 0th chunk indexed //no content, such as case when 0th chunk indexed
updateDoc.addField(Server.Schema.CONTENT.toString(), ""); updateDoc.addField(Server.Schema.CONTENT.toString(), "");
} }
@ -347,7 +348,6 @@ class Ingester {
* @param fields content specific fields * @param fields content specific fields
* @param size size of the content - used to determine the Solr timeout, not * @param size size of the content - used to determine the Solr timeout, not
* used to populate meta-data * used to populate meta-data
*
* @throws IngesterException if there was an error processing a specific * @throws IngesterException if there was an error processing a specific
* content, but the Solr server is probably fine. * content, but the Solr server is probably fine.
*/ */
@ -373,9 +373,12 @@ class Ingester {
logger.log(Level.WARNING, "Solr timeout encountered, trying to restart Solr"); logger.log(Level.WARNING, "Solr timeout encountered, trying to restart Solr");
//restart may be needed to recover from some error conditions //restart may be needed to recover from some error conditions
hardSolrRestart(); hardSolrRestart();
throw new IngesterException("Solr index request time out for id: " + fields.get("id") + ", name: " + fields.get("file_name")); throw new IngesterException(
"Solr index request time out for id: " + fields.get("id") + ", name: " + fields.get("file_name"));
} catch (Exception e) { } catch (Exception e) {
throw new IngesterException("Problem posting content to Solr, id: " + fields.get("id") + ", name: " + fields.get("file_name"), e); throw new IngesterException(
"Problem posting content to Solr, id: " + fields.get("id") + ", name: " + fields.get("file_name"),
e);
} }
uncommitedIngests = true; uncommitedIngests = true;
} }
@ -458,7 +461,8 @@ class Ingester {
// When Tika has problems with a document, it throws a server error // When Tika has problems with a document, it throws a server error
// but it's okay to continue with other documents // but it's okay to continue with other documents
if (ec.equals(ErrorCode.SERVER_ERROR)) { if (ec.equals(ErrorCode.SERVER_ERROR)) {
throw new RuntimeException("Problem posting file contents to Solr. SolrException error code: " + ec, ex); throw new RuntimeException("Problem posting file contents to Solr. SolrException error code: " + ec,
ex);
} else { } else {
// shouldn't get any other error codes // shouldn't get any other error codes
throw ex; throw ex;

View File

@ -19,6 +19,7 @@
package org.sleuthkit.autopsy.keywordsearch; package org.sleuthkit.autopsy.keywordsearch;
import java.util.logging.Level; import java.util.logging.Level;
import org.openide.modules.ModuleInstall; import org.openide.modules.ModuleInstall;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.openide.windows.WindowManager; import org.openide.windows.WindowManager;
@ -31,7 +32,7 @@ import org.sleuthkit.autopsy.coreutils.Version;
/** /**
* Starts up the Solr server when the module is loaded, and stops it when the * Starts up the Solr server when the module is loaded, and stops it when the
* application is closed. * application is closed.
* * <p/>
* In addition, the default KeywordSearch config files (NSRL, Options, Scripts) * In addition, the default KeywordSearch config files (NSRL, Options, Scripts)
* are generated here, if they config files do not already exist. * are generated here, if they config files do not already exist.
*/ */
@ -202,7 +203,9 @@ class Installer extends ModuleInstall {
WindowManager.getDefault().invokeWhenUIReady(new Runnable() { WindowManager.getDefault().invokeWhenUIReady(new Runnable() {
@Override @Override
public void run() { public void run() {
final String msg = NbBundle.getMessage(this.getClass(), "Installer.reportPortError", curFailPort, Version.getName(), Server.PROPERTIES_CURRENT_SERVER_PORT, Server.PROPERTIES_FILE); final String msg = NbBundle
.getMessage(this.getClass(), "Installer.reportPortError", curFailPort, Version.getName(),
Server.PROPERTIES_CURRENT_SERVER_PORT, Server.PROPERTIES_FILE);
MessageNotifyUtil.Notify.error(NbBundle.getMessage(this.getClass(), "Installer.errorInitKsmMsg"), msg); MessageNotifyUtil.Notify.error(NbBundle.getMessage(this.getClass(), "Installer.errorInitKsmMsg"), msg);
} }
}); });
@ -212,7 +215,8 @@ class Installer extends ModuleInstall {
WindowManager.getDefault().invokeWhenUIReady(new Runnable() { WindowManager.getDefault().invokeWhenUIReady(new Runnable() {
@Override @Override
public void run() { public void run() {
final String msg = NbBundle.getMessage(this.getClass(), "Installer.reportStopPortError", curFailPort, Server.PROPERTIES_CURRENT_STOP_PORT, Server.PROPERTIES_FILE); final String msg = NbBundle.getMessage(this.getClass(), "Installer.reportStopPortError", curFailPort,
Server.PROPERTIES_CURRENT_STOP_PORT, Server.PROPERTIES_FILE);
MessageNotifyUtil.Notify.error(NbBundle.getMessage(this.getClass(), "Installer.errorInitKsmMsg"), msg); MessageNotifyUtil.Notify.error(NbBundle.getMessage(this.getClass(), "Installer.errorInitKsmMsg"), msg);
} }
}); });
@ -222,7 +226,10 @@ class Installer extends ModuleInstall {
WindowManager.getDefault().invokeWhenUIReady(new Runnable() { WindowManager.getDefault().invokeWhenUIReady(new Runnable() {
@Override @Override
public void run() { public void run() {
final String msg = NbBundle.getMessage(this.getClass(), "Installer.reportInitError", KeywordSearch.getServer().getCurrentSolrServerPort(), Version.getName(), Server.PROPERTIES_CURRENT_SERVER_PORT, Server.PROPERTIES_FILE); final String msg = NbBundle.getMessage(this.getClass(), "Installer.reportInitError",
KeywordSearch.getServer().getCurrentSolrServerPort(),
Version.getName(), Server.PROPERTIES_CURRENT_SERVER_PORT,
Server.PROPERTIES_FILE);
MessageNotifyUtil.Notify.error(NbBundle.getMessage(this.getClass(), "Installer.errorInitKsmMsg"), msg); MessageNotifyUtil.Notify.error(NbBundle.getMessage(this.getClass(), "Installer.errorInitKsmMsg"), msg);
MessageNotifyUtil.Notify.error(NbBundle.getMessage(this.getClass(), "Installer.errorInitKsmMsg"), msg); MessageNotifyUtil.Notify.error(NbBundle.getMessage(this.getClass(), "Installer.errorInitKsmMsg"), msg);

View File

@ -24,6 +24,7 @@ import java.io.Reader;
import java.io.StringReader; import java.io.StringReader;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import net.htmlparser.jericho.Attributes; import net.htmlparser.jericho.Attributes;
import net.htmlparser.jericho.Renderer; import net.htmlparser.jericho.Renderer;
@ -49,6 +50,7 @@ class JerichoParserWrapper {
/** /**
* Returns the reader, initialized in parse(), which will be * Returns the reader, initialized in parse(), which will be
* null if parse() is not called or if parse() throws an error. * null if parse() is not called or if parse() throws an error.
*
* @return Reader * @return Reader
*/ */
public Reader getReader() { public Reader getReader() {
@ -122,16 +124,20 @@ class JerichoParserWrapper {
if (numScripts > 1) { if (numScripts > 1) {
out.append("---Scripts---\n"); out.append("---Scripts---\n");
out.append(scripts.toString()).append("\n"); out.append(scripts.toString()).append("\n");
} if(numLinks>1) { }
if (numLinks > 1) {
out.append("---Links---\n"); out.append("---Links---\n");
out.append(links.toString()).append("\n"); out.append(links.toString()).append("\n");
} if(numImages>1) { }
if (numImages > 1) {
out.append("---Images---\n"); out.append("---Images---\n");
out.append(images.toString()).append("\n"); out.append(images.toString()).append("\n");
} if(numComments>1) { }
if (numComments > 1) {
out.append("---Comments---\n"); out.append("---Comments---\n");
out.append(comments.toString()).append("\n"); out.append(comments.toString()).append("\n");
} if(numOthers>1) { }
if (numOthers > 1) {
out.append("---Others---\n"); out.append("---Others---\n");
out.append(others.toString()).append("\n"); out.append(others.toString()).append("\n");
} }

View File

@ -30,7 +30,6 @@ class Keyword {
private BlackboardAttribute.ATTRIBUTE_TYPE keywordType = null; private BlackboardAttribute.ATTRIBUTE_TYPE keywordType = null;
/** /**
*
* @param query Keyword to search for * @param query Keyword to search for
* @param isLiteral false if reg exp * @param isLiteral false if reg exp
*/ */
@ -40,7 +39,6 @@ class Keyword {
} }
/** /**
*
* @param query Keyword to search for * @param query Keyword to search for
* @param isLiteral false if reg exp * @param isLiteral false if reg exp
* @param keywordType * @param keywordType
@ -59,7 +57,6 @@ class Keyword {
} }
/** /**
*
* @return Keyword to search for * @return Keyword to search for
*/ */
String getQuery() { String getQuery() {
@ -72,11 +69,11 @@ class Keyword {
@Override @Override
public String toString() { public String toString() {
return "Keyword{" + "query=" + keywordString + ", isLiteral=" + isLiteral + ", keywordType=" + keywordType + '}'; return "Keyword{" + "query=" + keywordString + ", isLiteral=" + isLiteral + ", keywordType=" + keywordType
+ '}';
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null) { if (obj == null) {
@ -86,7 +83,8 @@ class Keyword {
return false; return false;
} }
final Keyword other = (Keyword) obj; final Keyword other = (Keyword) obj;
if ((this.keywordString == null) ? (other.keywordString != null) : !this.keywordString.equals(other.keywordString)) { if ((this.keywordString == null) ? (other.keywordString != null)
: !this.keywordString.equals(other.keywordString)) {
return false; return false;
} }
if (this.isLiteral != other.isLiteral) { if (this.isLiteral != other.isLiteral) {

View File

@ -23,7 +23,6 @@ import java.util.Iterator;
import java.util.Set; import java.util.Set;
/** /**
*
* Filter to restrict query only specific files, chunks, images * Filter to restrict query only specific files, chunks, images
* Single filter supports multiple ids per file/chunk/image, that act as OR filter * Single filter supports multiple ids per file/chunk/image, that act as OR filter
*/ */

View File

@ -27,6 +27,7 @@ import java.util.logging.FileHandler;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.util.logging.SimpleFormatter; import java.util.logging.SimpleFormatter;
import org.openide.util.Exceptions; import org.openide.util.Exceptions;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.PlatformUtil;
@ -66,7 +67,8 @@ class KeywordSearch {
static { static {
try { try {
final int MAX_TIKA_LOG_FILES = 3; final int MAX_TIKA_LOG_FILES = 3;
FileHandler tikaLogHandler = new FileHandler(PlatformUtil.getUserDirectory().getAbsolutePath() + "/var/log/tika.log", FileHandler tikaLogHandler = new FileHandler(
PlatformUtil.getUserDirectory().getAbsolutePath() + "/var/log/tika.log",
0, MAX_TIKA_LOG_FILES); 0, MAX_TIKA_LOG_FILES);
tikaLogHandler.setFormatter(new SimpleFormatter()); tikaLogHandler.setFormatter(new SimpleFormatter());
tikaLogHandler.setEncoding(PlatformUtil.getLogFileEncoding()); tikaLogHandler.setEncoding(PlatformUtil.getLogFileEncoding());

View File

@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.keywordsearch;
import java.awt.Component; import java.awt.Component;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
import org.openide.util.actions.Presenter; import org.openide.util.actions.Presenter;
final class KeywordSearchAction extends AbstractAction implements Presenter.Toolbar { final class KeywordSearchAction extends AbstractAction implements Presenter.Toolbar {

View File

@ -23,6 +23,7 @@ import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.event.WindowListener; import java.awt.event.WindowListener;
import org.openide.util.HelpCtx; import org.openide.util.HelpCtx;
import org.openide.util.actions.CallableSystemAction; import org.openide.util.actions.CallableSystemAction;
import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationDialog; import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationDialog;
@ -32,7 +33,8 @@ import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationDialog;
*/ */
class KeywordSearchConfigurationAction extends CallableSystemAction { class KeywordSearchConfigurationAction extends CallableSystemAction {
private static final String ACTION_NAME = org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "ListBundleConfig"); private static final String ACTION_NAME = org.openide.util.NbBundle
.getMessage(KeywordSearchPanel.class, "ListBundleConfig");
private KeywordSearchConfigurationPanel panel; private KeywordSearchConfigurationPanel panel;
@Override @Override

View File

@ -41,12 +41,24 @@ final class KeywordSearchConfigurationPanel extends javax.swing.JPanel implement
listsPanel = new KeywordSearchConfigurationPanel1(); listsPanel = new KeywordSearchConfigurationPanel1();
languagesPanel = new KeywordSearchConfigurationPanel3(); languagesPanel = new KeywordSearchConfigurationPanel3();
generalPanel = new KeywordSearchConfigurationPanel2(); generalPanel = new KeywordSearchConfigurationPanel2();
tabbedPane.insertTab(NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel.customizeComponents.listTabTitle"), null, tabbedPane.insertTab(NbBundle.getMessage(this.getClass(),
listsPanel, NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel.customizeComponents.listLabToolTip"), 0); "KeywordSearchConfigurationPanel.customizeComponents.listTabTitle"),
tabbedPane.insertTab(NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel.customizeComponents.stringExtTitle"), null, null,
languagesPanel, NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel.customizeComponents.stringExtToolTip"), 1); listsPanel, NbBundle.getMessage(this.getClass(),
tabbedPane.insertTab(NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel.customizeComponents.genTabTitle"), null, "KeywordSearchConfigurationPanel.customizeComponents.listLabToolTip"),
generalPanel, NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel.customizeComponents.genTabToolTip"), 2); 0);
tabbedPane.insertTab(NbBundle.getMessage(this.getClass(),
"KeywordSearchConfigurationPanel.customizeComponents.stringExtTitle"),
null,
languagesPanel, NbBundle.getMessage(this.getClass(),
"KeywordSearchConfigurationPanel.customizeComponents.stringExtToolTip"),
1);
tabbedPane.insertTab(
NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel.customizeComponents.genTabTitle"),
null,
generalPanel, NbBundle.getMessage(this.getClass(),
"KeywordSearchConfigurationPanel.customizeComponents.genTabToolTip"),
2);
} }
/** /**
@ -63,11 +75,13 @@ final class KeywordSearchConfigurationPanel extends javax.swing.JPanel implement
this.setLayout(layout); this.setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(tabbedPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 675, Short.MAX_VALUE) .addComponent(tabbedPane, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.DEFAULT_SIZE, 675, Short.MAX_VALUE)
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(tabbedPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 505, Short.MAX_VALUE) .addComponent(tabbedPane, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.DEFAULT_SIZE, 505, Short.MAX_VALUE)
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents

View File

@ -41,9 +41,12 @@ class KeywordSearchConfigurationPanel1 extends javax.swing.JPanel implements Opt
KeywordSearchListsManagementPanel listsManagementPanel; KeywordSearchListsManagementPanel listsManagementPanel;
KeywordSearchEditListPanel editListPanel; KeywordSearchEditListPanel editListPanel;
private static final Logger logger = Logger.getLogger(KeywordSearchConfigurationPanel1.class.getName()); private static final Logger logger = Logger.getLogger(KeywordSearchConfigurationPanel1.class.getName());
private static final String KEYWORD_CONFIG_NAME = org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "ListBundleConfig"); private static final String KEYWORD_CONFIG_NAME = org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class,
"ListBundleConfig");
/** Creates new form KeywordSearchConfigurationPanel1 */ /**
* Creates new form KeywordSearchConfigurationPanel1
*/
KeywordSearchConfigurationPanel1() { KeywordSearchConfigurationPanel1() {
initComponents(); initComponents();
@ -60,8 +63,10 @@ class KeywordSearchConfigurationPanel1 extends javax.swing.JPanel implements Opt
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (KeywordSearchUtil.displayConfirmDialog(NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel1.customizeComponents.title") if (KeywordSearchUtil.displayConfirmDialog(NbBundle.getMessage(this.getClass(),
, NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel1.customizeComponents.body" ) "KeywordSearchConfigurationPanel1.customizeComponents.title")
, NbBundle.getMessage(this.getClass(),
"KeywordSearchConfigurationPanel1.customizeComponents.body")
, KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN)) { , KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN)) {
KeywordSearchListsXML deleter = KeywordSearchListsXML.getCurrent(); KeywordSearchListsXML deleter = KeywordSearchListsXML.getCurrent();
@ -84,7 +89,8 @@ class KeywordSearchConfigurationPanel1 extends javax.swing.JPanel implements Opt
List<Keyword> keywords = currentKeywordList.getKeywords(); List<Keyword> keywords = currentKeywordList.getKeywords();
if (keywords.isEmpty()) { if (keywords.isEmpty()) {
KeywordSearchUtil.displayDialog(FEATURE_NAME, NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel1.customizeComponents.keywordListEmptyErr"), KeywordSearchUtil.displayDialog(FEATURE_NAME, NbBundle.getMessage(this.getClass(),
"KeywordSearchConfigurationPanel1.customizeComponents.keywordListEmptyErr"),
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO); KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
return; return;
} }
@ -102,12 +108,17 @@ class KeywordSearchConfigurationPanel1 extends javax.swing.JPanel implements Opt
} }
if (writer.listExists(listName) && writer.getList(listName).isLocked()) { if (writer.listExists(listName) && writer.getList(listName).isLocked()) {
KeywordSearchUtil.displayDialog(FEATURE_NAME, NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel1.customizeComponents.noOwDefaultMsg"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN); KeywordSearchUtil.displayDialog(FEATURE_NAME, NbBundle.getMessage(this.getClass(),
"KeywordSearchConfigurationPanel1.customizeComponents.noOwDefaultMsg"),
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
return; return;
} }
boolean shouldAdd = false; boolean shouldAdd = false;
if (writer.listExists(listName)) { if (writer.listExists(listName)) {
boolean replace = KeywordSearchUtil.displayConfirmDialog(FEATURE_NAME, NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel1.customizeComponents.kwListExistMsg", listName), boolean replace = KeywordSearchUtil.displayConfirmDialog(FEATURE_NAME,
NbBundle.getMessage(this.getClass(),
"KeywordSearchConfigurationPanel1.customizeComponents.kwListExistMsg",
listName),
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN); KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
if (replace) { if (replace) {
shouldAdd = true; shouldAdd = true;
@ -119,7 +130,10 @@ class KeywordSearchConfigurationPanel1 extends javax.swing.JPanel implements Opt
if (shouldAdd) { if (shouldAdd) {
writer.addList(listName, keywords); writer.addList(listName, keywords);
KeywordSearchUtil.displayDialog(FEATURE_NAME, NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel1.customizeComponents.kwListSavedMsg", listName), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO); KeywordSearchUtil.displayDialog(FEATURE_NAME, NbBundle.getMessage(this.getClass(),
"KeywordSearchConfigurationPanel1.customizeComponents.kwListSavedMsg",
listName),
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
} }
//currentKeywordList = writer.getList(listName); //currentKeywordList = writer.getList(listName);
@ -146,7 +160,8 @@ class KeywordSearchConfigurationPanel1 extends javax.swing.JPanel implements Opt
listsManagementPanel.load(); listsManagementPanel.load();
} }
/** This method is called from within the constructor to /**
* This method is called from within the constructor to
* initialize the form. * initialize the form.
* WARNING: Do NOT modify this code. The content of this method is * WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor. * always regenerated by the Form Editor.

View File

@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.keywordsearch;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.util.logging.Level; import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.SolrServerException;
import org.sleuthkit.autopsy.corecomponents.OptionsPanel; import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
@ -97,35 +98,52 @@ class KeywordSearchConfigurationPanel2 extends javax.swing.JPanel implements Opt
timeRadioButton3 = new javax.swing.JRadioButton(); timeRadioButton3 = new javax.swing.JRadioButton();
timeRadioButton4 = new javax.swing.JRadioButton(); timeRadioButton4 = new javax.swing.JRadioButton();
skipNSRLCheckBox.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.skipNSRLCheckBox.text")); // NOI18N skipNSRLCheckBox.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class,
skipNSRLCheckBox.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.skipNSRLCheckBox.toolTipText")); // NOI18N "KeywordSearchConfigurationPanel2.skipNSRLCheckBox.text")); // NOI18N
skipNSRLCheckBox.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class,
"KeywordSearchConfigurationPanel2.skipNSRLCheckBox.toolTipText")); // NOI18N
filesIndexedLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.filesIndexedLabel.text")); // NOI18N filesIndexedLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class,
"KeywordSearchConfigurationPanel2.filesIndexedLabel.text")); // NOI18N
filesIndexedValue.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.filesIndexedValue.text")); // NOI18N filesIndexedValue.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class,
"KeywordSearchConfigurationPanel2.filesIndexedValue.text")); // NOI18N
filesIndexedValue.setMaximumSize(null); filesIndexedValue.setMaximumSize(null);
chunksLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.chunksLabel.text")); // NOI18N chunksLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class,
"KeywordSearchConfigurationPanel2.chunksLabel.text")); // NOI18N
chunksValLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.chunksValLabel.text")); // NOI18N chunksValLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class,
"KeywordSearchConfigurationPanel2.chunksValLabel.text")); // NOI18N
settingsLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.settingsLabel.text")); // NOI18N settingsLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class,
"KeywordSearchConfigurationPanel2.settingsLabel.text")); // NOI18N
informationLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.informationLabel.text")); // NOI18N informationLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class,
"KeywordSearchConfigurationPanel2.informationLabel.text")); // NOI18N
frequencyLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.frequencyLabel.text")); // NOI18N frequencyLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class,
"KeywordSearchConfigurationPanel2.frequencyLabel.text")); // NOI18N
timeRadioButton1.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.timeRadioButton1.text")); // NOI18N timeRadioButton1.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class,
timeRadioButton1.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.timeRadioButton1.toolTipText")); // NOI18N "KeywordSearchConfigurationPanel2.timeRadioButton1.text")); // NOI18N
timeRadioButton1.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class,
"KeywordSearchConfigurationPanel2.timeRadioButton1.toolTipText")); // NOI18N
timeRadioButton2.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.timeRadioButton2.text")); // NOI18N timeRadioButton2.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class,
timeRadioButton2.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.timeRadioButton2.toolTipText")); // NOI18N "KeywordSearchConfigurationPanel2.timeRadioButton2.text")); // NOI18N
timeRadioButton2.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class,
"KeywordSearchConfigurationPanel2.timeRadioButton2.toolTipText")); // NOI18N
timeRadioButton3.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.timeRadioButton3.text")); // NOI18N timeRadioButton3.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class,
timeRadioButton3.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.timeRadioButton3.toolTipText")); // NOI18N "KeywordSearchConfigurationPanel2.timeRadioButton3.text")); // NOI18N
timeRadioButton3.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class,
"KeywordSearchConfigurationPanel2.timeRadioButton3.toolTipText")); // NOI18N
timeRadioButton4.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.timeRadioButton4.text_1")); // NOI18N timeRadioButton4.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class,
timeRadioButton4.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.timeRadioButton4.toolTipText")); // NOI18N "KeywordSearchConfigurationPanel2.timeRadioButton4.text_1")); // NOI18N
timeRadioButton4.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class,
"KeywordSearchConfigurationPanel2.timeRadioButton4.toolTipText")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout); this.setLayout(layout);
@ -239,14 +257,11 @@ class KeywordSearchConfigurationPanel2 extends javax.swing.JPanel implements Opt
private UpdateFrequency getSelectedTimeValue() { private UpdateFrequency getSelectedTimeValue() {
if (timeRadioButton1.isSelected()) { if (timeRadioButton1.isSelected()) {
return UpdateFrequency.FAST; return UpdateFrequency.FAST;
} } else if (timeRadioButton2.isSelected()) {
else if (timeRadioButton2.isSelected()) {
return UpdateFrequency.AVG; return UpdateFrequency.AVG;
} } else if (timeRadioButton3.isSelected()) {
else if (timeRadioButton3.isSelected()) {
return UpdateFrequency.SLOW; return UpdateFrequency.SLOW;
} } else if (timeRadioButton4.isSelected()) {
else if (timeRadioButton4.isSelected()) {
return UpdateFrequency.SLOWEST; return UpdateFrequency.SLOWEST;
} }
return UpdateFrequency.DEFAULT; return UpdateFrequency.DEFAULT;
@ -282,7 +297,8 @@ class KeywordSearchConfigurationPanel2 extends javax.swing.JPanel implements Opt
int newFilesIndexed = ((Integer) newValue).intValue(); int newFilesIndexed = ((Integer) newValue).intValue();
filesIndexedValue.setText(Integer.toString(newFilesIndexed)); filesIndexedValue.setText(Integer.toString(newFilesIndexed));
try { try {
chunksValLabel.setText(Integer.toString(KeywordSearch.getServer().queryNumIndexedChunks())); chunksValLabel
.setText(Integer.toString(KeywordSearch.getServer().queryNumIndexedChunks()));
} catch (KeywordSearchModuleException ex) { } catch (KeywordSearchModuleException ex) {
logger.log(Level.WARNING, "Could not get number of indexed chunks"); logger.log(Level.WARNING, "Could not get number of indexed chunks");

View File

@ -26,8 +26,11 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import org.sleuthkit.autopsy.corecomponents.OptionsPanel; import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
import org.sleuthkit.autopsy.coreutils.StringExtract; import org.sleuthkit.autopsy.coreutils.StringExtract;
import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT; import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT;
@ -40,7 +43,8 @@ class KeywordSearchConfigurationPanel3 extends javax.swing.JPanel implements Opt
private static KeywordSearchConfigurationPanel3 instance = null; private static KeywordSearchConfigurationPanel3 instance = null;
private final Logger logger = Logger.getLogger(KeywordSearchConfigurationPanel3.class.getName()); private final Logger logger = Logger.getLogger(KeywordSearchConfigurationPanel3.class.getName());
private final Map<String, StringExtract.StringExtractUnicodeTable.SCRIPT> scripts = new HashMap<String, StringExtract.StringExtractUnicodeTable.SCRIPT>(); private final Map<String, StringExtract.StringExtractUnicodeTable.SCRIPT> scripts
= new HashMap<String, StringExtract.StringExtractUnicodeTable.SCRIPT>();
private ActionListener updateLanguagesAction; private ActionListener updateLanguagesAction;
private List<SCRIPT> toUpdate; private List<SCRIPT> toUpdate;
@ -99,7 +103,8 @@ class KeywordSearchConfigurationPanel3 extends javax.swing.JPanel implements Opt
} }
private void initScriptsCheckBoxes() { private void initScriptsCheckBoxes() {
final List<StringExtract.StringExtractUnicodeTable.SCRIPT> supportedScripts = StringExtract.getSupportedScripts(); final List<StringExtract.StringExtractUnicodeTable.SCRIPT> supportedScripts = StringExtract
.getSupportedScripts();
checkPanel.setLayout(new GridLayout(0, 1)); checkPanel.setLayout(new GridLayout(0, 1));
for (StringExtract.StringExtractUnicodeTable.SCRIPT s : supportedScripts) { for (StringExtract.StringExtractUnicodeTable.SCRIPT s : supportedScripts) {
String text = getLangText(s); String text = getLangText(s);
@ -114,12 +119,14 @@ class KeywordSearchConfigurationPanel3 extends javax.swing.JPanel implements Opt
private void reloadScriptsCheckBoxes() { private void reloadScriptsCheckBoxes() {
boolean utf16 = boolean utf16 =
Boolean.parseBoolean(KeywordSearchSettings.getStringExtractOption(AbstractFileExtract.ExtractOptions.EXTRACT_UTF16.toString())); Boolean.parseBoolean(KeywordSearchSettings.getStringExtractOption(
AbstractFileExtract.ExtractOptions.EXTRACT_UTF16.toString()));
enableUTF16Checkbox.setSelected(utf16); enableUTF16Checkbox.setSelected(utf16);
boolean utf8 = boolean utf8 =
Boolean.parseBoolean(KeywordSearchSettings.getStringExtractOption(AbstractFileExtract.ExtractOptions.EXTRACT_UTF8.toString())); Boolean.parseBoolean(KeywordSearchSettings.getStringExtractOption(
AbstractFileExtract.ExtractOptions.EXTRACT_UTF8.toString()));
enableUTF8Checkbox.setSelected(utf8); enableUTF8Checkbox.setSelected(utf8);
final List<SCRIPT> serviceScripts = KeywordSearchSettings.getStringExtractScripts(); final List<SCRIPT> serviceScripts = KeywordSearchSettings.getStringExtractScripts();
@ -140,12 +147,14 @@ class KeywordSearchConfigurationPanel3 extends javax.swing.JPanel implements Opt
boolean utf16 = boolean utf16 =
Boolean.parseBoolean(KeywordSearchSettings.getStringExtractOption(AbstractFileExtract.ExtractOptions.EXTRACT_UTF16.toString())); Boolean.parseBoolean(KeywordSearchSettings.getStringExtractOption(
AbstractFileExtract.ExtractOptions.EXTRACT_UTF16.toString()));
enableUTF16Checkbox.setSelected(utf16); enableUTF16Checkbox.setSelected(utf16);
boolean utf8 = boolean utf8 =
Boolean.parseBoolean(KeywordSearchSettings.getStringExtractOption(AbstractFileExtract.ExtractOptions.EXTRACT_UTF8.toString())); Boolean.parseBoolean(KeywordSearchSettings.getStringExtractOption(
AbstractFileExtract.ExtractOptions.EXTRACT_UTF8.toString()));
enableUTF8Checkbox.setSelected(utf8); enableUTF8Checkbox.setSelected(utf8);
final boolean extractEnabled = utf16 || utf8; final boolean extractEnabled = utf16 || utf8;
@ -173,7 +182,9 @@ class KeywordSearchConfigurationPanel3 extends javax.swing.JPanel implements Opt
enableUTF16Checkbox = new javax.swing.JCheckBox(); enableUTF16Checkbox = new javax.swing.JCheckBox();
ingestSettingsLabel = new javax.swing.JLabel(); ingestSettingsLabel = new javax.swing.JLabel();
org.openide.awt.Mnemonics.setLocalizedText(languagesLabel, org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel3.class, "KeywordSearchConfigurationPanel3.languagesLabel.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(languagesLabel, org.openide.util.NbBundle.getMessage(
KeywordSearchConfigurationPanel3.class,
"KeywordSearchConfigurationPanel3.languagesLabel.text")); // NOI18N
langPanel.setPreferredSize(new java.awt.Dimension(430, 361)); langPanel.setPreferredSize(new java.awt.Dimension(430, 361));
@ -192,21 +203,27 @@ class KeywordSearchConfigurationPanel3 extends javax.swing.JPanel implements Opt
langPanel.setViewportView(checkPanel); langPanel.setViewportView(checkPanel);
org.openide.awt.Mnemonics.setLocalizedText(enableUTF8Checkbox, org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel3.class, "KeywordSearchConfigurationPanel3.enableUTF8Checkbox.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(enableUTF8Checkbox, org.openide.util.NbBundle.getMessage(
KeywordSearchConfigurationPanel3.class,
"KeywordSearchConfigurationPanel3.enableUTF8Checkbox.text")); // NOI18N
enableUTF8Checkbox.addActionListener(new java.awt.event.ActionListener() { enableUTF8Checkbox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
enableUTF8CheckboxActionPerformed(evt); enableUTF8CheckboxActionPerformed(evt);
} }
}); });
org.openide.awt.Mnemonics.setLocalizedText(enableUTF16Checkbox, org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel3.class, "KeywordSearchConfigurationPanel3.enableUTF16Checkbox.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(enableUTF16Checkbox, org.openide.util.NbBundle.getMessage(
KeywordSearchConfigurationPanel3.class,
"KeywordSearchConfigurationPanel3.enableUTF16Checkbox.text")); // NOI18N
enableUTF16Checkbox.addActionListener(new java.awt.event.ActionListener() { enableUTF16Checkbox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
enableUTF16CheckboxActionPerformed(evt); enableUTF16CheckboxActionPerformed(evt);
} }
}); });
org.openide.awt.Mnemonics.setLocalizedText(ingestSettingsLabel, org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel3.class, "KeywordSearchConfigurationPanel3.ingestSettingsLabel.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(ingestSettingsLabel, org.openide.util.NbBundle.getMessage(
KeywordSearchConfigurationPanel3.class,
"KeywordSearchConfigurationPanel3.ingestSettingsLabel.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout); this.setLayout(layout);
@ -243,7 +260,8 @@ class KeywordSearchConfigurationPanel3 extends javax.swing.JPanel implements Opt
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
private void enableUTF8CheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enableUTF8CheckboxActionPerformed private void enableUTF8CheckboxActionPerformed(
java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enableUTF8CheckboxActionPerformed
boolean selected = this.enableUTF8Checkbox.isSelected(); boolean selected = this.enableUTF8Checkbox.isSelected();
@ -251,7 +269,8 @@ class KeywordSearchConfigurationPanel3 extends javax.swing.JPanel implements Opt
}//GEN-LAST:event_enableUTF8CheckboxActionPerformed }//GEN-LAST:event_enableUTF8CheckboxActionPerformed
private void enableUTF16CheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enableUTF16CheckboxActionPerformed private void enableUTF16CheckboxActionPerformed(
java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enableUTF16CheckboxActionPerformed
boolean selected = this.enableUTF16Checkbox.isSelected(); boolean selected = this.enableUTF16Checkbox.isSelected();

View File

@ -33,6 +33,7 @@ import java.util.logging.Level;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException; import java.util.regex.PatternSyntaxException;
import javax.swing.DefaultListSelectionModel; import javax.swing.DefaultListSelectionModel;
@ -47,6 +48,7 @@ import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.table.AbstractTableModel; import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableCellRenderer; import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn; import javax.swing.table.TableColumn;
import org.sleuthkit.autopsy.corecomponents.OptionsPanel; import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.autopsy.ingest.IngestManager.IngestModuleEvent; import org.sleuthkit.autopsy.ingest.IngestManager.IngestModuleEvent;
@ -64,7 +66,9 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
private boolean ingestRunning; private boolean ingestRunning;
/** Creates new form KeywordSearchEditListPanel */ /**
* Creates new form KeywordSearchEditListPanel
*/
KeywordSearchEditListPanel() { KeywordSearchEditListPanel() {
tableModel = new KeywordTableModel(); tableModel = new KeywordTableModel();
initComponents(); initComponents();
@ -73,12 +77,18 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
private void customizeComponents() { private void customizeComponents() {
chRegex.setToolTipText(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.customizeComponents.kwReToolTip")); chRegex.setToolTipText(
addWordButton.setToolTipText((NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.customizeComponents.addWordToolTip"))); NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.customizeComponents.kwReToolTip"));
addWordField.setToolTipText(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.customizeComponents.enterNewWordToolTip")); addWordButton.setToolTipText((NbBundle
exportButton.setToolTipText(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.customizeComponents.exportToFile")); .getMessage(this.getClass(), "KeywordSearchEditListPanel.customizeComponents.addWordToolTip")));
saveListButton.setToolTipText(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.customizeComponents.saveCurrentWIthNewNameToolTip")); addWordField.setToolTipText(NbBundle.getMessage(this.getClass(),
deleteWordButton.setToolTipText(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.customizeComponents.removeSelectedMsg")); "KeywordSearchEditListPanel.customizeComponents.enterNewWordToolTip"));
exportButton.setToolTipText(
NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.customizeComponents.exportToFile"));
saveListButton.setToolTipText(NbBundle.getMessage(this.getClass(),
"KeywordSearchEditListPanel.customizeComponents.saveCurrentWIthNewNameToolTip"));
deleteWordButton.setToolTipText(NbBundle.getMessage(this.getClass(),
"KeywordSearchEditListPanel.customizeComponents.removeSelectedMsg"));
//keywordTable.setAutoscrolls(true); //keywordTable.setAutoscrolls(true);
//keywordTable.setTableHeader(null); //keywordTable.setTableHeader(null);
@ -160,7 +170,6 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
selectAllMenuItem.addActionListener(actList); selectAllMenuItem.addActionListener(actList);
if (IngestManager.getDefault().isModuleRunning(KeywordSearchIngestModule.getDefault())) { if (IngestManager.getDefault().isModuleRunning(KeywordSearchIngestModule.getDefault())) {
initIngest(0); initIngest(0);
} else { } else {
@ -189,8 +198,8 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
/** /**
* Initialize this panel depending on whether ingest is running * Initialize this panel depending on whether ingest is running
* @param running *
* case 0: ingest running * @param running case 0: ingest running
* case 1: ingest not running * case 1: ingest not running
*/ */
private void initIngest(int running) { private void initIngest(int running) {
@ -253,7 +262,8 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
} }
} }
/** This method is called from within the constructor to /**
* This method is called from within the constructor to
* initialize the form. * initialize the form.
* WARNING: Do NOT modify this code. The content of this method is * WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor. * always regenerated by the Form Editor.
@ -286,16 +296,20 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
saveListButton = new javax.swing.JButton(); saveListButton = new javax.swing.JButton();
exportButton = new javax.swing.JButton(); exportButton = new javax.swing.JButton();
cutMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.cutMenuItem.text")); // NOI18N cutMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class,
"KeywordSearchEditListPanel.cutMenuItem.text")); // NOI18N
rightClickMenu.add(cutMenuItem); rightClickMenu.add(cutMenuItem);
copyMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.copyMenuItem.text")); // NOI18N copyMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class,
"KeywordSearchEditListPanel.copyMenuItem.text")); // NOI18N
rightClickMenu.add(copyMenuItem); rightClickMenu.add(copyMenuItem);
pasteMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.pasteMenuItem.text")); // NOI18N pasteMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class,
"KeywordSearchEditListPanel.pasteMenuItem.text")); // NOI18N
rightClickMenu.add(pasteMenuItem); rightClickMenu.add(pasteMenuItem);
selectAllMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.selectAllMenuItem.text")); // NOI18N selectAllMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class,
"KeywordSearchEditListPanel.selectAllMenuItem.text")); // NOI18N
rightClickMenu.add(selectAllMenuItem); rightClickMenu.add(selectAllMenuItem);
setMinimumSize(new java.awt.Dimension(340, 300)); setMinimumSize(new java.awt.Dimension(340, 300));
@ -310,35 +324,40 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
keywordTable.getTableHeader().setReorderingAllowed(false); keywordTable.getTableHeader().setReorderingAllowed(false);
jScrollPane1.setViewportView(keywordTable); jScrollPane1.setViewportView(keywordTable);
useForIngestCheckbox.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.useForIngestCheckbox.text")); // NOI18N useForIngestCheckbox.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class,
"KeywordSearchEditListPanel.useForIngestCheckbox.text")); // NOI18N
useForIngestCheckbox.addActionListener(new java.awt.event.ActionListener() { useForIngestCheckbox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
useForIngestCheckboxActionPerformed(evt); useForIngestCheckboxActionPerformed(evt);
} }
}); });
addWordButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.addWordButton.text")); // NOI18N addWordButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class,
"KeywordSearchEditListPanel.addWordButton.text")); // NOI18N
addWordButton.addActionListener(new java.awt.event.ActionListener() { addWordButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
addWordButtonActionPerformed(evt); addWordButtonActionPerformed(evt);
} }
}); });
addWordField.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.addWordField.text")); // NOI18N addWordField.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class,
"KeywordSearchEditListPanel.addWordField.text")); // NOI18N
addWordField.addActionListener(new java.awt.event.ActionListener() { addWordField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
addWordFieldActionPerformed(evt); addWordFieldActionPerformed(evt);
} }
}); });
chRegex.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.chRegex.text")); // NOI18N chRegex.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class,
"KeywordSearchEditListPanel.chRegex.text")); // NOI18N
chRegex.addActionListener(new java.awt.event.ActionListener() { chRegex.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
chRegexActionPerformed(evt); chRegexActionPerformed(evt);
} }
}); });
deleteWordButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.deleteWordButton.text")); // NOI18N deleteWordButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class,
"KeywordSearchEditListPanel.deleteWordButton.text")); // NOI18N
deleteWordButton.addActionListener(new java.awt.event.ActionListener() { deleteWordButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
deleteWordButtonActionPerformed(evt); deleteWordButtonActionPerformed(evt);
@ -374,28 +393,39 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
); );
ingestMessagesCheckbox.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.ingestMessagesCheckbox.text")); // NOI18N ingestMessagesCheckbox.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class,
ingestMessagesCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.ingestMessagesCheckbox.toolTipText")); // NOI18N "KeywordSearchEditListPanel.ingestMessagesCheckbox.text")); // NOI18N
ingestMessagesCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class,
"KeywordSearchEditListPanel.ingestMessagesCheckbox.toolTipText")); // NOI18N
ingestMessagesCheckbox.addActionListener(new java.awt.event.ActionListener() { ingestMessagesCheckbox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
ingestMessagesCheckboxActionPerformed(evt); ingestMessagesCheckboxActionPerformed(evt);
} }
}); });
keywordsLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.keywordsLabel.text")); // NOI18N keywordsLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class,
"KeywordSearchEditListPanel.keywordsLabel.text")); // NOI18N
keywordOptionsLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.keywordOptionsLabel.text")); // NOI18N keywordOptionsLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class,
"KeywordSearchEditListPanel.keywordOptionsLabel.text")); // NOI18N
listOptionsLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.listOptionsLabel.text")); // NOI18N listOptionsLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class,
"KeywordSearchEditListPanel.listOptionsLabel.text")); // NOI18N
deleteListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/delete16.png"))); // NOI18N deleteListButton.setIcon(new javax.swing.ImageIcon(
deleteListButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.deleteListButton.text")); // NOI18N getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/delete16.png"))); // NOI18N
deleteListButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class,
"KeywordSearchEditListPanel.deleteListButton.text")); // NOI18N
saveListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/save16.png"))); // NOI18N saveListButton.setIcon(new javax.swing.ImageIcon(
saveListButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.saveListButton.text")); // NOI18N getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/save16.png"))); // NOI18N
saveListButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class,
"KeywordSearchEditListPanel.saveListButton.text")); // NOI18N
exportButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/export16.png"))); // NOI18N exportButton.setIcon(new javax.swing.ImageIcon(
exportButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.exportButton.text")); // NOI18N getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/export16.png"))); // NOI18N
exportButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class,
"KeywordSearchEditListPanel.exportButton.text")); // NOI18N
exportButton.addActionListener(new java.awt.event.ActionListener() { exportButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
exportButtonActionPerformed(evt); exportButtonActionPerformed(evt);
@ -475,15 +505,18 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
this.setLayout(layout); this.setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(listEditorPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(listEditorPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(listEditorPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(listEditorPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
private void addWordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addWordButtonActionPerformed private void addWordButtonActionPerformed(
java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addWordButtonActionPerformed
String newWord = addWordField.getText().trim(); String newWord = addWordField.getText().trim();
boolean isLiteral = !chRegex.isSelected(); boolean isLiteral = !chRegex.isSelected();
final Keyword keyword = new Keyword(newWord, isLiteral); final Keyword keyword = new Keyword(newWord, isLiteral);
@ -491,8 +524,11 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
if (newWord.equals("")) { if (newWord.equals("")) {
return; return;
} else if (currentKeywordList.hasKeyword(keyword)) { } else if (currentKeywordList.hasKeyword(keyword)) {
KeywordSearchUtil.displayDialog(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.newKwTitle"), KeywordSearchUtil
NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.addWordButtonAction.kwAlreadyExistsMsg"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO); .displayDialog(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.newKwTitle"),
NbBundle.getMessage(this.getClass(),
"KeywordSearchEditListPanel.addWordButtonAction.kwAlreadyExistsMsg"),
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
return; return;
} }
@ -507,8 +543,10 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
valid = false; valid = false;
} }
if (!valid) { if (!valid) {
KeywordSearchUtil.displayDialog(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.newKwTitle"), KeywordSearchUtil
NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.invalidKwMsg"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR); .displayDialog(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.newKwTitle"),
NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.invalidKwMsg"),
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
return; return;
} }
@ -521,9 +559,12 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
initButtons(); initButtons();
}//GEN-LAST:event_addWordButtonActionPerformed }//GEN-LAST:event_addWordButtonActionPerformed
private void deleteWordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteWordButtonActionPerformed private void deleteWordButtonActionPerformed(
if (KeywordSearchUtil.displayConfirmDialog(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.removeKwMsg") java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteWordButtonActionPerformed
, NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.deleteWordButtonActionPerformed.delConfirmMsg") if (KeywordSearchUtil
.displayConfirmDialog(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.removeKwMsg")
, NbBundle.getMessage(this.getClass(),
"KeywordSearchEditListPanel.deleteWordButtonActionPerformed.delConfirmMsg")
, KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN)) { , KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN)) {
tableModel.deleteSelected(keywordTable.getSelectedRows()); tableModel.deleteSelected(keywordTable.getSelectedRows());
@ -532,18 +573,22 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
} }
}//GEN-LAST:event_deleteWordButtonActionPerformed }//GEN-LAST:event_deleteWordButtonActionPerformed
private void addWordFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addWordFieldActionPerformed private void addWordFieldActionPerformed(
java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addWordFieldActionPerformed
addWordButtonActionPerformed(evt); addWordButtonActionPerformed(evt);
}//GEN-LAST:event_addWordFieldActionPerformed }//GEN-LAST:event_addWordFieldActionPerformed
private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportButtonActionPerformed private void exportButtonActionPerformed(
java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportButtonActionPerformed
final String FEATURE_NAME = "Keyword List Export"; final String FEATURE_NAME = "Keyword List Export";
JFileChooser chooser = new JFileChooser(); JFileChooser chooser = new JFileChooser();
final String EXTENSION = "xml"; final String EXTENSION = "xml";
FileNameExtensionFilter filter = new FileNameExtensionFilter( FileNameExtensionFilter filter = new FileNameExtensionFilter(
NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.exportButtonActionPerformed.fileFilterLabel"), EXTENSION); NbBundle.getMessage(this.getClass(),
"KeywordSearchEditListPanel.exportButtonActionPerformed.fileFilterLabel"),
EXTENSION);
chooser.setFileFilter(filter); chooser.setFileFilter(filter);
chooser.setSelectedFile(new File(currentKeywordList.getName())); chooser.setSelectedFile(new File(currentKeywordList.getName()));
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
@ -565,8 +610,10 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
boolean shouldWrite = true; boolean shouldWrite = true;
if (selFile.exists()) { if (selFile.exists()) {
shouldWrite = KeywordSearchUtil.displayConfirmDialog(FEATURE_NAME, shouldWrite = KeywordSearchUtil.displayConfirmDialog(FEATURE_NAME,
NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.exportButtonActionPerformed.fileExistPrompt", NbBundle.getMessage(this.getClass(),
selFile.getName()), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN); "KeywordSearchEditListPanel.exportButtonActionPerformed.fileExistPrompt",
selFile.getName()),
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
} }
if (!shouldWrite) { if (!shouldWrite) {
return; return;
@ -575,13 +622,15 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
KeywordSearchListsXML reader = KeywordSearchListsXML.getCurrent(); KeywordSearchListsXML reader = KeywordSearchListsXML.getCurrent();
List<KeywordSearchListsAbstract.KeywordSearchList> toWrite = new ArrayList<KeywordSearchListsAbstract.KeywordSearchList>(); List<KeywordSearchListsAbstract.KeywordSearchList> toWrite
= new ArrayList<KeywordSearchListsAbstract.KeywordSearchList>();
toWrite.add(reader.getList(currentKeywordList.getName())); toWrite.add(reader.getList(currentKeywordList.getName()));
final KeywordSearchListsXML exporter = new KeywordSearchListsXML(fileAbs); final KeywordSearchListsXML exporter = new KeywordSearchListsXML(fileAbs);
boolean written = exporter.saveLists(toWrite); boolean written = exporter.saveLists(toWrite);
if (written) { if (written) {
KeywordSearchUtil.displayDialog(FEATURE_NAME, KeywordSearchUtil.displayDialog(FEATURE_NAME,
NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.exportButtonActionPerformed.kwListExportedMsg"), NbBundle.getMessage(this.getClass(),
"KeywordSearchEditListPanel.exportButtonActionPerformed.kwListExportedMsg"),
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO); KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
} }
} }
@ -590,14 +639,16 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
private void chRegexActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chRegexActionPerformed private void chRegexActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chRegexActionPerformed
}//GEN-LAST:event_chRegexActionPerformed }//GEN-LAST:event_chRegexActionPerformed
private void useForIngestCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useForIngestCheckboxActionPerformed private void useForIngestCheckboxActionPerformed(
java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useForIngestCheckboxActionPerformed
ingestMessagesCheckbox.setEnabled(useForIngestCheckbox.isSelected()); ingestMessagesCheckbox.setEnabled(useForIngestCheckbox.isSelected());
currentKeywordList.setUseForIngest(useForIngestCheckbox.isSelected()); currentKeywordList.setUseForIngest(useForIngestCheckbox.isSelected());
KeywordSearchListsXML updater = KeywordSearchListsXML.getCurrent(); KeywordSearchListsXML updater = KeywordSearchListsXML.getCurrent();
updater.addList(currentKeywordList); updater.addList(currentKeywordList);
}//GEN-LAST:event_useForIngestCheckboxActionPerformed }//GEN-LAST:event_useForIngestCheckboxActionPerformed
private void ingestMessagesCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ingestMessagesCheckboxActionPerformed private void ingestMessagesCheckboxActionPerformed(
java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ingestMessagesCheckboxActionPerformed
currentKeywordList.setIngestMessages(ingestMessagesCheckbox.isSelected()); currentKeywordList.setIngestMessages(ingestMessagesCheckbox.isSelected());
KeywordSearchListsXML updater = KeywordSearchListsXML.getCurrent(); KeywordSearchListsXML updater = KeywordSearchListsXML.getCurrent();
updater.addList(currentKeywordList); updater.addList(currentKeywordList);
@ -698,7 +749,8 @@ private void useForIngestCheckboxActionPerformed(java.awt.event.ActionEvent evt)
colName = NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.kwColName"); colName = NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.kwColName");
break; break;
case 1: case 1:
colName = NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.exportButtonActionPerformed.regExColName"); colName = NbBundle.getMessage(this.getClass(),
"KeywordSearchEditListPanel.exportButtonActionPerformed.regExColName");
break; break;
default: default:
; ;

View File

@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.keywordsearch;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.swing.Action; import javax.swing.Action;
import org.openide.nodes.FilterNode; import org.openide.nodes.FilterNode;
import org.openide.nodes.Node; import org.openide.nodes.Node;
import org.openide.nodes.Node.Property; import org.openide.nodes.Node.Property;
@ -128,11 +129,17 @@ class KeywordSearchFilterNode extends FilterNode {
private List<Action> getFileActions() { private List<Action> getFileActions() {
List<Action> actions = new ArrayList<>(); List<Action> actions = new ArrayList<>();
actions.add(new NewWindowViewAction(NbBundle.getMessage(this.getClass(), "KeywordSearchFilterNode.getFileActions.viewInNewWinActionLbl"), KeywordSearchFilterNode.this)); actions.add(new NewWindowViewAction(NbBundle.getMessage(this.getClass(),
actions.add(new ExternalViewerAction(NbBundle.getMessage(this.getClass(), "KeywordSearchFilterNode.getFileActions.openExternViewActLbl"), getOriginal())); "KeywordSearchFilterNode.getFileActions.viewInNewWinActionLbl"),
KeywordSearchFilterNode.this));
actions.add(new ExternalViewerAction(
NbBundle.getMessage(this.getClass(), "KeywordSearchFilterNode.getFileActions.openExternViewActLbl"),
getOriginal()));
actions.add(null); actions.add(null);
actions.add(ExtractAction.getInstance()); actions.add(ExtractAction.getInstance());
actions.add(new HashSearchAction(NbBundle.getMessage(this.getClass(), "KeywordSearchFilterNode.getFileActions.searchSameMd5"), getOriginal())); actions.add(new HashSearchAction(
NbBundle.getMessage(this.getClass(), "KeywordSearchFilterNode.getFileActions.searchSameMd5"),
getOriginal()));
actions.add(null); // creates a menu separator actions.add(null); // creates a menu separator
actions.add(AddContentTagAction.getInstance()); actions.add(AddContentTagAction.getInstance());
actions.addAll(ContextMenuExtensionPoint.getActions()); actions.addAll(ContextMenuExtensionPoint.getActions());

View File

@ -36,9 +36,11 @@ import java.util.logging.Level;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import javax.swing.Timer; import javax.swing.Timer;
import org.apache.tika.Tika; import org.apache.tika.Tika;
import org.netbeans.api.progress.aggregate.AggregateProgressFactory; import org.netbeans.api.progress.aggregate.AggregateProgressFactory;
import org.netbeans.api.progress.aggregate.AggregateProgressHandle; import org.netbeans.api.progress.aggregate.AggregateProgressHandle;
@ -75,7 +77,7 @@ import org.sleuthkit.datamodel.TskData.FileKnown;
* ingest update interval) Runs a periodic keyword / regular expression search * ingest update interval) Runs a periodic keyword / regular expression search
* on currently configured lists for ingest and writes results to blackboard * on currently configured lists for ingest and writes results to blackboard
* Reports interesting events to Inbox and to viewers * Reports interesting events to Inbox and to viewers
* * <p/>
* Registered as a module in layer.xml * Registered as a module in layer.xml
*/ */
public final class KeywordSearchIngestModule extends IngestModuleAbstractFile { public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
@ -96,10 +98,13 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
int getTime() { int getTime() {
return time; return time;
} }
}; }
;
private static final Logger logger = Logger.getLogger(KeywordSearchIngestModule.class.getName()); private static final Logger logger = Logger.getLogger(KeywordSearchIngestModule.class.getName());
public static final String MODULE_NAME = "Keyword Search"; public static final String MODULE_NAME = "Keyword Search";
public static final String MODULE_DESCRIPTION = "Performs file indexing and periodic search using keywords and regular expressions in lists."; public static final String MODULE_DESCRIPTION
= "Performs file indexing and periodic search using keywords and regular expressions in lists.";
final public static String MODULE_VERSION = Version.getVersion(); final public static String MODULE_VERSION = Version.getVersion();
private static KeywordSearchIngestModule instance = null; private static KeywordSearchIngestModule instance = null;
private IngestServices services; private IngestServices services;
@ -141,7 +146,9 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
SKIPPED_ERROR_INDEXING, ///< File was skipped because index engine had problems SKIPPED_ERROR_INDEXING, ///< File was skipped because index engine had problems
SKIPPED_ERROR_TEXTEXTRACT, ///< File was skipped because of text extraction issues SKIPPED_ERROR_TEXTEXTRACT, ///< File was skipped because of text extraction issues
SKIPPED_ERROR_IO ///< File was skipped because of IO issues reading it SKIPPED_ERROR_IO ///< File was skipped because of IO issues reading it
}; }
;
private Map<Long, IngestStatus> ingestStatus; private Map<Long, IngestStatus> ingestStatus;
//private constructor to ensure singleton instance //private constructor to ensure singleton instance
@ -175,7 +182,8 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
curDataSourceIds.add(fileSourceId); curDataSourceIds.add(fileSourceId);
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Error getting image id of file processed by keyword search: " + abstractFile.getName(), ex); logger.log(Level.SEVERE,
"Error getting image id of file processed by keyword search: " + abstractFile.getName(), ex);
} }
if (abstractFile.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.VIRTUAL_DIR)) { if (abstractFile.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.VIRTUAL_DIR)) {
@ -189,8 +197,7 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
//notify depending module that keyword search (would) encountered error for this file //notify depending module that keyword search (would) encountered error for this file
ingestStatus.put(abstractFile.getId(), IngestStatus.SKIPPED_ERROR_IO); ingestStatus.put(abstractFile.getId(), IngestStatus.SKIPPED_ERROR_IO);
return ProcessResult.ERROR; return ProcessResult.ERROR;
} } else if (KeywordSearchSettings.getSkipKnown() && abstractFile.getKnown().equals(FileKnown.KNOWN)) {
else if (KeywordSearchSettings.getSkipKnown() && abstractFile.getKnown().equals(FileKnown.KNOWN)) {
//index meta-data only //index meta-data only
indexer.indexFile(abstractFile, false); indexer.indexFile(abstractFile, false);
return ProcessResult.OK; return ProcessResult.OK;
@ -337,7 +344,6 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
/** /**
* Initializes the module for new ingest run Sets up threads, timers, * Initializes the module for new ingest run Sets up threads, timers,
* retrieves settings, keyword lists to run on * retrieves settings, keyword lists to run on
*
*/ */
@Override @Override
public void init(IngestModuleInit initContext) { public void init(IngestModuleInit initContext) {
@ -356,7 +362,8 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
if (!server.isRunning()) { if (!server.isRunning()) {
String msg = NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.init.badInitMsg"); String msg = NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.init.badInitMsg");
logger.log(Level.SEVERE, msg); logger.log(Level.SEVERE, msg);
String details = NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.init.tryStopSolrMsg", msg); String details = NbBundle
.getMessage(this.getClass(), "KeywordSearchIngestModule.init.tryStopSolrMsg", msg);
services.postMessage(IngestMessage.createErrorMessage(++messageID, instance, msg, details)); services.postMessage(IngestMessage.createErrorMessage(++messageID, instance, msg, details));
return; return;
@ -399,8 +406,11 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
initKeywords(); initKeywords();
if (keywords.isEmpty() || keywordLists.isEmpty()) { if (keywords.isEmpty() || keywordLists.isEmpty()) {
services.postMessage(IngestMessage.createWarningMessage(++messageID, instance, NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.init.noKwInLstMsg"), services.postMessage(IngestMessage.createWarningMessage(++messageID, instance,
NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.init.onlyIdxKwSkipMsg"))); NbBundle.getMessage(this.getClass(),
"KeywordSearchIngestModule.init.noKwInLstMsg"),
NbBundle.getMessage(this.getClass(),
"KeywordSearchIngestModule.init.onlyIdxKwSkipMsg")));
} }
processedFiles = false; processedFiles = false;
@ -442,8 +452,7 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
if (null == simpleConfigPanel) { if (null == simpleConfigPanel) {
simpleConfigPanel = new KeywordSearchIngestSimplePanel(); simpleConfigPanel = new KeywordSearchIngestSimplePanel();
} } else {
else {
simpleConfigPanel.load(); simpleConfigPanel.load();
} }
@ -543,23 +552,42 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
} }
StringBuilder msg = new StringBuilder(); StringBuilder msg = new StringBuilder();
msg.append("<table border=0><tr><td>").append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.knowFileHeaderLbl")).append("</td><td>").append(text_ingested).append("</td></tr>"); msg.append("<table border=0><tr><td>")
msg.append("<tr><td>").append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.fileGenStringsHead")).append("</td><td>").append(strings_ingested).append("</td></tr>"); .append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.knowFileHeaderLbl"))
msg.append("<tr><td>").append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.mdOnlyLbl")).append("</td><td>").append(metadata_ingested).append("</td></tr>"); .append("</td><td>").append(text_ingested).append("</td></tr>");
msg.append("<tr><td>").append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.idxErrLbl")).append("</td><td>").append(error_index).append("</td></tr>"); msg.append("<tr><td>").append(NbBundle.getMessage(this.getClass(),
msg.append("<tr><td>").append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.errTxtLbl")).append("</td><td>").append(error_text).append("</td></tr>"); "KeywordSearchIngestModule.postIndexSummary.fileGenStringsHead"))
msg.append("<tr><td>").append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.errIoLbl")).append("</td><td>").append(error_io).append("</td></tr>"); .append("</td><td>").append(strings_ingested).append("</td></tr>");
msg.append("<tr><td>")
.append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.mdOnlyLbl"))
.append("</td><td>").append(metadata_ingested).append("</td></tr>");
msg.append("<tr><td>")
.append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.idxErrLbl"))
.append("</td><td>").append(error_index).append("</td></tr>");
msg.append("<tr><td>")
.append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.errTxtLbl"))
.append("</td><td>").append(error_text).append("</td></tr>");
msg.append("<tr><td>")
.append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.errIoLbl"))
.append("</td><td>").append(error_io).append("</td></tr>");
msg.append("</table>"); msg.append("</table>");
String indexStats = msg.toString(); String indexStats = msg.toString();
logger.log(Level.INFO, "Keyword Indexing Completed: " + indexStats); logger.log(Level.INFO, "Keyword Indexing Completed: " + indexStats);
services.postMessage(IngestMessage.createMessage(++messageID, MessageType.INFO, this, NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.kwIdxResultsLbl"), indexStats)); services.postMessage(IngestMessage.createMessage(++messageID, MessageType.INFO, this,
NbBundle.getMessage(this.getClass(),
"KeywordSearchIngestModule.postIndexSummary.kwIdxResultsLbl"),
indexStats));
if (error_index > 0) { if (error_index > 0) {
MessageNotifyUtil.Notify.error(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.kwIdxErrsTitle"), MessageNotifyUtil.Notify.error(NbBundle.getMessage(this.getClass(),
NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.kwIdxErrMsgFiles", error_index)); "KeywordSearchIngestModule.postIndexSummary.kwIdxErrsTitle"),
} NbBundle.getMessage(this.getClass(),
else if (error_io + error_text > 0) { "KeywordSearchIngestModule.postIndexSummary.kwIdxErrMsgFiles",
MessageNotifyUtil.Notify.warn(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.kwIdxWarnMsgTitle"), error_index));
NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.postIndexSummary.idxErrReadFilesMsg")); } else if (error_io + error_text > 0) {
MessageNotifyUtil.Notify.warn(NbBundle.getMessage(this.getClass(),
"KeywordSearchIngestModule.postIndexSummary.kwIdxWarnMsgTitle"),
NbBundle.getMessage(this.getClass(),
"KeywordSearchIngestModule.postIndexSummary.idxErrReadFilesMsg"));
} }
} }
@ -737,12 +765,16 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
ingestStatus.put(aFile.getId(), IngestStatus.STRINGS_INGESTED); ingestStatus.put(aFile.getId(), IngestStatus.STRINGS_INGESTED);
return true; return true;
} else { } else {
logger.log(Level.WARNING, "Failed to extract strings and ingest, file '" + aFile.getName() + "' (id: " + aFile.getId() + ")."); logger.log(Level.WARNING,
"Failed to extract strings and ingest, file '" + aFile.getName() + "' (id: " + aFile
.getId() + ").");
ingestStatus.put(aFile.getId(), IngestStatus.SKIPPED_ERROR_TEXTEXTRACT); ingestStatus.put(aFile.getId(), IngestStatus.SKIPPED_ERROR_TEXTEXTRACT);
return false; return false;
} }
} catch (IngesterException ex) { } catch (IngesterException ex) {
logger.log(Level.WARNING, "Failed to extract strings and ingest, file '" + aFile.getName() + "' (id: " + aFile.getId() + ").", ex); logger.log(Level.WARNING,
"Failed to extract strings and ingest, file '" + aFile.getName() + "' (id: " + aFile.getId()
+ ").", ex);
ingestStatus.put(aFile.getId(), IngestStatus.SKIPPED_ERROR_INDEXING); ingestStatus.put(aFile.getId(), IngestStatus.SKIPPED_ERROR_INDEXING);
return false; return false;
} }
@ -780,7 +812,8 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
TskData.TSK_DB_FILES_TYPE_ENUM aType = aFile.getType(); TskData.TSK_DB_FILES_TYPE_ENUM aType = aFile.getType();
// unallocated and unused blocks can only have strings extracted from them. // unallocated and unused blocks can only have strings extracted from them.
if ((aType.equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS) || aType.equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNUSED_BLOCKS))) { if ((aType.equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS) || aType
.equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNUSED_BLOCKS))) {
extractStringsAndIndex(aFile); extractStringsAndIndex(aFile);
} }
@ -790,8 +823,7 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
try { try {
ingester.ingest(aFile, false); //meta-data only ingester.ingest(aFile, false); //meta-data only
ingestStatus.put(aFile.getId(), IngestStatus.METADATA_INGESTED); ingestStatus.put(aFile.getId(), IngestStatus.METADATA_INGESTED);
} } catch (IngesterException ex) {
catch (IngesterException ex) {
ingestStatus.put(aFile.getId(), IngestStatus.SKIPPED_ERROR_INDEXING); ingestStatus.put(aFile.getId(), IngestStatus.SKIPPED_ERROR_INDEXING);
logger.log(Level.WARNING, "Unable to index meta-data for file: " + aFile.getId(), ex); logger.log(Level.WARNING, "Unable to index meta-data for file: " + aFile.getId(), ex);
} }
@ -804,11 +836,9 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
try { try {
is = new ReadContentInputStream(aFile); is = new ReadContentInputStream(aFile);
detectedFormat = tikaFormatDetector.detect(is, aFile.getName()); detectedFormat = tikaFormatDetector.detect(is, aFile.getName());
} } catch (Exception e) {
catch (Exception e) {
logger.log(Level.WARNING, "Could not detect format using tika for file: " + aFile, e); logger.log(Level.WARNING, "Could not detect format using tika for file: " + aFile, e);
} } finally {
finally {
if (is != null) { if (is != null) {
try { try {
is.close(); is.close();
@ -829,8 +859,7 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
try { try {
ingester.ingest(aFile, false); //meta-data only ingester.ingest(aFile, false); //meta-data only
ingestStatus.put(aFile.getId(), IngestStatus.METADATA_INGESTED); ingestStatus.put(aFile.getId(), IngestStatus.METADATA_INGESTED);
} } catch (IngesterException ex) {
catch (IngesterException ex) {
ingestStatus.put(aFile.getId(), IngestStatus.SKIPPED_ERROR_INDEXING); ingestStatus.put(aFile.getId(), IngestStatus.SKIPPED_ERROR_INDEXING);
logger.log(Level.WARNING, "Unable to index meta-data for file: " + aFile.getId(), ex); logger.log(Level.WARNING, "Unable to index meta-data for file: " + aFile.getId(), ex);
} }
@ -843,7 +872,9 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
try { try {
//logger.log(Level.INFO, "indexing: " + aFile.getName()); //logger.log(Level.INFO, "indexing: " + aFile.getName());
if (!extractTextAndIndex(aFile, detectedFormat)) { if (!extractTextAndIndex(aFile, detectedFormat)) {
logger.log(Level.WARNING, "Failed to extract text and ingest, file '" + aFile.getName() + "' (id: " + aFile.getId() + ")."); logger.log(Level.WARNING,
"Failed to extract text and ingest, file '" + aFile.getName() + "' (id: " + aFile
.getId() + ").");
ingestStatus.put(aFile.getId(), IngestStatus.SKIPPED_ERROR_TEXTEXTRACT); ingestStatus.put(aFile.getId(), IngestStatus.SKIPPED_ERROR_TEXTEXTRACT);
} else { } else {
ingestStatus.put(aFile.getId(), IngestStatus.TEXT_INGESTED); ingestStatus.put(aFile.getId(), IngestStatus.TEXT_INGESTED);
@ -906,15 +937,21 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
logger.log(Level.INFO, "Pending start of new searcher"); logger.log(Level.INFO, "Pending start of new searcher");
} }
final String displayName = NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.doInBackGround.displayName") + final String displayName =
(finalRun ? (" - "+ NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.doInBackGround.finalizeMsg")) : ""); NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.doInBackGround.displayName") +
(finalRun ? (" - " + NbBundle.getMessage(this.getClass(),
"KeywordSearchIngestModule.doInBackGround.finalizeMsg"))
: "");
progressGroup = AggregateProgressFactory.createSystemHandle(displayName + (" (" + progressGroup = AggregateProgressFactory.createSystemHandle(displayName + (" (" +
NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.doInBackGround.pendingMsg") +")"), null, new Cancellable() { NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.doInBackGround.pendingMsg") + ")"),
null, new Cancellable() {
@Override @Override
public boolean cancel() { public boolean cancel() {
logger.log(Level.INFO, "Cancelling the searcher by user."); logger.log(Level.INFO, "Cancelling the searcher by user.");
if (progressGroup != null) { if (progressGroup != null) {
progressGroup.setDisplayName(displayName + " ("+ NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.doInBackGround.cancelMsg") +"...)"); progressGroup.setDisplayName(displayName + " (" + NbBundle
.getMessage(this.getClass(), "KeywordSearchIngestModule.doInBackGround.cancelMsg")
+ "...)");
} }
return Searcher.this.cancel(true); return Searcher.this.cancel(true);
} }
@ -954,7 +991,8 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
for (Keyword keywordQuery : keywords) { for (Keyword keywordQuery : keywords) {
if (this.isCancelled()) { if (this.isCancelled()) {
logger.log(Level.INFO, "Cancel detected, bailing before new keyword processed: " + keywordQuery.getQuery()); logger.log(Level.INFO,
"Cancel detected, bailing before new keyword processed: " + keywordQuery.getQuery());
return null; return null;
} }
@ -974,15 +1012,15 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
boolean isRegex = !keywordQuery.isLiteral(); boolean isRegex = !keywordQuery.isLiteral();
if (isRegex) { if (isRegex) {
del = new TermComponentQuery(keywordQuery); del = new TermComponentQuery(keywordQuery);
} } else {
else {
del = new LuceneQuery(keywordQuery); del = new LuceneQuery(keywordQuery);
del.escape(); del.escape();
} }
//limit search to currently ingested data sources //limit search to currently ingested data sources
//set up a filter with 1 or more image ids OR'ed //set up a filter with 1 or more image ids OR'ed
final KeywordQueryFilter dataSourceFilter = new KeywordQueryFilter(KeywordQueryFilter.FilterType.DATA_SOURCE, curDataSourceIds); final KeywordQueryFilter dataSourceFilter = new KeywordQueryFilter(
KeywordQueryFilter.FilterType.DATA_SOURCE, curDataSourceIds);
del.addFilter(dataSourceFilter); del.addFilter(dataSourceFilter);
Map<String, List<ContentHit>> queryResult = null; Map<String, List<ContentHit>> queryResult = null;
@ -996,7 +1034,8 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
//likely case has closed and threads are being interrupted //likely case has closed and threads are being interrupted
return null; return null;
} catch (CancellationException e) { } catch (CancellationException e) {
logger.log(Level.INFO, "Cancel detected, bailing during keyword query: " + keywordQuery.getQuery()); logger.log(Level.INFO,
"Cancel detected, bailing during keyword query: " + keywordQuery.getQuery());
return null; return null;
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.WARNING, "Error performing query: " + keywordQuery.getQuery(), e); logger.log(Level.WARNING, "Error performing query: " + keywordQuery.getQuery(), e);
@ -1029,7 +1068,8 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
for (final Keyword hitTerm : newResults.keySet()) { for (final Keyword hitTerm : newResults.keySet()) {
//checking for cancellation between results //checking for cancellation between results
if (this.isCancelled()) { if (this.isCancelled()) {
logger.log(Level.INFO, "Cancel detected, bailing before new hit processed for query: " + keywordQuery.getQuery()); logger.log(Level.INFO, "Cancel detected, bailing before new hit processed for query: "
+ keywordQuery.getQuery());
return null; return null;
} }
@ -1042,7 +1082,8 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
//subProgresses[keywordsSearched].progress(unitProgress); //subProgresses[keywordsSearched].progress(unitProgress);
// this returns the unique files in the set with the first chunk that has a hit // this returns the unique files in the set with the first chunk that has a hit
Map<AbstractFile, Integer> contentHitsFlattened = ContentHit.flattenResults(newResults.get(hitTerm)); Map<AbstractFile, Integer> contentHitsFlattened = ContentHit
.flattenResults(newResults.get(hitTerm));
for (final AbstractFile hitFile : contentHitsFlattened.keySet()) { for (final AbstractFile hitFile : contentHitsFlattened.keySet()) {
// get the snippet for the first hit in the file // get the snippet for the first hit in the file
@ -1050,7 +1091,8 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
final String snippetQuery = KeywordSearchUtil.escapeLuceneQuery(hitTerm.getQuery()); final String snippetQuery = KeywordSearchUtil.escapeLuceneQuery(hitTerm.getQuery());
int chunkId = contentHitsFlattened.get(hitFile); int chunkId = contentHitsFlattened.get(hitFile);
try { try {
snippet = LuceneQuery.querySnippet(snippetQuery, hitFile.getId(), chunkId, isRegex, true); snippet = LuceneQuery
.querySnippet(snippetQuery, hitFile.getId(), chunkId, isRegex, true);
} catch (NoOpenCoreException e) { } catch (NoOpenCoreException e) {
logger.log(Level.WARNING, "Error querying snippet: " + snippetQuery, e); logger.log(Level.WARNING, "Error querying snippet: " + snippetQuery, e);
//no reason to continue //no reason to continue
@ -1061,9 +1103,12 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
} }
// write the blackboard artifact for this keyword in this file // write the blackboard artifact for this keyword in this file
KeywordWriteResult written = del.writeToBlackBoard(hitTerm.getQuery(), hitFile, snippet, listName); KeywordWriteResult written = del
.writeToBlackBoard(hitTerm.getQuery(), hitFile, snippet, listName);
if (written == null) { if (written == null) {
logger.log(Level.WARNING, "BB artifact for keyword hit not written, file: " + hitFile + ", hit: " + hitTerm.toString()); logger.log(Level.WARNING,
"BB artifact for keyword hit not written, file: " + hitFile + ", hit: "
+ hitTerm.toString());
continue; continue;
} }
@ -1076,13 +1121,16 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
//final int hitFiles = newResults.size(); //final int hitFiles = newResults.size();
if (!keywordQuery.isLiteral()) { if (!keywordQuery.isLiteral()) {
subjectSb.append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.regExpHitLbl")); subjectSb.append(NbBundle.getMessage(this.getClass(),
"KeywordSearchIngestModule.regExpHitLbl"));
} else { } else {
subjectSb.append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.kwHitLbl")); subjectSb.append(NbBundle.getMessage(this.getClass(),
"KeywordSearchIngestModule.kwHitLbl"));
} }
//subjectSb.append("<"); //subjectSb.append("<");
String uniqueKey = null; String uniqueKey = null;
BlackboardAttribute attr = written.getAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD.getTypeID()); BlackboardAttribute attr = written
.getAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD.getTypeID());
if (attr != null) { if (attr != null) {
final String keyword = attr.getValueString(); final String keyword = attr.getValueString();
subjectSb.append(keyword); subjectSb.append(keyword);
@ -1096,41 +1144,52 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
detailsSb.append("<table border='0' cellpadding='4' width='280'>"); detailsSb.append("<table border='0' cellpadding='4' width='280'>");
//hit //hit
detailsSb.append("<tr>"); detailsSb.append("<tr>");
detailsSb.append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.kwHitLThLbl")); detailsSb.append(NbBundle.getMessage(this.getClass(),
detailsSb.append("<td>").append(EscapeUtil.escapeHtml(attr.getValueString())).append("</td>"); "KeywordSearchIngestModule.kwHitLThLbl"));
detailsSb.append("<td>").append(EscapeUtil.escapeHtml(attr.getValueString()))
.append("</td>");
detailsSb.append("</tr>"); detailsSb.append("</tr>");
//preview //preview
attr = written.getAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_PREVIEW.getTypeID()); attr = written.getAttribute(
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_PREVIEW.getTypeID());
if (attr != null) { if (attr != null) {
detailsSb.append("<tr>"); detailsSb.append("<tr>");
detailsSb.append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.previewThLbl")); detailsSb.append(NbBundle.getMessage(this.getClass(),
detailsSb.append("<td>").append(EscapeUtil.escapeHtml(attr.getValueString())).append("</td>"); "KeywordSearchIngestModule.previewThLbl"));
detailsSb.append("<td>").append(EscapeUtil.escapeHtml(attr.getValueString()))
.append("</td>");
detailsSb.append("</tr>"); detailsSb.append("</tr>");
} }
//file //file
detailsSb.append("<tr>"); detailsSb.append("<tr>");
detailsSb.append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.fileThLbl")); detailsSb.append(NbBundle.getMessage(this.getClass(),
detailsSb.append("<td>").append(hitFile.getParentPath()).append(hitFile.getName()).append("</td>"); "KeywordSearchIngestModule.fileThLbl"));
detailsSb.append("<td>").append(hitFile.getParentPath()).append(hitFile.getName())
.append("</td>");
detailsSb.append("</tr>"); detailsSb.append("</tr>");
//list //list
attr = written.getAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID()); attr = written
.getAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID());
detailsSb.append("<tr>"); detailsSb.append("<tr>");
detailsSb.append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.listThLbl")); detailsSb.append(NbBundle.getMessage(this.getClass(),
"KeywordSearchIngestModule.listThLbl"));
detailsSb.append("<td>").append(attr.getValueString()).append("</td>"); detailsSb.append("<td>").append(attr.getValueString()).append("</td>");
detailsSb.append("</tr>"); detailsSb.append("</tr>");
//regex //regex
if (!keywordQuery.isLiteral()) { if (!keywordQuery.isLiteral()) {
attr = written.getAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_REGEXP.getTypeID()); attr = written.getAttribute(
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_REGEXP.getTypeID());
if (attr != null) { if (attr != null) {
detailsSb.append("<tr>"); detailsSb.append("<tr>");
detailsSb.append(NbBundle.getMessage(this.getClass(), "KeywordSearchIngestModule.regExThLbl")); detailsSb.append(NbBundle.getMessage(this.getClass(),
"KeywordSearchIngestModule.regExThLbl"));
detailsSb.append("<td>").append(attr.getValueString()).append("</td>"); detailsSb.append("<td>").append(attr.getValueString()).append("</td>");
detailsSb.append("</tr>"); detailsSb.append("</tr>");
@ -1138,7 +1197,11 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
} }
detailsSb.append("</table>"); detailsSb.append("</table>");
services.postMessage(IngestMessage.createDataMessage(++messageID, instance, subjectSb.toString(), detailsSb.toString(), uniqueKey, written.getArtifact())); services.postMessage(IngestMessage.createDataMessage(++messageID, instance,
subjectSb.toString(),
detailsSb.toString(),
uniqueKey,
written.getArtifact()));
} }
} //for each file hit } //for each file hit
@ -1148,7 +1211,8 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
//update artifact browser //update artifact browser
if (!newArtifacts.isEmpty()) { if (!newArtifacts.isEmpty()) {
services.fireModuleDataEvent(new ModuleDataEvent(MODULE_NAME, ARTIFACT_TYPE.TSK_KEYWORD_HIT, newArtifacts)); services.fireModuleDataEvent(
new ModuleDataEvent(MODULE_NAME, ARTIFACT_TYPE.TSK_KEYWORD_HIT, newArtifacts));
} }
} //if has results } //if has results
@ -1198,6 +1262,7 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
//perform all essential cleanup that needs to be done right AFTER doInBackground() returns //perform all essential cleanup that needs to be done right AFTER doInBackground() returns
//without relying on done() method that is not guaranteed to run after background thread completes //without relying on done() method that is not guaranteed to run after background thread completes
//NEED to call this method always right before doInBackground() returns //NEED to call this method always right before doInBackground() returns
/** /**
* Performs the cleanup that needs to be done right AFTER * Performs the cleanup that needs to be done right AFTER
* doInBackground() returns without relying on done() method that is not * doInBackground() returns without relying on done() method that is not
@ -1235,7 +1300,8 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
//calculate new results but substracting results already obtained in this ingest //calculate new results but substracting results already obtained in this ingest
//update currentResults map with the new results //update currentResults map with the new results
private Map<Keyword, List<ContentHit>> filterResults(Map<String, List<ContentHit>> queryResult, boolean isRegex) { private Map<Keyword, List<ContentHit>> filterResults(Map<String, List<ContentHit>> queryResult,
boolean isRegex) {
Map<Keyword, List<ContentHit>> newResults = new HashMap<Keyword, List<ContentHit>>(); Map<Keyword, List<ContentHit>> newResults = new HashMap<Keyword, List<ContentHit>>();
for (String termResult : queryResult.keySet()) { for (String termResult : queryResult.keySet()) {

View File

@ -23,10 +23,13 @@ package org.sleuthkit.autopsy.keywordsearch;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.swing.JTable; import javax.swing.JTable;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import javax.swing.ListSelectionModel; import javax.swing.ListSelectionModel;
import javax.swing.table.AbstractTableModel; import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumn; import javax.swing.table.TableColumn;
import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT; import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT;
/** /**
@ -39,7 +42,9 @@ public class KeywordSearchIngestSimplePanel extends javax.swing.JPanel {
private KeywordTableModel tableModel; private KeywordTableModel tableModel;
private List<KeywordSearchListsAbstract.KeywordSearchList> lists; private List<KeywordSearchListsAbstract.KeywordSearchList> lists;
/** Creates new form KeywordSearchIngestSimplePanel */ /**
* Creates new form KeywordSearchIngestSimplePanel
*/
public KeywordSearchIngestSimplePanel() { public KeywordSearchIngestSimplePanel() {
tableModel = new KeywordTableModel(); tableModel = new KeywordTableModel();
lists = new ArrayList<KeywordSearchListsAbstract.KeywordSearchList>(); lists = new ArrayList<KeywordSearchListsAbstract.KeywordSearchList>();
@ -82,7 +87,8 @@ public class KeywordSearchIngestSimplePanel extends javax.swing.JPanel {
KeywordSearchListsXML.getCurrent().save(); KeywordSearchListsXML.getCurrent().save();
} }
/** This method is called from within the constructor to /**
* This method is called from within the constructor to
* initialize the form. * initialize the form.
* WARNING: Do NOT modify this code. The content of this method is * WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor. * always regenerated by the Form Editor.
@ -117,17 +123,24 @@ public class KeywordSearchIngestSimplePanel extends javax.swing.JPanel {
listsTable.setShowVerticalLines(false); listsTable.setShowVerticalLines(false);
listsScrollPane.setViewportView(listsTable); listsScrollPane.setViewportView(listsTable);
titleLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchIngestSimplePanel.class, "KeywordSearchIngestSimplePanel.titleLabel.text")); // NOI18N titleLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchIngestSimplePanel.class,
"KeywordSearchIngestSimplePanel.titleLabel.text")); // NOI18N
languagesLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchIngestSimplePanel.class, "KeywordSearchIngestSimplePanel.languagesLabel.text")); // NOI18N languagesLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchIngestSimplePanel.class,
languagesLabel.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchIngestSimplePanel.class, "KeywordSearchIngestSimplePanel.languagesLabel.toolTipText")); // NOI18N "KeywordSearchIngestSimplePanel.languagesLabel.text")); // NOI18N
languagesLabel.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchIngestSimplePanel.class,
"KeywordSearchIngestSimplePanel.languagesLabel.toolTipText")); // NOI18N
languagesValLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchIngestSimplePanel.class, "KeywordSearchIngestSimplePanel.languagesValLabel.text")); // NOI18N languagesValLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchIngestSimplePanel.class,
languagesValLabel.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchIngestSimplePanel.class, "KeywordSearchIngestSimplePanel.languagesValLabel.toolTipText")); // NOI18N "KeywordSearchIngestSimplePanel.languagesValLabel.text")); // NOI18N
languagesValLabel.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchIngestSimplePanel.class,
"KeywordSearchIngestSimplePanel.languagesValLabel.toolTipText")); // NOI18N
encodingsLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchIngestSimplePanel.class, "KeywordSearchIngestSimplePanel.encodingsLabel.text")); // NOI18N encodingsLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchIngestSimplePanel.class,
"KeywordSearchIngestSimplePanel.encodingsLabel.text")); // NOI18N
keywordSearchEncodings.setText(org.openide.util.NbBundle.getMessage(KeywordSearchIngestSimplePanel.class, "KeywordSearchIngestSimplePanel.keywordSearchEncodings.text")); // NOI18N keywordSearchEncodings.setText(org.openide.util.NbBundle.getMessage(KeywordSearchIngestSimplePanel.class,
"KeywordSearchIngestSimplePanel.keywordSearchEncodings.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout); this.setLayout(layout);
@ -200,8 +213,10 @@ public class KeywordSearchIngestSimplePanel extends javax.swing.JPanel {
} }
private void reloadEncodings() { private void reloadEncodings() {
String utf8 = KeywordSearchSettings.getStringExtractOption(AbstractFileExtract.ExtractOptions.EXTRACT_UTF8.toString()); String utf8 = KeywordSearchSettings
String utf16 = KeywordSearchSettings.getStringExtractOption(AbstractFileExtract.ExtractOptions.EXTRACT_UTF16.toString()); .getStringExtractOption(AbstractFileExtract.ExtractOptions.EXTRACT_UTF8.toString());
String utf16 = KeywordSearchSettings
.getStringExtractOption(AbstractFileExtract.ExtractOptions.EXTRACT_UTF16.toString());
ArrayList<String> encodingsList = new ArrayList<String>(); ArrayList<String> encodingsList = new ArrayList<String>();
if (utf8 == null || Boolean.parseBoolean(utf8)) { if (utf8 == null || Boolean.parseBoolean(utf8)) {
encodingsList.add("UTF8"); encodingsList.add("UTF8");

View File

@ -26,6 +26,7 @@ import java.util.Date;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.BlackboardAttribute;
@ -59,7 +60,9 @@ public abstract class KeywordSearchListsAbstract {
public enum ListsEvt { public enum ListsEvt {
LIST_ADDED, LIST_DELETED, LIST_UPDATED LIST_ADDED, LIST_DELETED, LIST_UPDATED
}; }
;
/** /**
* get instance for managing the current keyword list of the application * get instance for managing the current keyword list of the application
@ -82,18 +85,24 @@ public abstract class KeywordSearchListsAbstract {
} }
//phone number //phone number
List<Keyword> phones = new ArrayList<Keyword>(); List<Keyword> phones = new ArrayList<Keyword>();
phones.add(new Keyword("[(]{0,1}\\d\\d\\d[)]{0,1}[\\.-]\\d\\d\\d[\\.-]\\d\\d\\d\\d", false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER)); phones.add(new Keyword("[(]{0,1}\\d\\d\\d[)]{0,1}[\\.-]\\d\\d\\d[\\.-]\\d\\d\\d\\d", false,
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER));
//phones.add(new Keyword("\\d{8,10}", false)); //phones.add(new Keyword("\\d{8,10}", false));
//IP address //IP address
List<Keyword> ips = new ArrayList<Keyword>(); List<Keyword> ips = new ArrayList<Keyword>();
ips.add(new Keyword("(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])", false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_IP_ADDRESS)); ips.add(new Keyword(
"(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])",
false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_IP_ADDRESS));
//email //email
List<Keyword> emails = new ArrayList<Keyword>(); List<Keyword> emails = new ArrayList<Keyword>();
emails.add(new Keyword("[A-Z0-9._%-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}", false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL)); emails.add(new Keyword("[A-Z0-9._%-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}", false,
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL));
//URL //URL
List<Keyword> urls = new ArrayList<Keyword>(); List<Keyword> urls = new ArrayList<Keyword>();
//urls.add(new Keyword("http://|https://|^www\\.", false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL)); //urls.add(new Keyword("http://|https://|^www\\.", false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL));
urls.add(new Keyword("((((ht|f)tp(s?))\\://)|www\\.)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,5})(\\:[0-9]+)*(/($|[a-zA-Z0-9\\.\\,\\;\\?\\'\\\\+&amp;%\\$#\\=~_\\-]+))*", false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL)); urls.add(new Keyword(
"((((ht|f)tp(s?))\\://)|www\\.)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,5})(\\:[0-9]+)*(/($|[a-zA-Z0-9\\.\\,\\;\\?\\'\\\\+&amp;%\\$#\\=~_\\-]+))*",
false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL));
//urls.add(new Keyword("ssh://", false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL)); //urls.add(new Keyword("ssh://", false, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL));
@ -300,7 +309,8 @@ public abstract class KeywordSearchListsAbstract {
// } // }
changeSupport.firePropertyChange(ListsEvt.LIST_ADDED.toString(), null, name); changeSupport.firePropertyChange(ListsEvt.LIST_ADDED.toString(), null, name);
} else { } else {
theLists.put(name, new KeywordSearchList(name, curList.getDateCreated(), now, useForIngest, ingestMessages, newList, locked)); theLists.put(name, new KeywordSearchList(name, curList.getDateCreated(), now, useForIngest, ingestMessages,
newList, locked));
// if (!locked) { // if (!locked) {
// save(); // save();
// } // }
@ -323,7 +333,8 @@ public abstract class KeywordSearchListsAbstract {
} }
boolean addList(KeywordSearchList list) { boolean addList(KeywordSearchList list) {
return addList(list.getName(), list.getKeywords(), list.getUseForIngest(), list.getIngestMessages(), list.isLocked()); return addList(list.getName(), list.getKeywords(), list.getUseForIngest(), list.getIngestMessages(),
list.isLocked());
} }
/** /**
@ -415,6 +426,7 @@ public abstract class KeywordSearchListsAbstract {
/** /**
* writes out current list replacing the last lists file * writes out current list replacing the last lists file
*
* @param isExport true is this save operation is an export and not a 'Save * @param isExport true is this save operation is an export and not a 'Save
* As' * As'
*/ */
@ -430,10 +442,10 @@ public abstract class KeywordSearchListsAbstract {
return f.exists() && f.canRead() && f.canWrite(); return f.exists() && f.canRead() && f.canWrite();
} }
public void setUseForIngest(String key, boolean flag) public void setUseForIngest(String key, boolean flag) {
{
theLists.get(key).setUseForIngest(flag); theLists.get(key).setUseForIngest(flag);
} }
/** /**
* a representation of a single keyword list created or loaded * a representation of a single keyword list created or loaded
*/ */
@ -447,7 +459,8 @@ public abstract class KeywordSearchListsAbstract {
private List<Keyword> keywords; private List<Keyword> keywords;
private Boolean locked; private Boolean locked;
KeywordSearchList(String name, Date created, Date modified, Boolean useForIngest, Boolean ingestMessages, List<Keyword> keywords, boolean locked) { KeywordSearchList(String name, Date created, Date modified, Boolean useForIngest, Boolean ingestMessages,
List<Keyword> keywords, boolean locked) {
this.name = name; this.name = name;
this.created = created; this.created = created;
this.modified = modified; this.modified = modified;
@ -457,7 +470,8 @@ public abstract class KeywordSearchListsAbstract {
this.locked = locked; this.locked = locked;
} }
KeywordSearchList(String name, Date created, Date modified, Boolean useForIngest, Boolean ingestMessages, List<Keyword> keywords) { KeywordSearchList(String name, Date created, Date modified, Boolean useForIngest, Boolean ingestMessages,
List<Keyword> keywords) {
this(name, created, modified, useForIngest, ingestMessages, keywords, false); this(name, created, modified, useForIngest, ingestMessages, keywords, false);
} }

View File

@ -32,12 +32,11 @@ import java.util.logging.Level;
* @author dfickling * @author dfickling
* KeywordSearchListsEncase adds support for Encase tab-delimited * KeywordSearchListsEncase adds support for Encase tab-delimited
* keyword list exports to Autopsy. * keyword list exports to Autopsy.
* * <p/>
* load() does the I/O operation, converting lines from the text file to * load() does the I/O operation, converting lines from the text file to
* an unsorted list of EncaseFileEntrys * an unsorted list of EncaseFileEntrys
* The next step is to recreate the original folder hierarchy, * The next step is to recreate the original folder hierarchy,
* and finally the EncaseFileEntries are converted to KeywordSearchLists * and finally the EncaseFileEntries are converted to KeywordSearchLists
*
*/ */
class KeywordSearchListsEncase extends KeywordSearchListsAbstract { class KeywordSearchListsEncase extends KeywordSearchListsAbstract {
@ -51,6 +50,7 @@ class KeywordSearchListsEncase extends KeywordSearchListsAbstract{
/** /**
* Follow the EncaseFileEntry hierarchy starting with given entry * Follow the EncaseFileEntry hierarchy starting with given entry
* Create list for each Folder entry, add keyword for each Expression * Create list for each Folder entry, add keyword for each Expression
*
* @param entry * @param entry
* @param parentPath * @param parentPath
*/ */
@ -126,7 +126,8 @@ class KeywordSearchListsEncase extends KeywordSearchListsAbstract{
@Override @Override
public boolean load() { public boolean load() {
try { try {
BufferedReader readBuffer = new BufferedReader(new InputStreamReader(new FileInputStream(filePath), "utf-16")); BufferedReader readBuffer = new BufferedReader(
new InputStreamReader(new FileInputStream(filePath), "utf-16"));
String structLine; String structLine;
String metaLine; String metaLine;
entriesUnsorted = new ArrayList<EncaseFileEntry>(); entriesUnsorted = new ArrayList<EncaseFileEntry>();
@ -149,7 +150,8 @@ class KeywordSearchListsEncase extends KeywordSearchListsAbstract{
flags.add(EncaseFlag.getFlag(i)); flags.add(EncaseFlag.getFlag(i));
} }
} }
entriesUnsorted.add(new EncaseFileEntry(name, value, Integer.parseInt(childCount), false, null, type, flags)); entriesUnsorted
.add(new EncaseFileEntry(name, value, Integer.parseInt(childCount), false, null, type, flags));
} }
this.rootEntry = entriesUnsorted.remove(0); this.rootEntry = entriesUnsorted.remove(0);
doCreateEntryStructure(this.rootEntry); doCreateEntryStructure(this.rootEntry);
@ -204,7 +206,9 @@ class KeywordSearchListsEncase extends KeywordSearchListsAbstract{
EncaseMetaType type; EncaseMetaType type;
boolean hasParent; boolean hasParent;
ArrayList<EncaseFlag> flags; ArrayList<EncaseFlag> flags;
EncaseFileEntry(String name, String value, int childCount, boolean hasParent, EncaseFileEntry parent, EncaseMetaType type, ArrayList<EncaseFlag> flags) {
EncaseFileEntry(String name, String value, int childCount, boolean hasParent, EncaseFileEntry parent,
EncaseMetaType type, ArrayList<EncaseFlag> flags) {
this.name = name; this.name = name;
this.value = value; this.value = value;
this.childCount = childCount; this.childCount = childCount;
@ -214,9 +218,11 @@ class KeywordSearchListsEncase extends KeywordSearchListsAbstract{
this.type = type; this.type = type;
this.flags = flags; this.flags = flags;
} }
boolean isFull() { boolean isFull() {
return children.size() == childCount; return children.size() == childCount;
} }
void addChild(EncaseFileEntry child) { void addChild(EncaseFileEntry child) {
children.add(child); children.add(child);
} }

View File

@ -31,11 +31,13 @@ import java.util.List;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import javax.swing.JFileChooser; import javax.swing.JFileChooser;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.table.AbstractTableModel; import javax.swing.table.AbstractTableModel;
import org.sleuthkit.autopsy.corecomponents.OptionsPanel; import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
/** /**
@ -46,7 +48,9 @@ class KeywordSearchListsManagementPanel extends javax.swing.JPanel implements Op
private Logger logger = Logger.getLogger(KeywordSearchListsManagementPanel.class.getName()); private Logger logger = Logger.getLogger(KeywordSearchListsManagementPanel.class.getName());
private KeywordListTableModel tableModel; private KeywordListTableModel tableModel;
/** Creates new form KeywordSearchListImportExportForm */ /**
* Creates new form KeywordSearchListImportExportForm
*/
KeywordSearchListsManagementPanel() { KeywordSearchListsManagementPanel() {
tableModel = new KeywordListTableModel(); tableModel = new KeywordListTableModel();
initComponents(); initComponents();
@ -92,7 +96,8 @@ class KeywordSearchListsManagementPanel extends javax.swing.JPanel implements Op
} }
/** This method is called from within the constructor to /**
* This method is called from within the constructor to
* initialize the form. * initialize the form.
* WARNING: Do NOT modify this code. The content of this method is * WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor. * always regenerated by the Form Editor.
@ -123,23 +128,28 @@ class KeywordSearchListsManagementPanel extends javax.swing.JPanel implements Op
}); });
jScrollPane1.setViewportView(listsTable); jScrollPane1.setViewportView(listsTable);
newListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/new16.png"))); // NOI18N newListButton.setIcon(new javax.swing.ImageIcon(
newListButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsManagementPanel.class, "KeywordSearchListsManagementPanel.newListButton.text")); // NOI18N getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/new16.png"))); // NOI18N
newListButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsManagementPanel.class,
"KeywordSearchListsManagementPanel.newListButton.text")); // NOI18N
newListButton.addActionListener(new java.awt.event.ActionListener() { newListButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
newListButtonActionPerformed(evt); newListButtonActionPerformed(evt);
} }
}); });
importButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/import16.png"))); // NOI18N importButton.setIcon(new javax.swing.ImageIcon(
importButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsManagementPanel.class, "KeywordSearchListsManagementPanel.importButton.text")); // NOI18N getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/import16.png"))); // NOI18N
importButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsManagementPanel.class,
"KeywordSearchListsManagementPanel.importButton.text")); // NOI18N
importButton.addActionListener(new java.awt.event.ActionListener() { importButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
importButtonActionPerformed(evt); importButtonActionPerformed(evt);
} }
}); });
keywordListsLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsManagementPanel.class, "KeywordSearchListsManagementPanel.keywordListsLabel.text")); // NOI18N keywordListsLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsManagementPanel.class,
"KeywordSearchListsManagementPanel.keywordListsLabel.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout); this.setLayout(layout);
@ -148,14 +158,28 @@ class KeywordSearchListsManagementPanel extends javax.swing.JPanel implements Op
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jScrollPane1,
javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(keywordListsLabel) .addComponent(keywordListsLabel)
.addGroup(layout.createSequentialGroup() .addGroup(
.addComponent(newListButton, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE) layout.createSequentialGroup()
.addComponent(
newListButton,
javax.swing.GroupLayout.PREFERRED_SIZE,
114,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18) .addGap(18, 18, 18)
.addComponent(importButton, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))) .addComponent(
importButton,
javax.swing.GroupLayout.PREFERRED_SIZE,
126,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 4, Short.MAX_VALUE))) .addGap(0, 4, Short.MAX_VALUE)))
.addContainerGap()) .addContainerGap())
); );
@ -164,35 +188,50 @@ class KeywordSearchListsManagementPanel extends javax.swing.JPanel implements Op
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addComponent(keywordListsLabel) .addComponent(keywordListsLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 414, Short.MAX_VALUE) javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jScrollPane1,
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) javax.swing.GroupLayout.DEFAULT_SIZE,
.addComponent(newListButton) 414, Short.MAX_VALUE)
.addComponent(importButton)) .addPreferredGap(
javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(
newListButton)
.addComponent(
importButton))
.addContainerGap()) .addContainerGap())
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
private void newListButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newListButtonActionPerformed private void newListButtonActionPerformed(
java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newListButtonActionPerformed
KeywordSearchListsXML writer = KeywordSearchListsXML.getCurrent(); KeywordSearchListsXML writer = KeywordSearchListsXML.getCurrent();
String listName = (String) JOptionPane.showInputDialog(null, NbBundle.getMessage(this.getClass(), "KeywordSearch.newKwListTitle"), String listName = (String) JOptionPane
NbBundle.getMessage(this.getClass(), "KeywordSearch.newKeywordListMsg"), JOptionPane.PLAIN_MESSAGE, null, null, ""); .showInputDialog(null, NbBundle.getMessage(this.getClass(), "KeywordSearch.newKwListTitle"),
NbBundle.getMessage(this.getClass(), "KeywordSearch.newKeywordListMsg"),
JOptionPane.PLAIN_MESSAGE, null, null, "");
if (listName == null || listName.trim().equals("")) { if (listName == null || listName.trim().equals("")) {
return; return;
} }
boolean shouldAdd = false; boolean shouldAdd = false;
if (writer.listExists(listName)) { if (writer.listExists(listName)) {
if (writer.getList(listName).isLocked()) { if (writer.getList(listName).isLocked()) {
boolean replace = KeywordSearchUtil.displayConfirmDialog(NbBundle.getMessage(this.getClass(), "KeywordSearch.newKeywordListMsg"), boolean replace = KeywordSearchUtil
NbBundle.getMessage(this.getClass(), "KeywordSearch.keywordListAlreadyExistMsg", listName), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN); .displayConfirmDialog(NbBundle.getMessage(this.getClass(), "KeywordSearch.newKeywordListMsg"),
NbBundle.getMessage(this.getClass(),
"KeywordSearch.keywordListAlreadyExistMsg", listName),
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
if (replace) { if (replace) {
shouldAdd = true; shouldAdd = true;
} }
} } else {
else { boolean replace = KeywordSearchUtil
boolean replace = KeywordSearchUtil.displayConfirmDialog(NbBundle.getMessage(this.getClass(), "KeywordSearch.newKwListTitle"), .displayConfirmDialog(NbBundle.getMessage(this.getClass(), "KeywordSearch.newKwListTitle"),
NbBundle.getMessage(this.getClass(), "KeywordSearch.kwListAlreadyExistMsg", listName), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN); NbBundle.getMessage(this.getClass(),
"KeywordSearch.kwListAlreadyExistMsg", listName),
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
if (replace) { if (replace) {
shouldAdd = true; shouldAdd = true;
} }
@ -211,12 +250,14 @@ class KeywordSearchListsManagementPanel extends javax.swing.JPanel implements Op
tableModel.resync(); tableModel.resync();
}//GEN-LAST:event_newListButtonActionPerformed }//GEN-LAST:event_newListButtonActionPerformed
private void importButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importButtonActionPerformed private void importButtonActionPerformed(
java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importButtonActionPerformed
JFileChooser chooser = new JFileChooser(); JFileChooser chooser = new JFileChooser();
final String[] EXTENSION = new String[]{"xml", "txt"}; final String[] EXTENSION = new String[]{"xml", "txt"};
FileNameExtensionFilter filter = new FileNameExtensionFilter( FileNameExtensionFilter filter = new FileNameExtensionFilter(
NbBundle.getMessage(this.getClass(), "KeywordSearchListsManagementPanel.fileExtensionFilterLbl"), EXTENSION); NbBundle.getMessage(this.getClass(), "KeywordSearchListsManagementPanel.fileExtensionFilterLbl"),
EXTENSION);
chooser.setFileFilter(filter); chooser.setFileFilter(filter);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
@ -240,12 +281,15 @@ class KeywordSearchListsManagementPanel extends javax.swing.JPanel implements Op
if (!reader.load()) { if (!reader.load()) {
KeywordSearchUtil.displayDialog( KeywordSearchUtil.displayDialog(
NbBundle.getMessage(this.getClass(), "KeywordSearch.listImportFeatureTitle"), NbBundle.getMessage(this.getClass(), "KeywordSearch.importListFileDialogMsg", fileAbs), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR); NbBundle.getMessage(this.getClass(), "KeywordSearch.listImportFeatureTitle"),
NbBundle.getMessage(this.getClass(), "KeywordSearch.importListFileDialogMsg", fileAbs),
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
return; return;
} }
List<KeywordSearchListsAbstract.KeywordSearchList> toImport = reader.getListsL(); List<KeywordSearchListsAbstract.KeywordSearchList> toImport = reader.getListsL();
List<KeywordSearchListsAbstract.KeywordSearchList> toImportConfirmed = new ArrayList<KeywordSearchListsAbstract.KeywordSearchList>(); List<KeywordSearchListsAbstract.KeywordSearchList> toImportConfirmed
= new ArrayList<KeywordSearchListsAbstract.KeywordSearchList>();
final KeywordSearchListsXML writer = KeywordSearchListsXML.getCurrent(); final KeywordSearchListsXML writer = KeywordSearchListsXML.getCurrent();
@ -256,8 +300,11 @@ class KeywordSearchListsManagementPanel extends javax.swing.JPanel implements Op
NbBundle.getMessage(this.getClass(), "KeywordSearch.noSkipMsg"), NbBundle.getMessage(this.getClass(), "KeywordSearch.noSkipMsg"),
NbBundle.getMessage(this.getClass(), "KeywordSearch.cancelImportMsg")}; NbBundle.getMessage(this.getClass(), "KeywordSearch.cancelImportMsg")};
int choice = JOptionPane.showOptionDialog(this, int choice = JOptionPane.showOptionDialog(this,
NbBundle.getMessage(this.getClass(), "KeywordSearch.overwriteListPrompt", list.getName()), NbBundle.getMessage(this.getClass(),
NbBundle.getMessage(this.getClass(), "KeywordSearch.importOwConflict"), "KeywordSearch.overwriteListPrompt",
list.getName()),
NbBundle.getMessage(this.getClass(),
"KeywordSearch.importOwConflict"),
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE, JOptionPane.QUESTION_MESSAGE,
null, null,
@ -282,7 +329,9 @@ class KeywordSearchListsManagementPanel extends javax.swing.JPanel implements Op
if (!writer.writeLists(toImportConfirmed)) { if (!writer.writeLists(toImportConfirmed)) {
KeywordSearchUtil.displayDialog( KeywordSearchUtil.displayDialog(
NbBundle.getMessage(this.getClass(), "KeywordSearch.listImportFeatureTitle"), NbBundle.getMessage(this.getClass(), "KeywordSearch.kwListFailImportMsg"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO); NbBundle.getMessage(this.getClass(), "KeywordSearch.listImportFeatureTitle"),
NbBundle.getMessage(this.getClass(), "KeywordSearch.kwListFailImportMsg"),
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
} }
} }

View File

@ -163,14 +163,18 @@ class KeywordSearchListsViewerPanel extends AbstractKeywordSearchPerformer {
private void initIngest(boolean running) { private void initIngest(boolean running) {
if (running) { if (running) {
ingestRunning = true; ingestRunning = true;
searchAddButton.setText(NbBundle.getMessage(this.getClass(), "KeywordSearchListsViewerPanel.initIngest.addIngestTitle")); searchAddButton.setText(
searchAddButton.setToolTipText(NbBundle.getMessage(this.getClass(), "KeywordSearchListsViewerPanel.initIngest.addIngestMsg" )); NbBundle.getMessage(this.getClass(), "KeywordSearchListsViewerPanel.initIngest.addIngestTitle"));
searchAddButton.setToolTipText(
NbBundle.getMessage(this.getClass(), "KeywordSearchListsViewerPanel.initIngest.addIngestMsg"));
listsTableModel.resync(); listsTableModel.resync();
} else { } else {
ingestRunning = false; ingestRunning = false;
searchAddButton.setText(NbBundle.getMessage(this.getClass(), "KeywordSearchListsViewerPanel.initIngest.searchIngestTitle")); searchAddButton.setText(
searchAddButton.setToolTipText(NbBundle.getMessage(this.getClass(), "KeywordSearchListsViewerPanel.initIngest.addIdxSearchMsg")); NbBundle.getMessage(this.getClass(), "KeywordSearchListsViewerPanel.initIngest.searchIngestTitle"));
searchAddButton.setToolTipText(
NbBundle.getMessage(this.getClass(), "KeywordSearchListsViewerPanel.initIngest.addIdxSearchMsg"));
listsTableModel.resync(); listsTableModel.resync();
} }
updateIngestIndexLabel(running); updateIngestIndexLabel(running);
@ -178,10 +182,13 @@ class KeywordSearchListsViewerPanel extends AbstractKeywordSearchPerformer {
private void updateIngestIndexLabel(boolean ingestRunning) { private void updateIngestIndexLabel(boolean ingestRunning) {
if (ingestRunning) { if (ingestRunning) {
ingestIndexLabel.setText(NbBundle.getMessage(this.getClass(), "KeywordSearchListsViewerPanel.initIngest.ongoingIngestMsg", filesIndexed)); ingestIndexLabel.setText(
} NbBundle.getMessage(this.getClass(), "KeywordSearchListsViewerPanel.initIngest.ongoingIngestMsg",
else { filesIndexed));
ingestIndexLabel.setText(NbBundle.getMessage(this.getClass(), "KeywordSearchListsViewerPanel.initIngest.fileIndexCtMsg", filesIndexed)); } else {
ingestIndexLabel.setText(
NbBundle.getMessage(this.getClass(), "KeywordSearchListsViewerPanel.initIngest.fileIndexCtMsg",
filesIndexed));
} }
} }
@ -234,18 +241,22 @@ class KeywordSearchListsViewerPanel extends AbstractKeywordSearchPerformer {
jSplitPane1.setRightComponent(rightPane); jSplitPane1.setRightComponent(rightPane);
manageListsButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsViewerPanel.class, "KeywordSearchListsViewerPanel.manageListsButton.text")); // NOI18N manageListsButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsViewerPanel.class,
manageListsButton.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchListsViewerPanel.class, "KeywordSearchListsViewerPanel.manageListsButton.toolTipText")); // NOI18N "KeywordSearchListsViewerPanel.manageListsButton.text")); // NOI18N
manageListsButton.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchListsViewerPanel.class,
"KeywordSearchListsViewerPanel.manageListsButton.toolTipText")); // NOI18N
manageListsButton.addActionListener(new java.awt.event.ActionListener() { manageListsButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
manageListsButtonActionPerformed(evt); manageListsButtonActionPerformed(evt);
} }
}); });
searchAddButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsViewerPanel.class, "KeywordSearchListsViewerPanel.searchAddButton.text")); // NOI18N searchAddButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsViewerPanel.class,
"KeywordSearchListsViewerPanel.searchAddButton.text")); // NOI18N
ingestIndexLabel.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N ingestIndexLabel.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
ingestIndexLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsViewerPanel.class, "KeywordSearchListsViewerPanel.ingestIndexLabel.text")); // NOI18N ingestIndexLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsViewerPanel.class,
"KeywordSearchListsViewerPanel.ingestIndexLabel.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout); this.setLayout(layout);
@ -278,9 +289,11 @@ class KeywordSearchListsViewerPanel extends AbstractKeywordSearchPerformer {
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
private void manageListsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_manageListsButtonActionPerformed private void manageListsButtonActionPerformed(
java.awt.event.ActionEvent evt) {//GEN-FIRST:event_manageListsButtonActionPerformed
SystemAction.get(KeywordSearchConfigurationAction.class).performAction(); SystemAction.get(KeywordSearchConfigurationAction.class).performAction();
}//GEN-LAST:event_manageListsButtonActionPerformed }//GEN-LAST:event_manageListsButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel ingestIndexLabel; private javax.swing.JLabel ingestIndexLabel;
private javax.swing.JSplitPane jSplitPane1; private javax.swing.JSplitPane jSplitPane1;
@ -440,7 +453,8 @@ class KeywordSearchListsViewerPanel extends AbstractKeywordSearchPerformer {
} }
List<KeywordSearchListsAbstract.KeywordSearchList> getSelectedListsL() { List<KeywordSearchListsAbstract.KeywordSearchList> getSelectedListsL() {
List<KeywordSearchListsAbstract.KeywordSearchList> ret = new ArrayList<KeywordSearchListsAbstract.KeywordSearchList>(); List<KeywordSearchListsAbstract.KeywordSearchList> ret
= new ArrayList<KeywordSearchListsAbstract.KeywordSearchList>();
for (String s : getSelectedLists()) { for (String s : getSelectedLists()) {
ret.add(listsHandle.getList(s)); ret.add(listsHandle.getList(s));
} }

View File

@ -28,6 +28,7 @@ import java.util.logging.Level;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.XMLUtil; import org.sleuthkit.autopsy.coreutils.XMLUtil;
import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.BlackboardAttribute;
@ -58,10 +59,10 @@ public class KeywordSearchListsXML extends KeywordSearchListsAbstract{
private DateFormat dateFormatter; private DateFormat dateFormatter;
/** /**
* Constructor to obtain handle on other that the current keyword list * Constructor to obtain handle on other that the current keyword list
* (such as for import or export) * (such as for import or export)
*
* @param xmlFile xmlFile to obtain KeywordSearchListsXML handle on * @param xmlFile xmlFile to obtain KeywordSearchListsXML handle on
*/ */
KeywordSearchListsXML(String xmlFile) { KeywordSearchListsXML(String xmlFile) {
@ -161,15 +162,13 @@ public class KeywordSearchListsXML extends KeywordSearchListsAbstract{
if (listEl.hasAttribute(LIST_USE_FOR_INGEST)) { if (listEl.hasAttribute(LIST_USE_FOR_INGEST)) {
useForIngestBool = Boolean.parseBoolean(listEl.getAttribute(LIST_USE_FOR_INGEST)); useForIngestBool = Boolean.parseBoolean(listEl.getAttribute(LIST_USE_FOR_INGEST));
} } else {
else {
useForIngestBool = true; useForIngestBool = true;
} }
if (listEl.hasAttribute(LIST_INGEST_MSGS)) { if (listEl.hasAttribute(LIST_INGEST_MSGS)) {
ingestMessagesBool = Boolean.parseBoolean(listEl.getAttribute(LIST_INGEST_MSGS)); ingestMessagesBool = Boolean.parseBoolean(listEl.getAttribute(LIST_INGEST_MSGS));
} } else {
else {
ingestMessagesBool = true; ingestMessagesBool = true;
} }
@ -177,7 +176,8 @@ public class KeywordSearchListsXML extends KeywordSearchListsAbstract{
Date modDate = dateFormatter.parse(modified); Date modDate = dateFormatter.parse(modified);
List<Keyword> words = new ArrayList<Keyword>(); List<Keyword> words = new ArrayList<Keyword>();
KeywordSearchList list = new KeywordSearchList(name, createdDate, modDate, useForIngestBool, ingestMessagesBool, words); KeywordSearchList list = new KeywordSearchList(name, createdDate, modDate, useForIngestBool,
ingestMessagesBool, words);
//parse all words //parse all words
NodeList wordsNList = listEl.getElementsByTagName(KEYWORD_EL); NodeList wordsNList = listEl.getElementsByTagName(KEYWORD_EL);
@ -189,7 +189,8 @@ public class KeywordSearchListsXML extends KeywordSearchListsAbstract{
Keyword keyword = new Keyword(wordEl.getTextContent(), isLiteral); Keyword keyword = new Keyword(wordEl.getTextContent(), isLiteral);
String selector = wordEl.getAttribute(KEYWORD_SELECTOR_ATTR); String selector = wordEl.getAttribute(KEYWORD_SELECTOR_ATTR);
if (!selector.equals("")) { if (!selector.equals("")) {
BlackboardAttribute.ATTRIBUTE_TYPE selectorType = BlackboardAttribute.ATTRIBUTE_TYPE.fromLabel(selector); BlackboardAttribute.ATTRIBUTE_TYPE selectorType = BlackboardAttribute.ATTRIBUTE_TYPE
.fromLabel(selector);
keyword.setType(selectorType); keyword.setType(selectorType);
} }
words.add(keyword); words.add(keyword);

View File

@ -7,6 +7,7 @@ package org.sleuthkit.autopsy.keywordsearch;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport; import java.beans.PropertyChangeSupport;
import javax.swing.JComponent; import javax.swing.JComponent;
import org.netbeans.spi.options.OptionsPanelController; import org.netbeans.spi.options.OptionsPanelController;
import org.openide.util.HelpCtx; import org.openide.util.HelpCtx;
import org.openide.util.Lookup; import org.openide.util.Lookup;
@ -17,7 +18,8 @@ iconBase = "org/sleuthkit/autopsy/keywordsearch/options-icon.png",
position = 2, position = 2,
keywords = "#OptionsCategory_Keywords_KeywordSearchOptions", keywords = "#OptionsCategory_Keywords_KeywordSearchOptions",
keywordsCategory = "KeywordSearchOptions") keywordsCategory = "KeywordSearchOptions")
@org.openide.util.NbBundle.Messages({"OptionsCategory_Name_KeywordSearchOptions=Keyword Search", "OptionsCategory_Keywords_KeywordSearchOptions=Keyword Search"}) @org.openide.util.NbBundle.Messages({"OptionsCategory_Name_KeywordSearchOptions=Keyword Search",
"OptionsCategory_Keywords_KeywordSearchOptions=Keyword Search"})
public final class KeywordSearchOptionsPanelController extends OptionsPanelController { public final class KeywordSearchOptionsPanelController extends OptionsPanelController {
private KeywordSearchConfigurationPanel panel; private KeywordSearchConfigurationPanel panel;

View File

@ -34,17 +34,20 @@ import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import javax.swing.JMenuItem; import javax.swing.JMenuItem;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener; import javax.swing.event.PopupMenuListener;
import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.SolrServerException;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
/** /**
* Keyword search toolbar (in upper right, by default) which allows to search for single terms or phrases * Keyword search toolbar (in upper right, by default) which allows to search for single terms or phrases
* * <p/>
* The toolbar uses a different font from the rest of the application, Monospaced 14, * The toolbar uses a different font from the rest of the application, Monospaced 14,
* due to the necessity to find a font that displays both Arabic and Asian fonts at an acceptable size. * due to the necessity to find a font that displays both Arabic and Asian fonts at an acceptable size.
* The default, Tahoma 14, could not perform this task at the desired size, and neither could numerous other fonts. * The default, Tahoma 14, could not perform this task at the desired size, and neither could numerous other fonts.
@ -57,7 +60,9 @@ class KeywordSearchPanel extends AbstractKeywordSearchPerformer {
private boolean entered = false; private boolean entered = false;
private static KeywordSearchPanel instance; private static KeywordSearchPanel instance;
/** Creates new form KeywordSearchPanel */ /**
* Creates new form KeywordSearchPanel
*/
private KeywordSearchPanel() { private KeywordSearchPanel() {
initComponents(); initComponents();
customizeComponents(); customizeComponents();
@ -79,7 +84,6 @@ class KeywordSearchPanel extends AbstractKeywordSearchPerformer {
} }
private void customizeComponents() { private void customizeComponents() {
listener = new KeywordPropertyChangeListener(); listener = new KeywordPropertyChangeListener();
@ -172,7 +176,8 @@ class KeywordSearchPanel extends AbstractKeywordSearchPerformer {
entered = false; entered = false;
} }
/** This method is called from within the constructor to /**
* This method is called from within the constructor to
* initialize the form. * initialize the form.
* WARNING: Do NOT modify this code. The content of this method is * WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor. * always regenerated by the Form Editor.
@ -195,19 +200,24 @@ class KeywordSearchPanel extends AbstractKeywordSearchPerformer {
searchButton = new javax.swing.JLabel(); searchButton = new javax.swing.JLabel();
listsButton = new javax.swing.JButton(); listsButton = new javax.swing.JButton();
regExCheckboxMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "KeywordSearchPanel.regExCheckboxMenuItem.text")); // NOI18N regExCheckboxMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class,
"KeywordSearchPanel.regExCheckboxMenuItem.text")); // NOI18N
settingsMenu.add(regExCheckboxMenuItem); settingsMenu.add(regExCheckboxMenuItem);
cutMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "KeywordSearchPanel.cutMenuItem.text")); // NOI18N cutMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class,
"KeywordSearchPanel.cutMenuItem.text")); // NOI18N
rightClickMenu.add(cutMenuItem); rightClickMenu.add(cutMenuItem);
copyMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "KeywordSearchPanel.copyMenuItem.text")); // NOI18N copyMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class,
"KeywordSearchPanel.copyMenuItem.text")); // NOI18N
rightClickMenu.add(copyMenuItem); rightClickMenu.add(copyMenuItem);
pasteMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "KeywordSearchPanel.pasteMenuItem.text")); // NOI18N pasteMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class,
"KeywordSearchPanel.pasteMenuItem.text")); // NOI18N
rightClickMenu.add(pasteMenuItem); rightClickMenu.add(pasteMenuItem);
selectAllMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "KeywordSearchPanel.selectAllMenuItem.text")); // NOI18N selectAllMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class,
"KeywordSearchPanel.selectAllMenuItem.text")); // NOI18N
rightClickMenu.add(selectAllMenuItem); rightClickMenu.add(selectAllMenuItem);
setOpaque(false); setOpaque(false);
@ -217,7 +227,8 @@ class KeywordSearchPanel extends AbstractKeywordSearchPerformer {
searchBox.setFont(new java.awt.Font("Monospaced", 0, 14)); // NOI18N searchBox.setFont(new java.awt.Font("Monospaced", 0, 14)); // NOI18N
searchBox.setForeground(java.awt.Color.lightGray); searchBox.setForeground(java.awt.Color.lightGray);
searchBox.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "KeywordSearchPanel.searchBox.text")); // NOI18N searchBox.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class,
"KeywordSearchPanel.searchBox.text")); // NOI18N
searchBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 3, 4, 1)); searchBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 3, 4, 1));
searchBox.setEnabled(false); searchBox.setEnabled(false);
searchBox.addActionListener(new java.awt.event.ActionListener() { searchBox.addActionListener(new java.awt.event.ActionListener() {
@ -226,8 +237,10 @@ class KeywordSearchPanel extends AbstractKeywordSearchPerformer {
} }
}); });
settingsLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/dropdown-icon.png"))); // NOI18N settingsLabel.setIcon(new javax.swing.ImageIcon(
settingsLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "KeywordSearchPanel.settingsLabel.text")); // NOI18N getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/dropdown-icon.png"))); // NOI18N
settingsLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class,
"KeywordSearchPanel.settingsLabel.text")); // NOI18N
settingsLabel.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 2, 1, 2)); settingsLabel.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 2, 1, 2));
settingsLabel.setEnabled(false); settingsLabel.setEnabled(false);
settingsLabel.setMaximumSize(new java.awt.Dimension(23, 20)); settingsLabel.setMaximumSize(new java.awt.Dimension(23, 20));
@ -237,16 +250,20 @@ class KeywordSearchPanel extends AbstractKeywordSearchPerformer {
public void mouseEntered(java.awt.event.MouseEvent evt) { public void mouseEntered(java.awt.event.MouseEvent evt) {
settingsLabelMouseEntered(evt); settingsLabelMouseEntered(evt);
} }
public void mouseExited(java.awt.event.MouseEvent evt) { public void mouseExited(java.awt.event.MouseEvent evt) {
settingsLabelMouseExited(evt); settingsLabelMouseExited(evt);
} }
public void mousePressed(java.awt.event.MouseEvent evt) { public void mousePressed(java.awt.event.MouseEvent evt) {
settingsLabelMousePressed(evt); settingsLabelMousePressed(evt);
} }
}); });
searchButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/search-icon.png"))); // NOI18N searchButton.setIcon(new javax.swing.ImageIcon(
searchButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "KeywordSearchPanel.searchButton.text")); // NOI18N getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/search-icon.png"))); // NOI18N
searchButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class,
"KeywordSearchPanel.searchButton.text")); // NOI18N
searchButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 2, 1, 2)); searchButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 2, 1, 2));
searchButton.setEnabled(false); searchButton.setEnabled(false);
searchButton.setMaximumSize(new java.awt.Dimension(23, 20)); searchButton.setMaximumSize(new java.awt.Dimension(23, 20));
@ -276,13 +293,16 @@ class KeywordSearchPanel extends AbstractKeywordSearchPerformer {
.addComponent(searchButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(searchButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
); );
listsButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon.png"))); // NOI18N listsButton.setIcon(new javax.swing.ImageIcon(
getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon.png"))); // NOI18N
listsButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "ListBundleName")); // NOI18N listsButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "ListBundleName")); // NOI18N
listsButton.setBorderPainted(false); listsButton.setBorderPainted(false);
listsButton.setContentAreaFilled(false); listsButton.setContentAreaFilled(false);
listsButton.setEnabled(false); listsButton.setEnabled(false);
listsButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon-rollover.png"))); // NOI18N listsButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource(
listsButton.setRolloverSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon-pressed.png"))); // NOI18N "/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon-rollover.png"))); // NOI18N
listsButton.setRolloverSelectedIcon(new javax.swing.ImageIcon(
getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/watchbutton-icon-pressed.png"))); // NOI18N
listsButton.addMouseListener(new java.awt.event.MouseAdapter() { listsButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) { public void mousePressed(java.awt.event.MouseEvent evt) {
listsButtonMousePressed(evt); listsButtonMousePressed(evt);
@ -300,13 +320,17 @@ class KeywordSearchPanel extends AbstractKeywordSearchPerformer {
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addComponent(listsButton) .addComponent(listsButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18,
.addComponent(searchBoxPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE) Short.MAX_VALUE)
.addComponent(searchBoxPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 244,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap()) .addContainerGap())
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(listsButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(listsButton, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(searchBoxPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE) .addComponent(searchBoxPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE)
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
@ -331,7 +355,8 @@ class KeywordSearchPanel extends AbstractKeywordSearchPerformer {
maybeShowListsPopup(evt); maybeShowListsPopup(evt);
}//GEN-LAST:event_listsButtonMousePressed }//GEN-LAST:event_listsButtonMousePressed
private void listsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_listsButtonActionPerformed private void listsButtonActionPerformed(
java.awt.event.ActionEvent evt) {//GEN-FIRST:event_listsButtonActionPerformed
// TODO add your handling code here: // TODO add your handling code here:
}//GEN-LAST:event_listsButtonActionPerformed }//GEN-LAST:event_listsButtonActionPerformed
@ -340,12 +365,15 @@ class KeywordSearchPanel extends AbstractKeywordSearchPerformer {
}//GEN-LAST:event_searchButtonMousePressed }//GEN-LAST:event_searchButtonMousePressed
private void settingsLabelMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_settingsLabelMouseEntered private void settingsLabelMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_settingsLabelMouseEntered
settingsLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/dropdown-icon-rollover.png"))); settingsLabel.setIcon(new javax.swing.ImageIcon(
getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/dropdown-icon-rollover.png")));
}//GEN-LAST:event_settingsLabelMouseEntered }//GEN-LAST:event_settingsLabelMouseEntered
private void settingsLabelMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_settingsLabelMouseExited private void settingsLabelMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_settingsLabelMouseExited
settingsLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/dropdown-icon.png"))); settingsLabel.setIcon(new javax.swing.ImageIcon(
getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/dropdown-icon.png")));
}//GEN-LAST:event_settingsLabelMouseExited }//GEN-LAST:event_settingsLabelMouseExited
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenuItem copyMenuItem; private javax.swing.JMenuItem copyMenuItem;
private javax.swing.JMenuItem cutMenuItem; private javax.swing.JMenuItem cutMenuItem;
@ -405,11 +433,9 @@ class KeywordSearchPanel extends AbstractKeywordSearchPerformer {
final int numIndexedFiles = KeywordSearch.getServer().queryNumIndexedFiles(); final int numIndexedFiles = KeywordSearch.getServer().queryNumIndexedFiles();
KeywordSearch.fireNumIndexedFilesChange(null, new Integer(numIndexedFiles)); KeywordSearch.fireNumIndexedFilesChange(null, new Integer(numIndexedFiles));
//setFilesIndexed(numIndexedFiles); //setFilesIndexed(numIndexedFiles);
} } catch (NoOpenCoreException ex) {
catch (NoOpenCoreException ex) {
logger.log(Level.SEVERE, "Error executing Solr query, " + ex); logger.log(Level.SEVERE, "Error executing Solr query, " + ex);
} } catch (KeywordSearchModuleException se) {
catch (KeywordSearchModuleException se) {
logger.log(Level.SEVERE, "Error executing Solr query, " + se.getMessage()); logger.log(Level.SEVERE, "Error executing Solr query, " + se.getMessage());
} }
break; break;

View File

@ -31,30 +31,35 @@ interface KeywordSearchPerformerInterface {
/** /**
* Does this interface support multi-word queries? * Does this interface support multi-word queries?
*
* @return * @return
*/ */
boolean isMultiwordQuery(); boolean isMultiwordQuery();
/** /**
* True if the user did not choose to do a regular expression search * True if the user did not choose to do a regular expression search
*
* @return * @return
*/ */
boolean isLuceneQuerySelected(); boolean isLuceneQuerySelected();
/** /**
* Returns the query/keyword string that the user entered/selected * Returns the query/keyword string that the user entered/selected
*
* @return Keyword to search * @return Keyword to search
*/ */
String getQueryText(); String getQueryText();
/** /**
* Returns the list of Keyword objects that the user entered/selected * Returns the list of Keyword objects that the user entered/selected
*
* @return * @return
*/ */
List<Keyword> getQueryList(); List<Keyword> getQueryList();
/** /**
* Set the number of files that have been indexed * Set the number of files that have been indexed
*
* @param filesIndexed * @param filesIndexed
*/ */
void setFilesIndexed(int filesIndexed); void setFilesIndexed(int filesIndexed);

View File

@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.keywordsearch;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.solr.client.solrj.response.TermsResponse.Term; import org.apache.solr.client.solrj.response.TermsResponse.Term;
import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
@ -33,6 +34,7 @@ interface KeywordSearchQuery {
/** /**
* validate the query pre execution * validate the query pre execution
*
* @return true if the query passed validation * @return true if the query passed validation
*/ */
public boolean validate(); public boolean validate();
@ -41,8 +43,9 @@ interface KeywordSearchQuery {
/** /**
* execute query and return results without publishing them * execute query and return results without publishing them
* return results for all matching terms * return results for all matching terms
* @throws NoOpenCoreException if query failed due to server error, this could be a notification to stop processing *
* @return * @return
* @throws NoOpenCoreException if query failed due to server error, this could be a notification to stop processing
*/ */
public Map<String, List<ContentHit>> performQuery() throws NoOpenCoreException; public Map<String, List<ContentHit>> performQuery() throws NoOpenCoreException;
@ -51,12 +54,14 @@ interface KeywordSearchQuery {
* Set an optional filter to narrow down the search * Set an optional filter to narrow down the search
* Adding multiple filters ANDs them together. * Adding multiple filters ANDs them together.
* For OR, add multiple ids to a single filter * For OR, add multiple ids to a single filter
*
* @param filter filter to set on the query * @param filter filter to set on the query
*/ */
public void addFilter(KeywordQueryFilter filter); public void addFilter(KeywordQueryFilter filter);
/** /**
* Set an optional SOLR field to narrow down the search * Set an optional SOLR field to narrow down the search
*
* @param field field to set on the query * @param field field to set on the query
*/ */
public void setField(String field); public void setField(String field);
@ -68,31 +73,32 @@ interface KeywordSearchQuery {
public void escape(); public void escape();
/** /**
*
* @return true if query was escaped * @return true if query was escaped
*/ */
public boolean isEscaped(); public boolean isEscaped();
/** /**
*
* @return true if query is a literal query (non regex) * @return true if query is a literal query (non regex)
*/ */
public boolean isLiteral(); public boolean isLiteral();
/** /**
* return original keyword/query string * return original keyword/query string
*
* @return the query String supplied originally * @return the query String supplied originally
*/ */
public String getQueryString(); public String getQueryString();
/** /**
* return escaped keyword/query string if escaping was done * return escaped keyword/query string if escaping was done
*
* @return the escaped query string, or original string if no escaping done * @return the escaped query string, or original string if no escaping done
*/ */
public String getEscapedQueryString(); public String getEscapedQueryString();
/** /**
* get terms associated with the query if any * get terms associated with the query if any
*
* @return collection of terms associated with the query * @return collection of terms associated with the query
*/ */
public Collection<Term> getTerms(); public Collection<Term> getTerms();
@ -100,6 +106,7 @@ interface KeywordSearchQuery {
/** /**
* write results to blackboard per single term and file hit * write results to blackboard per single term and file hit
* this method is useful if something else should keep track of partial results to write * this method is useful if something else should keep track of partial results to write
*
* @param termHit term for only which to write results * @param termHit term for only which to write results
* @param newFsHit AbstractFile for which to write results for this hit * @param newFsHit AbstractFile for which to write results for this hit
* @param snippet snippet preview with hit context, or null if there is no snippet * @param snippet snippet preview with hit context, or null if there is no snippet

View File

@ -42,7 +42,8 @@ class KeywordSearchQueryManager {
// how to display the results // how to display the results
public enum Presentation { public enum Presentation {
FLAT, // all results are in a single level (even if multiple keywords and reg-exps are used). We made this because we were having problems with multiple-levels of nodes and the thumbnail and table view sharing an ExplorerManager. IconView seemed to change EM so that it did not allow lower levels to be selected. FLAT,
// all results are in a single level (even if multiple keywords and reg-exps are used). We made this because we were having problems with multiple-levels of nodes and the thumbnail and table view sharing an ExplorerManager. IconView seemed to change EM so that it did not allow lower levels to be selected.
COLLAPSE, // two levels. Keywords on top, files on bottom. COLLAPSE, // two levels. Keywords on top, files on bottom.
DETAIL // not currently used, but seems like it has three levels of nodes DETAIL // not currently used, but seems like it has three levels of nodes
}; };
@ -55,7 +56,6 @@ class KeywordSearchQueryManager {
private static Logger logger = Logger.getLogger(KeywordSearchQueryManager.class.getName()); private static Logger logger = Logger.getLogger(KeywordSearchQueryManager.class.getName());
/** /**
*
* @param queries Keywords to search for * @param queries Keywords to search for
* @param presentation Presentation layout * @param presentation Presentation layout
*/ */
@ -67,7 +67,6 @@ class KeywordSearchQueryManager {
} }
/** /**
*
* @param query Keyword to search for * @param query Keyword to search for
* @param qt Query type * @param qt Query type
* @param presentation Presentation Layout * @param presentation Presentation Layout
@ -81,7 +80,6 @@ class KeywordSearchQueryManager {
} }
/** /**
*
* @param query Keyword to search for * @param query Keyword to search for
* @param isLiteral false if reg-exp * @param isLiteral false if reg-exp
* @param presentation Presentation layout * @param presentation Presentation layout
@ -154,11 +152,14 @@ class KeywordSearchQueryManager {
String queryConcatStr = queryConcat.toString(); String queryConcatStr = queryConcat.toString();
final int queryConcatStrLen = queryConcatStr.length(); final int queryConcatStrLen = queryConcatStr.length();
final String queryStrShort = queryConcatStrLen > 15 ? queryConcatStr.substring(0, 14) + "..." : queryConcatStr; final String queryStrShort = queryConcatStrLen > 15 ? queryConcatStr.substring(0, 14) + "..." : queryConcatStr;
final String windowTitle = NbBundle.getMessage(this.getClass(), "KeywordSearchQueryManager.execute.exeWinTitle", ++resultWindowCount, queryStrShort); final String windowTitle = NbBundle
.getMessage(this.getClass(), "KeywordSearchQueryManager.execute.exeWinTitle", ++resultWindowCount,
queryStrShort);
DataResultTopComponent searchResultWin = DataResultTopComponent.createInstance(windowTitle); DataResultTopComponent searchResultWin = DataResultTopComponent.createInstance(windowTitle);
if (things.size() > 0) { if (things.size() > 0) {
Children childThingNodes = Children childThingNodes =
Children.create(new KeywordSearchResultFactory(keywords, things, presentation, searchResultWin), true); Children.create(new KeywordSearchResultFactory(keywords, things, presentation, searchResultWin),
true);
rootNode = new AbstractNode(childThingNodes); rootNode = new AbstractNode(childThingNodes);
} else { } else {
@ -175,6 +176,7 @@ class KeywordSearchQueryManager {
/** /**
* validate the queries before they are run * validate the queries before they are run
*
* @return false if any are invalid * @return false if any are invalid
*/ */
public boolean validate() { public boolean validate() {

View File

@ -27,9 +27,12 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.logging.Level; import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import org.netbeans.api.progress.ProgressHandle; import org.netbeans.api.progress.ProgressHandle;
import org.netbeans.api.progress.ProgressHandleFactory; import org.netbeans.api.progress.ProgressHandleFactory;
import org.openide.nodes.ChildFactory; import org.openide.nodes.ChildFactory;
@ -54,7 +57,6 @@ import org.sleuthkit.datamodel.FsContent;
import org.sleuthkit.datamodel.TskData.TSK_DB_FILES_TYPE_ENUM; import org.sleuthkit.datamodel.TskData.TSK_DB_FILES_TYPE_ENUM;
/** /**
*
* factory produces top level nodes with query * factory produces top level nodes with query
* responsible for assembling nodes and columns in the right way * responsible for assembling nodes and columns in the right way
* and performing lazy queries as needed * and performing lazy queries as needed
@ -66,41 +68,41 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
public static enum CommonPropertyTypes { public static enum CommonPropertyTypes {
KEYWORD { KEYWORD {
@Override @Override
public String toString() { public String toString() {
return BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD.getDisplayName(); return BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD.getDisplayName();
} }
}, },
REGEX { REGEX {
@Override @Override
public String toString() { public String toString() {
return BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_REGEXP.getDisplayName(); return BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_REGEXP.getDisplayName();
} }
}, },
CONTEXT { CONTEXT {
@Override @Override
public String toString() { public String toString() {
return BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_PREVIEW.getDisplayName(); return BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_PREVIEW.getDisplayName();
} }
}, },
} }
private final Presentation presentation; private final Presentation presentation;
private List<Keyword> queries; private List<Keyword> queries;
private Collection<KeyValueQuery> things; private Collection<KeyValueQuery> things;
private final DataResultTopComponent viewer; //viewer driving this child node factory private final DataResultTopComponent viewer; //viewer driving this child node factory
private static final Logger logger = Logger.getLogger(KeywordSearchResultFactory.class.getName()); private static final Logger logger = Logger.getLogger(KeywordSearchResultFactory.class.getName());
KeywordSearchResultFactory(List<Keyword> queries, Collection<KeyValueQuery> things, Presentation presentation, DataResultTopComponent viewer) { KeywordSearchResultFactory(List<Keyword> queries, Collection<KeyValueQuery> things, Presentation presentation,
DataResultTopComponent viewer) {
this.queries = queries; this.queries = queries;
this.things = things; this.things = things;
this.presentation = presentation; this.presentation = presentation;
this.viewer = viewer; this.viewer = viewer;
} }
KeywordSearchResultFactory(Keyword query, Collection<KeyValueQuery> things, Presentation presentation, DataResultTopComponent viewer) { KeywordSearchResultFactory(Keyword query, Collection<KeyValueQuery> things, Presentation presentation,
DataResultTopComponent viewer) {
queries = new ArrayList<>(); queries = new ArrayList<>();
queries.add(query); queries.add(query);
this.presentation = presentation; this.presentation = presentation;
@ -112,6 +114,7 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
* call this at least for the parent Node, to make sure all common * call this at least for the parent Node, to make sure all common
* properties are displayed as columns (since we are doing lazy child Node load * properties are displayed as columns (since we are doing lazy child Node load
* we need to preinitialize properties when sending parent Node) * we need to preinitialize properties when sending parent Node)
*
* @param toSet property set map for a Node * @param toSet property set map for a Node
*/ */
public static void initCommonProperties(Map<String, Object> toSet) { public static void initCommonProperties(Map<String, Object> toSet) {
@ -121,7 +124,8 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
toSet.put(commonTypes[i].toString(), ""); toSet.put(commonTypes[i].toString(), "");
} }
AbstractAbstractFileNode.AbstractFilePropertyType[] fsTypes = AbstractAbstractFileNode.AbstractFilePropertyType.values(); AbstractAbstractFileNode.AbstractFilePropertyType[] fsTypes = AbstractAbstractFileNode.AbstractFilePropertyType
.values();
final int FS_PROPS_LEN = fsTypes.length; final int FS_PROPS_LEN = fsTypes.length;
for (int i = 0; i < FS_PROPS_LEN; ++i) { for (int i = 0; i < FS_PROPS_LEN; ++i) {
toSet.put(fsTypes[i].toString(), ""); toSet.put(fsTypes[i].toString(), "");
@ -151,8 +155,7 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
ResultCollapsedChildFactory childFactory = new ResultCollapsedChildFactory(thing); ResultCollapsedChildFactory childFactory = new ResultCollapsedChildFactory(thing);
childFactory.createKeysForFlatNodes(toPopulate); childFactory.createKeysForFlatNodes(toPopulate);
} }
} } else if (presentation == Presentation.DETAIL) {
else if (presentation == Presentation.DETAIL) {
Iterator<KeyValueQuery> it = things.iterator(); Iterator<KeyValueQuery> it = things.iterator();
for (Keyword keyword : queries) { for (Keyword keyword : queries) {
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
@ -186,8 +189,7 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
if (presentation == Presentation.FLAT) { if (presentation == Presentation.FLAT) {
ResultCollapsedChildFactory factory = new ResultCollapsedChildFactory(thing); ResultCollapsedChildFactory factory = new ResultCollapsedChildFactory(thing);
return factory.createFlatNodeForKey(thing); return factory.createFlatNodeForKey(thing);
} } else if (presentation == Presentation.COLLAPSE) {
else if (presentation == Presentation.COLLAPSE) {
childFactory = new ResultCollapsedChildFactory(thing); childFactory = new ResultCollapsedChildFactory(thing);
final Node ret = new KeyValueNode(thing, Children.create(childFactory, true)); final Node ret = new KeyValueNode(thing, Children.create(childFactory, true));
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@ -249,7 +251,8 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
//get listname //get listname
String listName = ""; String listName = "";
KeywordSearchListsAbstract.KeywordSearchList list = KeywordSearchListsXML.getCurrent().getListWithKeyword(tcq.getQueryString()); KeywordSearchListsAbstract.KeywordSearchList list = KeywordSearchListsXML.getCurrent().getListWithKeyword(
tcq.getQueryString());
if (list != null) { if (list != null) {
listName = list.getName(); listName = list.getName();
} }
@ -305,7 +308,8 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
} }
final String highlightQueryEscaped = getHighlightQuery(tcq, literal_query, tcqRes, f); final String highlightQueryEscaped = getHighlightQuery(tcq, literal_query, tcqRes, f);
tempList.add(new KeyValueQueryContent(f.getName(), resMap, ++resID, f, highlightQueryEscaped, tcq, previewChunk, tcqRes)); tempList.add(new KeyValueQueryContent(f.getName(), resMap, ++resID, f, highlightQueryEscaped, tcq,
previewChunk, tcqRes));
} }
// Add all the nodes to toPopulate at once. Minimizes node creation // Add all the nodes to toPopulate at once. Minimizes node creation
@ -321,7 +325,8 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
return true; return true;
} }
private String getHighlightQuery(KeywordSearchQuery tcq, boolean literal_query, Map<String, List<ContentHit>> tcqRes, AbstractFile f) { private String getHighlightQuery(KeywordSearchQuery tcq, boolean literal_query,
Map<String, List<ContentHit>> tcqRes, AbstractFile f) {
String highlightQueryEscaped; String highlightQueryEscaped;
if (literal_query) { if (literal_query) {
//literal, treat as non-regex, non-term component query //literal, treat as non-regex, non-term component query
@ -389,7 +394,9 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
Node kvNode = new KeyValueNode(thingContent, Children.LEAF, Lookups.singleton(content)); Node kvNode = new KeyValueNode(thingContent, Children.LEAF, Lookups.singleton(content));
//wrap in KeywordSearchFilterNode for the markup content, might need to override FilterNode for more customization //wrap in KeywordSearchFilterNode for the markup content, might need to override FilterNode for more customization
HighlightedMatchesSource highlights = new HighlightedMatchesSource(content, queryStr, !thingContent.getQuery().isEscaped(), false, hits); HighlightedMatchesSource highlights = new HighlightedMatchesSource(content, queryStr,
!thingContent.getQuery().isEscaped(),
false, hits);
return new KeywordSearchFilterNode(highlights, kvNode, queryStr, previewChunk); return new KeywordSearchFilterNode(highlights, kvNode, queryStr, previewChunk);
} }
} }
@ -457,7 +464,9 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
if (f.getType() == TSK_DB_FILES_TYPE_ENUM.FS) { if (f.getType() == TSK_DB_FILES_TYPE_ENUM.FS) {
AbstractFsContentNode.fillPropertyMap(resMap, (FsContent) f); AbstractFsContentNode.fillPropertyMap(resMap, (FsContent) f);
} }
tempList.add(new KeyValueQueryContent(f.getName(), resMap, ++resID, f, keywordQuery, thing.getQuery(), previewChunkId, matchesRes)); tempList.add(
new KeyValueQueryContent(f.getName(), resMap, ++resID, f, keywordQuery, thing.getQuery(),
previewChunkId, matchesRes));
} }
// Add all the nodes to toPopulate at once. Minimizes node creation // Add all the nodes to toPopulate at once. Minimizes node creation
@ -480,7 +489,9 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
Node kvNode = new KeyValueNode(thingContent, Children.LEAF, Lookups.singleton(content)); Node kvNode = new KeyValueNode(thingContent, Children.LEAF, Lookups.singleton(content));
//wrap in KeywordSearchFilterNode for the markup content //wrap in KeywordSearchFilterNode for the markup content
HighlightedMatchesSource highlights = new HighlightedMatchesSource(content, query, !thingContent.getQuery().isEscaped(), hits); HighlightedMatchesSource highlights = new HighlightedMatchesSource(content, query,
!thingContent.getQuery().isEscaped(),
hits);
return new KeywordSearchFilterNode(highlights, kvNode, query, previewChunk); return new KeywordSearchFilterNode(highlights, kvNode, query, previewChunk);
} }
} }
@ -512,7 +523,8 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
return hits; return hits;
} }
public KeyValueQueryContent(String name, Map<String, Object> map, int id, Content content, String queryStr, KeywordSearchQuery query, int previewChunk, Map<String, List<ContentHit>> hits) { public KeyValueQueryContent(String name, Map<String, Object> map, int id, Content content, String queryStr,
KeywordSearchQuery query, int previewChunk, Map<String, List<ContentHit>> hits) {
super(name, map, id, query); super(name, map, id, query);
this.content = content; this.content = content;
this.queryStr = queryStr; this.queryStr = queryStr;
@ -556,7 +568,8 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
}); });
if (!this.isCancelled() && !na.isEmpty()) { if (!this.isCancelled() && !na.isEmpty()) {
IngestServices.getDefault().fireModuleDataEvent(new ModuleDataEvent(KeywordSearchIngestModule.MODULE_NAME, ARTIFACT_TYPE.TSK_KEYWORD_HIT, na)); IngestServices.getDefault().fireModuleDataEvent(
new ModuleDataEvent(KeywordSearchIngestModule.MODULE_NAME, ARTIFACT_TYPE.TSK_KEYWORD_HIT, na));
} }
} }
@ -568,7 +581,8 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
//writerLock.lock(); //writerLock.lock();
try { try {
final String queryStr = query.getQueryString(); final String queryStr = query.getQueryString();
final String queryDisp = queryStr.length() > QUERY_DISPLAY_LEN ? queryStr.substring(0, QUERY_DISPLAY_LEN - 1) + " ..." : queryStr; final String queryDisp = queryStr.length() > QUERY_DISPLAY_LEN ?
queryStr.substring(0, QUERY_DISPLAY_LEN - 1) + " ..." : queryStr;
progress = ProgressHandleFactory.createHandle("Saving results: " + queryDisp, new Cancellable() { progress = ProgressHandleFactory.createHandle("Saving results: " + queryDisp, new Cancellable() {
@Override @Override
@ -590,7 +604,8 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
final String snippetQuery = KeywordSearchUtil.escapeLuceneQuery(hit); final String snippetQuery = KeywordSearchUtil.escapeLuceneQuery(hit);
String snippet; String snippet;
try { try {
snippet = LuceneQuery.querySnippet(snippetQuery, f.getId(), chunkId, !query.isLiteral(), true); snippet = LuceneQuery
.querySnippet(snippetQuery, f.getId(), chunkId, !query.isLiteral(), true);
} catch (NoOpenCoreException e) { } catch (NoOpenCoreException e) {
logger.log(Level.WARNING, "Error querying snippet: " + snippetQuery, e); logger.log(Level.WARNING, "Error querying snippet: " + snippetQuery, e);
//no reason to continie //no reason to continie

View File

@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.autopsy.coreutils.StringExtract; import org.sleuthkit.autopsy.coreutils.StringExtract;
@ -41,13 +42,14 @@ class KeywordSearchSettings {
private static boolean skipKnown = true; private static boolean skipKnown = true;
private static final Logger logger = Logger.getLogger(KeywordSearchSettings.class.getName()); private static final Logger logger = Logger.getLogger(KeywordSearchSettings.class.getName());
private static UpdateFrequency UpdateFreq = UpdateFrequency.DEFAULT; private static UpdateFrequency UpdateFreq = UpdateFrequency.DEFAULT;
private static List<StringExtract.StringExtractUnicodeTable.SCRIPT> stringExtractScripts = new ArrayList<StringExtract.StringExtractUnicodeTable.SCRIPT>(); private static List<StringExtract.StringExtractUnicodeTable.SCRIPT> stringExtractScripts
= new ArrayList<StringExtract.StringExtractUnicodeTable.SCRIPT>();
private static Map<String, String> stringExtractOptions = new HashMap<String, String>(); private static Map<String, String> stringExtractOptions = new HashMap<String, String>();
/** /**
* Gets the update Frequency from KeywordSearch_Options.properties * Gets the update Frequency from KeywordSearch_Options.properties
*
* @return KeywordSearchIngestModule's update frequency * @return KeywordSearchIngestModule's update frequency
*/ */
static UpdateFrequency getUpdateFrequency() { static UpdateFrequency getUpdateFrequency() {
@ -62,6 +64,7 @@ class KeywordSearchSettings {
/** /**
* Sets the update frequency and writes to KeywordSearch_Options.properties * Sets the update frequency and writes to KeywordSearch_Options.properties
*
* @param freq Sets KeywordSearchIngestModule to this value. * @param freq Sets KeywordSearchIngestModule to this value.
*/ */
static void setUpdateFrequency(UpdateFrequency freq) { static void setUpdateFrequency(UpdateFrequency freq) {
@ -71,6 +74,7 @@ class KeywordSearchSettings {
/** /**
* Sets whether or not to skip adding known good files to the search during index. * Sets whether or not to skip adding known good files to the search during index.
*
* @param skip * @param skip
*/ */
static void setSkipKnown(boolean skip) { static void setSkipKnown(boolean skip) {
@ -80,6 +84,7 @@ class KeywordSearchSettings {
/** /**
* Gets the setting for whether or not this ingest is skipping adding known good files to the index. * Gets the setting for whether or not this ingest is skipping adding known good files to the index.
*
* @return skip setting * @return skip setting
*/ */
static boolean getSkipKnown() { static boolean getSkipKnown() {
@ -92,9 +97,9 @@ class KeywordSearchSettings {
} }
/** /**
* Sets what scripts to extract during ingest * Sets what scripts to extract during ingest
*
* @param scripts List of scripts to extract * @param scripts List of scripts to extract
*/ */
static void setStringExtractScripts(List<StringExtract.StringExtractUnicodeTable.SCRIPT> scripts) { static void setStringExtractScripts(List<StringExtract.StringExtractUnicodeTable.SCRIPT> scripts) {
@ -116,6 +121,7 @@ class KeywordSearchSettings {
/** /**
* Set / override string extract option * Set / override string extract option
*
* @param key option name to set * @param key option name to set
* @param val option value to set * @param val option value to set
*/ */
@ -130,7 +136,8 @@ class KeywordSearchSettings {
* @return the list of currently used script * @return the list of currently used script
*/ */
static List<SCRIPT> getStringExtractScripts() { static List<SCRIPT> getStringExtractScripts() {
if(ModuleSettings.getConfigSettings(PROPERTIES_SCRIPTS) != null && !ModuleSettings.getConfigSettings(PROPERTIES_SCRIPTS).isEmpty()){ if (ModuleSettings.getConfigSettings(PROPERTIES_SCRIPTS) != null && !ModuleSettings
.getConfigSettings(PROPERTIES_SCRIPTS).isEmpty()) {
List<SCRIPT> scripts = new ArrayList<SCRIPT>(); List<SCRIPT> scripts = new ArrayList<SCRIPT>();
for (Map.Entry<String, String> kvp : ModuleSettings.getConfigSettings(PROPERTIES_SCRIPTS).entrySet()) { for (Map.Entry<String, String> kvp : ModuleSettings.getConfigSettings(PROPERTIES_SCRIPTS).entrySet()) {
if (kvp.getValue().equals("true")) { if (kvp.getValue().equals("true")) {
@ -145,17 +152,16 @@ class KeywordSearchSettings {
} }
/** /**
* get string extract option for the key * get string extract option for the key
*
* @param key option name * @param key option name
* @return option string value, or empty string if the option is not set * @return option string value, or empty string if the option is not set
*/ */
static String getStringExtractOption(String key) { static String getStringExtractOption(String key) {
if (ModuleSettings.getConfigSetting(PROPERTIES_OPTIONS, key) != null) { if (ModuleSettings.getConfigSetting(PROPERTIES_OPTIONS, key) != null) {
return ModuleSettings.getConfigSetting(PROPERTIES_OPTIONS, key); return ModuleSettings.getConfigSetting(PROPERTIES_OPTIONS, key);
} } else {
else {
logger.log(Level.WARNING, "Could not read property for key " + key + ", returning backup value."); logger.log(Level.WARNING, "Could not read property for key " + key + ", returning backup value.");
return stringExtractOptions.get(key); return stringExtractOptions.get(key);
} }
@ -163,20 +169,22 @@ class KeywordSearchSettings {
/** /**
* get the map of string extract options. * get the map of string extract options.
*
* @return Map<String,String> of extract options. * @return Map<String,String> of extract options.
*/ */
static Map<String, String> getStringExtractOptions() { static Map<String, String> getStringExtractOptions() {
Map<String, String> settings = ModuleSettings.getConfigSettings(PROPERTIES_OPTIONS); Map<String, String> settings = ModuleSettings.getConfigSettings(PROPERTIES_OPTIONS);
if (settings == null) { if (settings == null) {
Map<String, String> settingsv2 = new HashMap<String, String>(); Map<String, String> settingsv2 = new HashMap<String, String>();
logger.log(Level.WARNING, "Could not read properties for " + PROPERTIES_OPTIONS + ".properties, returning backup values"); logger.log(Level.WARNING,
"Could not read properties for " + PROPERTIES_OPTIONS + ".properties, returning backup values");
settingsv2.putAll(stringExtractOptions); settingsv2.putAll(stringExtractOptions);
return settingsv2; return settingsv2;
} } else {
else {
return settings; return settings;
} }
} }
/** /**
* Sets the default values of the KeywordSearch properties files if none already exist. * Sets the default values of the KeywordSearch properties files if none already exist.
*/ */
@ -193,22 +201,26 @@ class KeywordSearchSettings {
KeywordSearchSettings.setUpdateFrequency(UpdateFrequency.DEFAULT); KeywordSearchSettings.setUpdateFrequency(UpdateFrequency.DEFAULT);
} }
//setting default Extract UTF8 //setting default Extract UTF8
if(!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_OPTIONS, AbstractFileExtract.ExtractOptions.EXTRACT_UTF8.toString())){ if (!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_OPTIONS,
AbstractFileExtract.ExtractOptions.EXTRACT_UTF8.toString())) {
logger.log(Level.INFO, "No configuration for UTF8 found, generating default..."); logger.log(Level.INFO, "No configuration for UTF8 found, generating default...");
KeywordSearchSettings.setStringExtractOption(AbstractFileExtract.ExtractOptions.EXTRACT_UTF8.toString(), Boolean.TRUE.toString()); KeywordSearchSettings.setStringExtractOption(AbstractFileExtract.ExtractOptions.EXTRACT_UTF8.toString(),
Boolean.TRUE.toString());
} }
//setting default Extract UTF16 //setting default Extract UTF16
if(!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_OPTIONS, AbstractFileExtract.ExtractOptions.EXTRACT_UTF16.toString())){ if (!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_OPTIONS,
AbstractFileExtract.ExtractOptions.EXTRACT_UTF16.toString())) {
logger.log(Level.INFO, "No configuration for UTF16 found, generating defaults..."); logger.log(Level.INFO, "No configuration for UTF16 found, generating defaults...");
KeywordSearchSettings.setStringExtractOption(AbstractFileExtract.ExtractOptions.EXTRACT_UTF16.toString(), Boolean.TRUE.toString()); KeywordSearchSettings.setStringExtractOption(AbstractFileExtract.ExtractOptions.EXTRACT_UTF16.toString(),
Boolean.TRUE.toString());
} }
//setting default Latin-1 Script //setting default Latin-1 Script
if (!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_SCRIPTS, SCRIPT.LATIN_1.name())) { if (!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_SCRIPTS, SCRIPT.LATIN_1.name())) {
logger.log(Level.INFO, "No configuration for Scripts found, generating defaults..."); logger.log(Level.INFO, "No configuration for Scripts found, generating defaults...");
ModuleSettings.setConfigSetting(KeywordSearchSettings.PROPERTIES_SCRIPTS, SCRIPT.LATIN_1.name(), Boolean.toString(true)); ModuleSettings.setConfigSetting(KeywordSearchSettings.PROPERTIES_SCRIPTS, SCRIPT.LATIN_1.name(),
Boolean.toString(true));
} }
} }
} }

View File

@ -21,8 +21,11 @@ package org.sleuthkit.autopsy.keywordsearch;
import java.awt.Component; import java.awt.Component;
import java.io.File; import java.io.File;
import java.util.logging.Level; import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.FsContent; import org.sleuthkit.datamodel.FsContent;
import org.sleuthkit.datamodel.TskException; import org.sleuthkit.datamodel.TskException;
@ -32,9 +35,10 @@ class KeywordSearchUtil {
public enum DIALOG_MESSAGE_TYPE { public enum DIALOG_MESSAGE_TYPE {
ERROR, WARN, INFO ERROR, WARN, INFO
}; }
private static final Logger logger = Logger.getLogger(KeywordSearchUtil.class.getName());
;
private static final Logger logger = Logger.getLogger(KeywordSearchUtil.class.getName());
/** /**
@ -117,7 +121,8 @@ class KeywordSearchUtil {
messageType); messageType);
} }
public static boolean displayConfirmDialog(final String title, final String message, final DIALOG_MESSAGE_TYPE type) { public static boolean displayConfirmDialog(final String title, final String message,
final DIALOG_MESSAGE_TYPE type) {
int messageType; int messageType;
if (type == DIALOG_MESSAGE_TYPE.ERROR) { if (type == DIALOG_MESSAGE_TYPE.ERROR) {
messageType = JOptionPane.ERROR_MESSAGE; messageType = JOptionPane.ERROR_MESSAGE;
@ -126,7 +131,8 @@ class KeywordSearchUtil {
} else { } else {
messageType = JOptionPane.INFORMATION_MESSAGE; messageType = JOptionPane.INFORMATION_MESSAGE;
} }
if (JOptionPane.showConfirmDialog(null, message, title, JOptionPane.YES_NO_OPTION, messageType) == JOptionPane.YES_OPTION) { if (JOptionPane.showConfirmDialog(null, message, title, JOptionPane.YES_NO_OPTION, messageType)
== JOptionPane.YES_OPTION) {
return true; return true;
} else { } else {
return false; return false;

View File

@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.keywordsearch;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.BlackboardAttribute;

View File

@ -24,6 +24,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrRequest.METHOD; import org.apache.solr.client.solrj.SolrRequest.METHOD;
@ -67,6 +68,7 @@ class LuceneQuery implements KeywordSearchQuery {
/** /**
* Constructor with query to process. * Constructor with query to process.
*
* @param keywordQuery * @param keywordQuery
*/ */
public LuceneQuery(Keyword keywordQuery) { public LuceneQuery(Keyword keywordQuery) {
@ -76,6 +78,7 @@ class LuceneQuery implements KeywordSearchQuery {
/** /**
* Constructor with keyword string to process * Constructor with keyword string to process
*
* @param queryStr Keyword to search for * @param queryStr Keyword to search for
*/ */
public LuceneQuery(String queryStr) { public LuceneQuery(String queryStr) {
@ -141,7 +144,8 @@ class LuceneQuery implements KeywordSearchQuery {
} }
@Override @Override
public KeywordWriteResult writeToBlackBoard(String termHit, AbstractFile newFsHit, String snippet, String listName) { public KeywordWriteResult writeToBlackBoard(String termHit, AbstractFile newFsHit, String snippet,
String listName) {
final String MODULE_NAME = KeywordSearchIngestModule.MODULE_NAME; final String MODULE_NAME = KeywordSearchIngestModule.MODULE_NAME;
KeywordWriteResult writeResult = null; KeywordWriteResult writeResult = null;
@ -156,7 +160,8 @@ class LuceneQuery implements KeywordSearchQuery {
} }
if (snippet != null) { if (snippet != null) {
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD_PREVIEW.getTypeID(), MODULE_NAME, snippet)); attributes
.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD_PREVIEW.getTypeID(), MODULE_NAME, snippet));
} }
//keyword //keyword
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD.getTypeID(), MODULE_NAME, termHit)); attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD.getTypeID(), MODULE_NAME, termHit));
@ -189,6 +194,7 @@ class LuceneQuery implements KeywordSearchQuery {
/** /**
* Perform the query and return result * Perform the query and return result
*
* @return list of ContentHit objects * @return list of ContentHit objects
* @throws NoOpenCoreException * @throws NoOpenCoreException
*/ */
@ -286,18 +292,21 @@ class LuceneQuery implements KeywordSearchQuery {
/** /**
* return snippet preview context * return snippet preview context
*
* @param query the keyword query for text to highlight. Lucene special cahrs should already be escaped. * @param query the keyword query for text to highlight. Lucene special cahrs should already be escaped.
* @param contentID content id associated with the file * @param contentID content id associated with the file
* @param isRegex whether the query is a regular expression (different Solr fields are then used to generate the preview) * @param isRegex whether the query is a regular expression (different Solr fields are then used to generate the preview)
* @param group whether the query should look for all terms grouped together in the query order, or not * @param group whether the query should look for all terms grouped together in the query order, or not
* @return * @return
*/ */
public static String querySnippet(String query, long contentID, boolean isRegex, boolean group) throws NoOpenCoreException { public static String querySnippet(String query, long contentID, boolean isRegex, boolean group)
throws NoOpenCoreException {
return querySnippet(query, contentID, 0, isRegex, group); return querySnippet(query, contentID, 0, isRegex, group);
} }
/** /**
* return snippet preview context * return snippet preview context
*
* @param query the keyword query for text to highlight. Lucene special cahrs should already be escaped. * @param query the keyword query for text to highlight. Lucene special cahrs should already be escaped.
* @param contentID content id associated with the hit * @param contentID content id associated with the hit
* @param chunkID chunk id associated with the content hit, or 0 if no chunks * @param chunkID chunk id associated with the content hit, or 0 if no chunks
@ -305,7 +314,8 @@ class LuceneQuery implements KeywordSearchQuery {
* @param group whether the query should look for all terms grouped together in the query order, or not * @param group whether the query should look for all terms grouped together in the query order, or not
* @return * @return
*/ */
public static String querySnippet(String query, long contentID, int chunkID, boolean isRegex, boolean group) throws NoOpenCoreException { public static String querySnippet(String query, long contentID, int chunkID, boolean isRegex, boolean group)
throws NoOpenCoreException {
Server solrServer = KeywordSearch.getServer(); Server solrServer = KeywordSearch.getServer();
String highlightField = null; String highlightField = null;
@ -357,7 +367,6 @@ class LuceneQuery implements KeywordSearchQuery {
q.setHighlightFragsize(SNIPPET_LENGTH); q.setHighlightFragsize(SNIPPET_LENGTH);
//tune the highlighter //tune the highlighter
q.setParam("hl.useFastVectorHighlighter", "on"); //fast highlighter scales better than standard one q.setParam("hl.useFastVectorHighlighter", "on"); //fast highlighter scales better than standard one
q.setParam("hl.tag.pre", "&laquo;"); //makes sense for FastVectorHighlighter only q.setParam("hl.tag.pre", "&laquo;"); //makes sense for FastVectorHighlighter only

View File

@ -31,24 +31,24 @@ interface MarkupSource {
/** /**
* @return text optionally marked up with the subsest of HTML that Swing * @return text optionally marked up with the subsest of HTML that Swing
* components can handle in their setText() method. * components can handle in their setText() method.
*
*/ */
String getMarkup(); String getMarkup();
/** /**
*
* @return true if markup is marked to be searchable * @return true if markup is marked to be searchable
*/ */
boolean isSearchable(); boolean isSearchable();
/** /**
* If searchable markup, returns prefix of anchor, otherwise return empty string * If searchable markup, returns prefix of anchor, otherwise return empty string
*
* @return * @return
*/ */
String getAnchorPrefix(); String getAnchorPrefix();
/** /**
* if searchable markup, returns number of hits found and encoded in the markup * if searchable markup, returns number of hits found and encoded in the markup
*
* @return * @return
*/ */
int getNumberHits(); int getNumberHits();
@ -61,30 +61,35 @@ interface MarkupSource {
/** /**
* get number pages/chunks * get number pages/chunks
*
* @return number pages * @return number pages
*/ */
int getNumberPages(); int getNumberPages();
/** /**
* get the current page number * get the current page number
*
* @return current page number * @return current page number
*/ */
int getCurrentPage(); int getCurrentPage();
/** /**
* Check if has next page * Check if has next page
*
* @return true, if next page exists in the source * @return true, if next page exists in the source
*/ */
boolean hasNextPage(); boolean hasNextPage();
/** /**
* Move to next page * Move to next page
*
* @return the new page number * @return the new page number
*/ */
int nextPage(); int nextPage();
/** /**
* Check if has previous page * Check if has previous page
*
* @return true, if previous page exists in the source * @return true, if previous page exists in the source
*/ */
boolean hasPreviousPage(); boolean hasPreviousPage();
@ -92,24 +97,28 @@ interface MarkupSource {
/** /**
* Move to previous page * Move to previous page
*
* @return the new page number * @return the new page number
*/ */
int previousPage(); int previousPage();
/** /**
* Check if has next searchable item * Check if has next searchable item
*
* @return true, if next item exists in the source * @return true, if next item exists in the source
*/ */
boolean hasNextItem(); boolean hasNextItem();
/** /**
* Move to next item * Move to next item
*
* @return the new item number * @return the new item number
*/ */
int nextItem(); int nextItem();
/** /**
* Check if has previous item * Check if has previous item
*
* @return true, if previous item exists in the source * @return true, if previous item exists in the source
*/ */
boolean hasPreviousItem(); boolean hasPreviousItem();
@ -117,12 +126,14 @@ interface MarkupSource {
/** /**
* Move to previous item * Move to previous item
*
* @return the new item number * @return the new item number
*/ */
int previousItem(); int previousItem();
/** /**
* Get the current item number, do not change anything * Get the current item number, do not change anything
*
* @return the current item number * @return the current item number
*/ */
int currentItem(); int currentItem();
@ -130,6 +141,7 @@ interface MarkupSource {
/** /**
* get a map storing which pages have matches to their number, or 0 if unknown * get a map storing which pages have matches to their number, or 0 if unknown
*
* @return map storing pages with matches, or null if not supported * @return map storing pages with matches, or null if not supported
*/ */
LinkedHashMap<Integer, Integer> getHitsPages(); LinkedHashMap<Integer, Integer> getHitsPages();

View File

@ -19,7 +19,6 @@
package org.sleuthkit.autopsy.keywordsearch; package org.sleuthkit.autopsy.keywordsearch;
/** /**
*
* Exception thrown when no core is open * Exception thrown when no core is open
*/ */
class NoOpenCoreException extends Exception { class NoOpenCoreException extends Exception {

View File

@ -41,8 +41,11 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServer; import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.SolrServerException;
@ -133,8 +136,11 @@ class Server {
return "num_chunks"; return "num_chunks";
} }
}, },
}; }
public static final String HL_ANALYZE_CHARS_UNLIMITED = "500000"; //max 1MB in a chunk. use -1 for unlimited, but -1 option may not be supported (not documented)
;
public static final String HL_ANALYZE_CHARS_UNLIMITED = "500000";
//max 1MB in a chunk. use -1 for unlimited, but -1 option may not be supported (not documented)
//max content size we can send to Solr //max content size we can send to Solr
public static final long MAX_CONTENT_SIZE = 1L * 1024 * 1024 * 1024; public static final long MAX_CONTENT_SIZE = 1L * 1024 * 1024 * 1024;
private static final Logger logger = Logger.getLogger(Server.class.getName()); private static final Logger logger = Logger.getLogger(Server.class.getName());
@ -143,7 +149,8 @@ class Server {
public static final String CORE_EVT = "CORE_EVT"; public static final String CORE_EVT = "CORE_EVT";
public static final char ID_CHUNK_SEP = '_'; public static final char ID_CHUNK_SEP = '_';
private String javaPath = "java"; private String javaPath = "java";
public static final Charset DEFAULT_INDEXED_TEXT_CHARSET = Charset.forName("UTF-8"); ///< default Charset to index text as public static final Charset DEFAULT_INDEXED_TEXT_CHARSET = Charset.forName("UTF-8");
///< default Charset to index text as
private static final int MAX_SOLR_MEM_MB = 512; //TODO set dynamically based on avail. system resources private static final int MAX_SOLR_MEM_MB = 512; //TODO set dynamically based on avail. system resources
private Process curSolrProcess = null; private Process curSolrProcess = null;
private static Ingester ingester = null; private static Ingester ingester = null;
@ -160,7 +167,9 @@ class Server {
public enum CORE_EVT_STATES { public enum CORE_EVT_STATES {
STOPPED, STARTED STOPPED, STARTED
}; }
;
private SolrServer solrServer; private SolrServer solrServer;
private String instanceDir; private String instanceDir;
private File solrFolder; private File solrFolder;
@ -189,26 +198,34 @@ class Server {
private void initSettings() { private void initSettings() {
if (ModuleSettings.settingExists(PROPERTIES_FILE, PROPERTIES_CURRENT_SERVER_PORT)) { if (ModuleSettings.settingExists(PROPERTIES_FILE, PROPERTIES_CURRENT_SERVER_PORT)) {
try { try {
currentSolrServerPort = Integer.decode(ModuleSettings.getConfigSetting(PROPERTIES_FILE, PROPERTIES_CURRENT_SERVER_PORT)); currentSolrServerPort = Integer
.decode(ModuleSettings.getConfigSetting(PROPERTIES_FILE, PROPERTIES_CURRENT_SERVER_PORT));
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {
logger.log(Level.WARNING, "Could not decode indexing server port, value was not a valid port number, using the default. ", nfe); logger.log(Level.WARNING,
"Could not decode indexing server port, value was not a valid port number, using the default. ",
nfe);
currentSolrServerPort = DEFAULT_SOLR_SERVER_PORT; currentSolrServerPort = DEFAULT_SOLR_SERVER_PORT;
} }
} else { } else {
currentSolrServerPort = DEFAULT_SOLR_SERVER_PORT; currentSolrServerPort = DEFAULT_SOLR_SERVER_PORT;
ModuleSettings.setConfigSetting(PROPERTIES_FILE, PROPERTIES_CURRENT_SERVER_PORT, String.valueOf(currentSolrServerPort)); ModuleSettings.setConfigSetting(PROPERTIES_FILE, PROPERTIES_CURRENT_SERVER_PORT,
String.valueOf(currentSolrServerPort));
} }
if (ModuleSettings.settingExists(PROPERTIES_FILE, PROPERTIES_CURRENT_STOP_PORT)) { if (ModuleSettings.settingExists(PROPERTIES_FILE, PROPERTIES_CURRENT_STOP_PORT)) {
try { try {
currentSolrStopPort = Integer.decode(ModuleSettings.getConfigSetting(PROPERTIES_FILE, PROPERTIES_CURRENT_STOP_PORT)); currentSolrStopPort = Integer
.decode(ModuleSettings.getConfigSetting(PROPERTIES_FILE, PROPERTIES_CURRENT_STOP_PORT));
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {
logger.log(Level.WARNING, "Could not decode indexing server stop port, value was not a valid port number, using default", nfe); logger.log(Level.WARNING,
"Could not decode indexing server stop port, value was not a valid port number, using default",
nfe);
currentSolrStopPort = DEFAULT_SOLR_STOP_PORT; currentSolrStopPort = DEFAULT_SOLR_STOP_PORT;
} }
} else { } else {
currentSolrStopPort = DEFAULT_SOLR_STOP_PORT; currentSolrStopPort = DEFAULT_SOLR_STOP_PORT;
ModuleSettings.setConfigSetting(PROPERTIES_FILE, PROPERTIES_CURRENT_STOP_PORT, String.valueOf(currentSolrStopPort)); ModuleSettings.setConfigSetting(PROPERTIES_FILE, PROPERTIES_CURRENT_STOP_PORT,
String.valueOf(currentSolrStopPort));
} }
} }
@ -409,7 +426,8 @@ class Server {
throw new KeywordSearchModuleException("Could not start Solr server process", ex); throw new KeywordSearchModuleException("Could not start Solr server process", ex);
} }
} else { } else {
logger.log(Level.WARNING, "Could not start Solr server process, port [" + currentSolrServerPort + "] not available!"); logger.log(Level.WARNING,
"Could not start Solr server process, port [" + currentSolrServerPort + "] not available!");
throw new SolrServerNoPortException(currentSolrServerPort); throw new SolrServerNoPortException(currentSolrServerPort);
} }
} }
@ -465,7 +483,7 @@ class Server {
/** /**
* Tries to stop a Solr instance. * Tries to stop a Solr instance.
* * <p/>
* Waits for the stop command to finish before returning. * Waits for the stop command to finish before returning.
*/ */
synchronized void stop() { synchronized void stop() {
@ -532,7 +550,8 @@ class Server {
// TODO: check if SocketExceptions should actually happen (is // TODO: check if SocketExceptions should actually happen (is
// probably caused by starting a connection as the server finishes // probably caused by starting a connection as the server finishes
// shutting down) // shutting down)
if (cause instanceof ConnectException || cause instanceof SocketException) { //|| cause instanceof NoHttpResponseException) { if (cause instanceof ConnectException
|| cause instanceof SocketException) { //|| cause instanceof NoHttpResponseException) {
logger.log(Level.INFO, "Solr server is not running, cause: " + cause.getMessage()); logger.log(Level.INFO, "Solr server is not running, cause: " + cause.getMessage());
return false; return false;
} else { } else {
@ -544,6 +563,7 @@ class Server {
return true; return true;
} }
/** /**
* ** Convenience methods for use while we only open one case at a time *** * ** Convenience methods for use while we only open one case at a time ***
*/ */
@ -775,7 +795,8 @@ class Server {
* @throws KeywordSearchModuleException * @throws KeywordSearchModuleException
* @throws NoOpenCoreException * @throws NoOpenCoreException
*/ */
public QueryResponse query(SolrQuery sq, SolrRequest.METHOD method) throws KeywordSearchModuleException, NoOpenCoreException { public QueryResponse query(SolrQuery sq, SolrRequest.METHOD method)
throws KeywordSearchModuleException, NoOpenCoreException {
if (currentCore == null) { if (currentCore == null) {
throw new NoOpenCoreException(); throw new NoOpenCoreException();
} }
@ -958,16 +979,21 @@ class Server {
try { try {
solrCore.add(doc); solrCore.add(doc);
} catch (SolrServerException ex) { } catch (SolrServerException ex) {
logger.log(Level.SEVERE, "Could not add document to index via update handler: " + doc.getField("id"), ex); logger.log(Level.SEVERE, "Could not add document to index via update handler: " + doc.getField("id"),
throw new KeywordSearchModuleException("Could not add document to index via update handler: " + doc.getField("id"), ex); ex);
throw new KeywordSearchModuleException(
"Could not add document to index via update handler: " + doc.getField("id"), ex);
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.SEVERE, "Could not add document to index via update handler: " + doc.getField("id"), ex); logger.log(Level.SEVERE, "Could not add document to index via update handler: " + doc.getField("id"),
throw new KeywordSearchModuleException("Could not add document to index via update handler: " + doc.getField("id"), ex); ex);
throw new KeywordSearchModuleException(
"Could not add document to index via update handler: " + doc.getField("id"), ex);
} }
} }
/** /**
* get the text from the content field for the given file * get the text from the content field for the given file
*
* @param contentID * @param contentID
* @param chunkID * @param chunkID
* @return * @return

View File

@ -26,9 +26,12 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException; import java.util.regex.PatternSyntaxException;
import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.response.TermsResponse; import org.apache.solr.client.solrj.response.TermsResponse;
@ -167,7 +170,8 @@ class TermComponentQuery implements KeywordSearchQuery {
} }
@Override @Override
public KeywordWriteResult writeToBlackBoard(String termHit, AbstractFile newFsHit, String snippet, String listName) { public KeywordWriteResult writeToBlackBoard(String termHit, AbstractFile newFsHit, String snippet,
String listName) {
final String MODULE_NAME = KeywordSearchIngestModule.MODULE_NAME; final String MODULE_NAME = KeywordSearchIngestModule.MODULE_NAME;
//there is match actually in this file, create artifact only then //there is match actually in this file, create artifact only then
@ -193,7 +197,8 @@ class TermComponentQuery implements KeywordSearchQuery {
//preview //preview
if (snippet != null) { if (snippet != null) {
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD_PREVIEW.getTypeID(), MODULE_NAME, snippet)); attributes
.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD_PREVIEW.getTypeID(), MODULE_NAME, snippet));
} }
//regex keyword //regex keyword
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD_REGEXP.getTypeID(), MODULE_NAME, termsQuery)); attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD_REGEXP.getTypeID(), MODULE_NAME, termsQuery));

View File

@ -19,6 +19,7 @@
package org.sleuthkit.autopsy.keywordsearch; package org.sleuthkit.autopsy.keywordsearch;
import java.util.logging.Level; import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardArtifact;
@ -53,7 +54,9 @@ class TikaLanguageIdentifier implements TextLanguageIdentifier {
genInfo.addAttribute(textLang); genInfo.addAttribute(textLang);
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
logger.log(Level.WARNING, "failed to add TSK_TEXT_LANGUAGE attribute to TSK_GEN_INFO artifact for file: " + sourceFile.getName(), ex); logger.log(Level.WARNING,
"failed to add TSK_TEXT_LANGUAGE attribute to TSK_GEN_INFO artifact for file: " + sourceFile
.getName(), ex);
} }
} }

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
@HelpSetRegistration(helpSet = "keywordsearch-hs.xml", position = 3521) @HelpSetRegistration(helpSet = "keywordsearch-hs.xml",
package org.sleuthkit.autopsy.keywordsearch.docs; position = 3521) package org.sleuthkit.autopsy.keywordsearch.docs;
import org.netbeans.api.javahelp.HelpSetRegistration; import org.netbeans.api.javahelp.HelpSetRegistration;

View File

@ -10,7 +10,8 @@
<file name="org-sleuthkit-autopsy-keywordsearch-KeywordSearchConfigurationAction.instance"/> <file name="org-sleuthkit-autopsy-keywordsearch-KeywordSearchConfigurationAction.instance"/>
<file name="org-sleuthkit-autopsy-keywordsearch-KeywordSearchAction.instance"> <file name="org-sleuthkit-autopsy-keywordsearch-KeywordSearchAction.instance">
<attr name="delegate" newvalue="org.sleuthkit.autopsy.keywordsearch.KeywordSearchAction"/> <attr name="delegate" newvalue="org.sleuthkit.autopsy.keywordsearch.KeywordSearchAction"/>
<attr name="displayName" bundlevalue="org.sleuthkit.autopsy.keywordsearch.Bundle#CTL_KeywordSearchAction"/> <attr name="displayName"
bundlevalue="org.sleuthkit.autopsy.keywordsearch.Bundle#CTL_KeywordSearchAction"/>
</file> </file>
</folder> </folder>
</folder> </folder>
@ -21,7 +22,8 @@
<folder name="Services"> <folder name="Services">
<file name="org-sleuthkit-autopsy-keywordsearch-HighlightedMatchesSource.instance"> <file name="org-sleuthkit-autopsy-keywordsearch-HighlightedMatchesSource.instance">
<attr name="instanceOf" stringvalue="org.sleuthkit.autopsy.datamodel.HighlightLookup"/> <attr name="instanceOf" stringvalue="org.sleuthkit.autopsy.datamodel.HighlightLookup"/>
<attr name="instanceCreate" methodvalue="org.sleuthkit.autopsy.keywordsearch.HighlightedMatchesSource.getDefault"/> <attr name="instanceCreate"
methodvalue="org.sleuthkit.autopsy.keywordsearch.HighlightedMatchesSource.getDefault"/>
<attr name="position" intvalue="250"/> <attr name="position" intvalue="250"/>
</file> </file>
</folder> </folder>
@ -33,7 +35,8 @@
<folder name="Keyword"> <folder name="Keyword">
<attr name="position" intvalue="104"/> <attr name="position" intvalue="104"/>
<file name="org-sleuthkit-autopsy-keywordsearch-KeywordSearchAction.shadow"> <file name="org-sleuthkit-autopsy-keywordsearch-KeywordSearchAction.shadow">
<attr name="originalFile" stringvalue="Actions/Tools/org-sleuthkit-autopsy-keywordsearch-KeywordSearchAction.instance"/> <attr name="originalFile"
stringvalue="Actions/Tools/org-sleuthkit-autopsy-keywordsearch-KeywordSearchAction.instance"/>
</file> </file>
</folder> </folder>
</folder> </folder>