diff --git a/Case/src/org/sleuthkit/autopsy/casemodule/AddImageVisualPanel1.form b/Case/src/org/sleuthkit/autopsy/casemodule/AddImageVisualPanel1.form index ec8cbfdcfc..5f37df3806 100644 --- a/Case/src/org/sleuthkit/autopsy/casemodule/AddImageVisualPanel1.form +++ b/Case/src/org/sleuthkit/autopsy/casemodule/AddImageVisualPanel1.form @@ -6,6 +6,9 @@ + + + @@ -28,14 +31,6 @@ - - - - - - - - @@ -49,16 +44,30 @@ + + + + + + + + - + - + + + + + + + - + @@ -83,21 +92,16 @@ - - - - - - - - - - - - - - + + + + + + + + + @@ -251,5 +255,12 @@ + + + + + + + diff --git a/Case/src/org/sleuthkit/autopsy/casemodule/AddImageVisualPanel1.java b/Case/src/org/sleuthkit/autopsy/casemodule/AddImageVisualPanel1.java index 83ead501b3..7fc06a34bc 100644 --- a/Case/src/org/sleuthkit/autopsy/casemodule/AddImageVisualPanel1.java +++ b/Case/src/org/sleuthkit/autopsy/casemodule/AddImageVisualPanel1.java @@ -222,7 +222,9 @@ final class AddImageVisualPanel1 extends JPanel implements DocumentListener { jLabel2 = new javax.swing.JLabel(); noFatOrphansCheckbox = new javax.swing.JCheckBox(); noProcessUnallocSpace = new javax.swing.JCheckBox(); + optionsLabel1 = new javax.swing.JLabel(); + setMinimumSize(new java.awt.Dimension(559, 328)); setPreferredSize(new java.awt.Dimension(588, 308)); org.openide.awt.Mnemonics.setLocalizedText(rawSingle, org.openide.util.NbBundle.getMessage(AddImageVisualPanel1.class, "AddImageVisualPanel1.rawSingle.text")); // NOI18N @@ -286,6 +288,8 @@ final class AddImageVisualPanel1 extends JPanel implements DocumentListener { } }); + org.openide.awt.Mnemonics.setLocalizedText(optionsLabel1, org.openide.util.NbBundle.getMessage(AddImageVisualPanel1.class, "AddImageVisualPanel1.optionsLabel1.text")); // NOI18N + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -293,13 +297,6 @@ final class AddImageVisualPanel1 extends JPanel implements DocumentListener { .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(noProcessUnallocSpace) - .addGroup(layout.createSequentialGroup() - .addComponent(imgPathLabel) - .addGap(18, 18, 18) - .addComponent(imgPathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 389, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(imgPathBrowserButton)) .addComponent(imgTypeLabel) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) @@ -311,13 +308,24 @@ final class AddImageVisualPanel1 extends JPanel implements DocumentListener { .addComponent(imgInfoLabel) .addComponent(jLabel1) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(optionsLabel1) + .addGroup(layout.createSequentialGroup() + .addGap(10, 10, 10) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(noFatOrphansCheckbox) + .addComponent(noProcessUnallocSpace))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) - .addGroup(layout.createSequentialGroup() + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(timeZoneLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(timeZoneComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 253, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(noFatOrphansCheckbox, javax.swing.GroupLayout.Alignment.LEADING))) - .addContainerGap(39, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(imgPathLabel) + .addGap(18, 18, 18) + .addComponent(imgPathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 389, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(imgPathBrowserButton)))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -339,17 +347,15 @@ final class AddImageVisualPanel1 extends JPanel implements DocumentListener { .addComponent(imgPathBrowserButton)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(multipleSelectLabel) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(layout.createSequentialGroup() - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(timeZoneLabel) - .addComponent(timeZoneComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)) - .addGroup(layout.createSequentialGroup() - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(noProcessUnallocSpace) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(timeZoneLabel) + .addComponent(timeZoneComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(optionsLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(noProcessUnallocSpace) + .addGap(3, 3, 3) .addComponent(noFatOrphansCheckbox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -484,6 +490,7 @@ private void noProcessUnallocSpaceActionPerformed(java.awt.event.ActionEvent evt private javax.swing.JLabel multipleSelectLabel; private javax.swing.JCheckBox noFatOrphansCheckbox; private javax.swing.JCheckBox noProcessUnallocSpace; + private javax.swing.JLabel optionsLabel1; private static javax.swing.JRadioButton rawSingle; private javax.swing.JRadioButton rawSplit; private javax.swing.JComboBox timeZoneComboBox; diff --git a/Case/src/org/sleuthkit/autopsy/casemodule/Bundle.properties b/Case/src/org/sleuthkit/autopsy/casemodule/Bundle.properties index d3f1b9ed07..36defd4ee3 100755 --- a/Case/src/org/sleuthkit/autopsy/casemodule/Bundle.properties +++ b/Case/src/org/sleuthkit/autopsy/casemodule/Bundle.properties @@ -125,5 +125,6 @@ NewCaseVisualPanel2.caseNumberLabel.text=Case Number: NewCaseVisualPanel2.examinerTextField.text= NewCaseVisualPanel2.optionalLabel.text=Optional: Set Case Number and Examiner AddImageVisualPanel1.noFatOrphansCheckbox.toolTipText= -AddImageVisualPanel1.noFatOrphansCheckbox.text=Disable in-depth file recovery of FAT file systems (faster results, but may miss deleted files) -AddImageVisualPanel1.noProcessUnallocSpace.text=Disable recovery of unallocated space +AddImageVisualPanel1.noFatOrphansCheckbox.text=Ignore orphan files in FAT file systems +AddImageVisualPanel1.noProcessUnallocSpace.text=Ignore unallocated space +AddImageVisualPanel1.optionsLabel1.text=Options to produce results faster (although some data will not be searched): diff --git a/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSimplePanel.form b/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSimplePanel.form index 73c556f986..12c08cd4fd 100644 --- a/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSimplePanel.form +++ b/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSimplePanel.form @@ -24,14 +24,13 @@ - - - - - - - - + + + + + + + @@ -39,9 +38,9 @@ - + - + diff --git a/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSimplePanel.java b/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSimplePanel.java index 0bba72d3b8..7094c420e9 100644 --- a/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSimplePanel.java +++ b/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSimplePanel.java @@ -112,12 +112,12 @@ public class HashDbSimplePanel extends javax.swing.JPanel { .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(10, 10, 10) - .addComponent(nsrlNameLabel)) - .addComponent(jLabel2)) - .addContainerGap(143, Short.MAX_VALUE)) + .addComponent(jLabel2) + .addContainerGap(159, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addGap(53, 53, 53) + .addComponent(nsrlNameLabel) + .addContainerGap(110, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -160,7 +160,8 @@ public class HashDbSimplePanel extends javax.swing.JPanel { @Override public int getRowCount() { - return xmlHandle.getKnownBadSets().size(); + int size = xmlHandle.getKnownBadSets().size(); + return size == 0 ? 1 : size; } @Override @@ -170,11 +171,19 @@ public class HashDbSimplePanel extends javax.swing.JPanel { @Override public Object getValueAt(int rowIndex, int columnIndex) { - HashDb db = xmlHandle.getKnownBadSets().get(rowIndex); - if(columnIndex == 0) { - return db.getUseForIngest(); + if (xmlHandle.getKnownBadSets().isEmpty()) { + if (columnIndex == 0) { + return ""; + } else { + return "No notable databases set."; + } } else { - return db.getName(); + HashDb db = xmlHandle.getKnownBadSets().get(rowIndex); + if (columnIndex == 0) { + return db.getUseForIngest(); + } else { + return db.getName(); + } } } diff --git a/KeywordSearch/nbproject/genfiles.properties b/KeywordSearch/nbproject/genfiles.properties index 6b82ce00cf..dd5d606393 100644 --- a/KeywordSearch/nbproject/genfiles.properties +++ b/KeywordSearch/nbproject/genfiles.properties @@ -3,6 +3,6 @@ build.xml.script.CRC32=87b97b04 build.xml.stylesheet.CRC32=a56c6a5b@1.46.2 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=d7ecf067 +nbproject/build-impl.xml.data.CRC32=ab518119 nbproject/build-impl.xml.script.CRC32=fe1f48d2 nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.46.2 diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentPanel.form b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentPanel.form index 94cd1e534e..ce852d2d5a 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentPanel.form +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentPanel.form @@ -43,13 +43,13 @@ - - + + - - + + diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentPanel.java index 820b4d860e..3050c7a88e 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentPanel.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentPanel.java @@ -225,13 +225,13 @@ class ExtractedContentPanel extends javax.swing.JPanel { .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(hitLabel) - .addGap(18, 18, 18) - .addComponent(hitCountLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(hitCountLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(hitOfLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(hitTotalLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(26, 26, 26) + .addComponent(hitTotalLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(hitButtonsLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(hitPreviousButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedMatchesSource.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedMatchesSource.java index dab04c0f8b..ea63ca407d 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedMatchesSource.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedMatchesSource.java @@ -321,14 +321,10 @@ class HighlightedMatchesSource implements MarkupSource, HighlightLookup { q.setQuery(sb.toString()); } else { //use default field, simplifies query - //quote only if user supplies quotes - q.setQuery(highlightQuery); + //always force grouping/quotes + q.setQuery(KeywordSearchUtil.quoteQuery(highlightQuery)); } - //if (isRegex) - // q.setQuery(highLightField + ":" + highlightQuery); - //else q.setQuery(highlightQuery); //use default field, simplifies query - final long contentId = content.getId(); String contentIdStr = Long.toString(contentId); diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchIngestService.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchIngestService.java index 7b484e7e34..9d5964d16a 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchIngestService.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchIngestService.java @@ -78,7 +78,7 @@ public final class KeywordSearchIngestService implements IngestServiceAbstractFi private volatile boolean finalSearcherDone = false; private final String hashDBServiceName = "Hash Lookup"; private SleuthkitCase caseHandle = null; - private boolean skipKnown = false; + private boolean skipKnown = true; boolean initialized = false; public enum IngestStatus { diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchQuery.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchQuery.java index 0705102117..e3735b7856 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchQuery.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchQuery.java @@ -48,6 +48,12 @@ public interface KeywordSearchQuery { */ public void setFilter(KeywordQueryFilter filter); + /** + * Set an optional field to narrow down the search + * @param field field to set on the query + */ + public void setField(String field); + /** * escape the query string and use the escaped string in the query diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchUtil.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchUtil.java index 5563195819..99d1a6c365 100755 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchUtil.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchUtil.java @@ -59,6 +59,24 @@ public class KeywordSearchUtil { return dirName; } + /** + * Return a quoted version of the query if the original query is not quoted + * @param query the query to check if it is quoted + * @return quoted query + */ + public static String quoteQuery(String query) { + //ensure a single pair of quotes around the query + final int length = query.length(); + if (length > 1 && query.charAt(0) == '"' + && query.charAt(length - 1) == '"') { + return query; + } + + StringBuilder sb = new StringBuilder(); + sb.append("\"").append(query).append("\""); + return sb.toString(); + } + /** * Perform standard escaping / encoding into UTF-8 before sending over net * @param query to be encoded @@ -143,5 +161,4 @@ public class KeywordSearchUtil { return false; } } - } diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/LuceneQuery.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/LuceneQuery.java index 88d05d8b49..ccbaf1e6be 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/LuceneQuery.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/LuceneQuery.java @@ -50,6 +50,7 @@ public class LuceneQuery implements KeywordSearchQuery { private boolean isEscaped; private Keyword keywordQuery = null; private KeywordQueryFilter filter = null; + private String field = null; //use different highlight Solr fields for regex and literal search static final String HIGHLIGHT_FIELD_LITERAL = Server.Schema.CONTENT.toString(); static final String HIGHLIGHT_FIELD_REGEX = Server.Schema.CONTENT.toString(); @@ -71,6 +72,11 @@ public class LuceneQuery implements KeywordSearchQuery { public void setFilter(KeywordQueryFilter filter) { this.filter = filter; } + + @Override + public void setField(String field) { + this.field = field; + } @Override public void escape() { @@ -164,11 +170,11 @@ public class LuceneQuery implements KeywordSearchQuery { return null; } + /** - * Just perform the query and return result without updating the GUI - * This utility is used in this class, can be potentially reused by other classes - * @param query - * @return matches List + * Perform the query and return result + * @return list of ContentHit objects + * @throws NoOpenCoreException */ private List performLuceneQuery() throws NoOpenCoreException { @@ -181,14 +187,22 @@ public class LuceneQuery implements KeywordSearchQuery { SolrQuery q = new SolrQuery(); - q.setQuery(queryEscaped); + //set query, force quotes/grouping around all literal queries + final String groupedQuery = KeywordSearchUtil.quoteQuery(queryEscaped); + String theQueryStr = groupedQuery; + if (field != null) { + //use the optional field + StringBuilder sb = new StringBuilder(); + sb.append(field).append(":").append(groupedQuery); + theQueryStr = sb.toString(); + } + q.setQuery(theQueryStr); q.setRows(ROWS_PER_FETCH); q.setFields(Server.Schema.ID.toString()); if (filter != null) { q.addFilterQuery(filter.toString()); } - for (int start = 0; !allMatchesFetched; start = start + ROWS_PER_FETCH) { q.setStart(start); @@ -247,7 +261,6 @@ public class LuceneQuery implements KeywordSearchQuery { throw ex; } catch (SolrServerException ex) { logger.log(Level.WARNING, "Error executing Lucene Solr Query: " + query, ex); - // TODO: handle bad query strings, among other issues } } @@ -303,8 +316,8 @@ public class LuceneQuery implements KeywordSearchQuery { q.setQuery(sb.toString()); } else { //simplify query/escaping and use default field - //quote only if user supplies quotes - q.setQuery(query); + //always force grouping/quotes + q.setQuery(KeywordSearchUtil.quoteQuery(query)); } String contentIDStr = null; diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/TermComponentQuery.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/TermComponentQuery.java index 14706bc190..8843cfbbb5 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/TermComponentQuery.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/TermComponentQuery.java @@ -22,35 +22,22 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.concurrent.ExecutionException; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; -import javax.swing.SwingWorker; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.response.TermsResponse; import org.apache.solr.client.solrj.response.TermsResponse.Term; -import org.netbeans.api.progress.ProgressHandle; -import org.netbeans.api.progress.ProgressHandleFactory; -import org.openide.nodes.AbstractNode; -import org.openide.nodes.Children; -import org.openide.nodes.Node; -import org.openide.windows.TopComponent; -import org.sleuthkit.autopsy.corecomponents.DataResultTopComponent; -import org.sleuthkit.autopsy.keywordsearch.KeywordSearchQueryManager.Presentation; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE; import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE; -import org.sleuthkit.datamodel.FsContent; import org.sleuthkit.datamodel.TskException; public class TermComponentQuery implements KeywordSearchQuery { @@ -67,6 +54,7 @@ public class TermComponentQuery implements KeywordSearchQuery { private List terms; private Keyword keywordQuery = null; private KeywordQueryFilter filter = null; + private String field = null; public TermComponentQuery(Keyword keywordQuery) { this.keywordQuery = keywordQuery; @@ -76,12 +64,16 @@ public class TermComponentQuery implements KeywordSearchQuery { terms = null; } - @Override public void setFilter(KeywordQueryFilter filter) { this.filter = filter; } - + + @Override + public void setField(String field) { + this.field = field; + } + @Override public void escape() { queryEscaped = Pattern.quote(termsQuery); @@ -109,7 +101,7 @@ public class TermComponentQuery implements KeywordSearchQuery { public boolean isEscaped() { return isEscaped; } - + @Override public boolean isLiteral() { return false; @@ -224,7 +216,7 @@ public class TermComponentQuery implements KeywordSearchQuery { } @Override - public Map> performQuery() throws NoOpenCoreException{ + public Map> performQuery() throws NoOpenCoreException { Map> results = new HashMap>(); final SolrQuery q = createQuery(); @@ -232,15 +224,13 @@ public class TermComponentQuery implements KeywordSearchQuery { for (Term term : terms) { - final String termS = KeywordSearchUtil.escapeLuceneQuery(term.getTerm(), true, false); + final String termStr = KeywordSearchUtil.escapeLuceneQuery(term.getTerm(), true, false); - StringBuilder filesQueryB = new StringBuilder(); - filesQueryB.append(TERMS_SEARCH_FIELD).append(":").append(termS); - final String queryStr = filesQueryB.toString(); - - LuceneQuery filesQuery = new LuceneQuery(queryStr); - if (filter != null) + LuceneQuery filesQuery = new LuceneQuery(termStr); + filesQuery.setField(TERMS_SEARCH_FIELD); + if (filter != null) { filesQuery.setFilter(filter); + } try { Map> subResults = filesQuery.performQuery(); Set filesResults = new HashSet(); @@ -248,12 +238,10 @@ public class TermComponentQuery implements KeywordSearchQuery { filesResults.addAll(subResults.get(key)); } results.put(term.getTerm(), new ArrayList(filesResults)); - } - catch (NoOpenCoreException e) { + } catch (NoOpenCoreException e) { logger.log(Level.WARNING, "Error executing Solr query,", e); throw e; - } - catch (RuntimeException e) { + } catch (RuntimeException e) { logger.log(Level.WARNING, "Error executing Solr query,", e); } @@ -262,5 +250,4 @@ public class TermComponentQuery implements KeywordSearchQuery { return results; } - } diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractIE.java b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractIE.java index 95bd4c010a..17ab6ac770 100755 --- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractIE.java +++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractIE.java @@ -44,7 +44,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; // TSK Imports -import javax.swing.JPanel; import org.openide.modules.InstalledFileLocator; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.datamodel.ContentUtils; diff --git a/Report/nbproject/project.properties b/Report/nbproject/project.properties index 256c008f13..7e9bd4ee54 100644 --- a/Report/nbproject/project.properties +++ b/Report/nbproject/project.properties @@ -1,4 +1,3 @@ -file.reference.commons-logging-1.1.jar=release/modules/ext/commons-logging-1.1.jar file.reference.dom4j-1.6.1.jar=release/modules/ext/dom4j-1.6.1.jar file.reference.jdom-1.1.2.jar=release/modules/ext/jdom-1.1.2.jar file.reference.junit-3.8.1.jar=release/modules/ext/junit-3.8.1.jar diff --git a/Report/nbproject/project.xml b/Report/nbproject/project.xml index 2ffc954210..8e42e477d1 100644 --- a/Report/nbproject/project.xml +++ b/Report/nbproject/project.xml @@ -137,6 +137,14 @@ ext/junit-3.8.1.jar release/modules/ext/junit-3.8.1.jar + + ext/commons-logging-1.1.1.jar + release/modules/ext/commons-logging-1.1.1.jar + + + ext/commons-lang-2.4.jar + release/modules/ext/commons-lang-2.4.jar + ext/poi-ooxml-schemas-3.8-20120326.jar release/modules/ext/poi-ooxml-schemas-3.8-20120326.jar @@ -165,10 +173,6 @@ ext/stax-api-1.0.1.jar release/modules/ext/stax-api-1.0.1.jar - - ext/commons-logging-1.1.jar - release/modules/ext/commons-logging-1.1.jar - ext/log4j-1.2.13.jar release/modules/ext/log4j-1.2.13.jar @@ -177,10 +181,6 @@ ext/xmlbeans-2.3.0.jar release/modules/ext/xmlbeans-2.3.0.jar - - ext/commons-lang3-3.1.jar - release/modules/ext/commons-lang3-3.1.jar - diff --git a/Report/release/modules/ext/commons-lang-2.4.jar b/Report/release/modules/ext/commons-lang-2.4.jar new file mode 100644 index 0000000000..532939ecab Binary files /dev/null and b/Report/release/modules/ext/commons-lang-2.4.jar differ diff --git a/Report/release/modules/ext/commons-lang3-3.1.jar b/Report/release/modules/ext/commons-lang3-3.1.jar deleted file mode 100644 index a85e539b17..0000000000 Binary files a/Report/release/modules/ext/commons-lang3-3.1.jar and /dev/null differ diff --git a/Report/release/modules/ext/commons-logging-1.1.1.jar b/Report/release/modules/ext/commons-logging-1.1.1.jar new file mode 100644 index 0000000000..1deef144cb Binary files /dev/null and b/Report/release/modules/ext/commons-logging-1.1.1.jar differ diff --git a/Report/release/modules/ext/commons-logging-1.1.jar b/Report/release/modules/ext/commons-logging-1.1.jar deleted file mode 100644 index 2ff9bbd90d..0000000000 Binary files a/Report/release/modules/ext/commons-logging-1.1.jar and /dev/null differ diff --git a/Report/src/org/sleuthkit/autopsy/report/ReportHTML.java b/Report/src/org/sleuthkit/autopsy/report/ReportHTML.java index 99b5f172b9..f88af81995 100644 --- a/Report/src/org/sleuthkit/autopsy/report/ReportHTML.java +++ b/Report/src/org/sleuthkit/autopsy/report/ReportHTML.java @@ -34,7 +34,7 @@ import java.util.Map.Entry; import java.util.TreeMap; import java.util.logging.Level; import java.util.logging.Logger; -import org.openide.util.Exceptions; +import org.apache.commons.lang.StringEscapeUtils; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.datamodel.*; @@ -281,11 +281,10 @@ public class ReportHTML implements ReportModule { String value = ""; Integer type = tempatt.getAttributeTypeID(); if (type.equals(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME.getTypeID()) || type.equals(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LAST_ACCESSED.getTypeID())) { - try { + SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); - value = sdf.format(new java.util.Date((tempatt.getValueLong()))); - } catch (Exception ex) { - } + value = sdf.format(new java.util.Date((tempatt.getValueLong() * 1000))); + } else { value = tempatt.getValueString(); } @@ -293,7 +292,7 @@ public class ReportHTML implements ReportModule { value = ""; } value = ReportUtils.insertPeriodically(value, "
", 30); - attributes.put(type, value); + attributes.put(type, StringEscapeUtils.escapeHtml(value)); } diff --git a/Report/src/org/sleuthkit/autopsy/report/ReportXLS.java b/Report/src/org/sleuthkit/autopsy/report/ReportXLS.java index 0d4c5a93fe..bc5b754f91 100644 --- a/Report/src/org/sleuthkit/autopsy/report/ReportXLS.java +++ b/Report/src/org/sleuthkit/autopsy/report/ReportXLS.java @@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.report; import java.awt.Desktop; -import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.File; @@ -34,6 +33,7 @@ import java.util.Map.Entry; import java.util.TreeMap; import java.util.logging.Level; import java.util.logging.Logger; +import org.apache.commons.lang.StringEscapeUtils; import org.apache.poi.ss.usermodel.*; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.sleuthkit.autopsy.casemodule.Case; @@ -214,7 +214,7 @@ public class ReportXLS implements ReportModule { sheetKeyword.getRow(0).createCell(0).setCellValue("Keyword"); sheetKeyword.getRow(0).createCell(1).setCellValue("File Name"); sheetKeyword.getRow(0).createCell(2).setCellValue("Preview"); - sheetKeyword.getRow(0).createCell(3).setCellValue("Keyword LIst"); + sheetKeyword.getRow(0).createCell(3).setCellValue("Keyword List"); sheetRecent.setDefaultColumnStyle(1, defaultstyle); sheetRecent.createRow(0).setRowStyle(style); @@ -283,6 +283,7 @@ public class ReportXLS implements ReportModule { int cc = 0; Long objId = entry.getKey().getObjectID(); AbstractFile file = skCase.getAbstractFileById(objId); + String filename = file.getName(); Long filesize = file.getSize(); TreeMap attributes = new TreeMap(); // Get all the attributes, line them up to be added. Place empty string placeholders for each attribute type @@ -297,14 +298,13 @@ public class ReportXLS implements ReportModule { } String value = ""; int type = tempatt.getAttributeTypeID(); - if (tempatt.getValueString() == null || "null".equals(tempatt.getValueString())) { - } else if (type == 2 || type == 33) { - value = new java.text.SimpleDateFormat("MM/dd/yyyy HH:mm:ss").format(new java.util.Date((tempatt.getValueLong()) * 1000)); + if (tempatt.getAttributeTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME.getTypeID() || tempatt.getAttributeTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LAST_ACCESSED.getTypeID()) { + value = new java.text.SimpleDateFormat("MM/dd/yyyy HH:mm:ss").format(new java.util.Date((tempatt.getValueLong()) * 1000)).toString(); } else { value = tempatt.getValueString(); } - attributes.put(type, value); + attributes.put(type, StringEscapeUtils.escapeXml(value)); cc++; } @@ -368,7 +368,7 @@ public class ReportXLS implements ReportModule { countedKeyword++; Row temp = sheetKeyword.createRow(countedKeyword); temp.createCell(0).setCellValue(attributes.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD.getTypeID())); - temp.createCell(1).setCellValue(attributes.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME.getTypeID())); + temp.createCell(1).setCellValue(filename); temp.createCell(2).setCellValue(attributes.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_PREVIEW.getTypeID())); temp.createCell(3).setCellValue(attributes.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID())); } diff --git a/Report/src/org/sleuthkit/autopsy/report/ReportXML.java b/Report/src/org/sleuthkit/autopsy/report/ReportXML.java index 5278b41c2a..ed199bda47 100644 --- a/Report/src/org/sleuthkit/autopsy/report/ReportXML.java +++ b/Report/src/org/sleuthkit/autopsy/report/ReportXML.java @@ -32,7 +32,7 @@ import java.util.Map.Entry; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; -import org.apache.commons.lang3.StringEscapeUtils; +import org.apache.commons.lang.StringEscapeUtils; import org.jdom.Comment; import org.jdom.Document; import org.jdom.Element; @@ -129,7 +129,7 @@ public class ReportXML implements ReportModule { Element attribute = new Element("Attribute").setAttribute("Type", tempatt.getAttributeTypeDisplayName()); String tempvalue = tempatt.getValueString(); //INVALID_XML_CHARS.matcher(tempvalue).replaceAll(""); - Element value = new Element("Value").setText(tempvalue); + Element value = new Element("Value").setText(StringEscapeUtils.escapeXml(tempvalue)); attribute.addContent(value); Element context = new Element("Context").setText(StringEscapeUtils.escapeXml(tempatt.getContext())); attribute.addContent(context); diff --git a/Testing/build.xml b/Testing/build.xml index da9b6c050e..88f00eafd8 100644 --- a/Testing/build.xml +++ b/Testing/build.xml @@ -1,71 +1,72 @@ - - - - - - Builds, tests, and runs the project org.sleuthkit.autopsy.testing. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + Builds, tests, and runs the project org.sleuthkit.autopsy.testing. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +