Merge branch 'master' of github.com:sleuthkit/autopsy

This commit is contained in:
Brian Carrier 2012-06-05 18:12:51 -04:00
commit 36cafdec01
25 changed files with 264 additions and 220 deletions

View File

@ -6,6 +6,9 @@
</Component>
</NonVisualComponents>
<Properties>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[559, 328]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[588, 308]"/>
</Property>
@ -28,14 +31,6 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="noProcessUnallocSpace" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="imgPathLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="imgPathTextField" min="-2" pref="389" max="-2" attributes="1"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="imgPathBrowserButton" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="imgTypeLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="10" pref="10" max="10" attributes="0"/>
@ -49,16 +44,30 @@
<Component id="imgInfoLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="optionsLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="10" pref="10" max="10" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="noFatOrphansCheckbox" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="noProcessUnallocSpace" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
<Group type="102" attributes="1">
<Group type="102" alignment="0" attributes="1">
<Component id="timeZoneLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="timeZoneComboBox" min="-2" pref="253" max="-2" attributes="0"/>
</Group>
<Component id="noFatOrphansCheckbox" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="imgPathLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="imgPathTextField" min="-2" pref="389" max="-2" attributes="1"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="imgPathBrowserButton" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace pref="39" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -83,21 +92,16 @@
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="multipleSelectLabel" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="timeZoneLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="timeZoneComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="28" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="noProcessUnallocSpace" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="timeZoneLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="timeZoneComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<Component id="optionsLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="noProcessUnallocSpace" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
<Component id="noFatOrphansCheckbox" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
@ -251,5 +255,12 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="noProcessUnallocSpaceActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="optionsLabel1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageVisualPanel1.optionsLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -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;

View File

@ -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):

View File

@ -24,14 +24,13 @@
<Component id="jScrollPane1" alignment="1" pref="274" max="32767" attributes="1"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="10" pref="10" max="10" attributes="0"/>
<Component id="nsrlNameLabel" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="143" max="32767" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="159" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="53" max="-2" attributes="0"/>
<Component id="nsrlNameLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="110" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -39,9 +38,9 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="nsrlNameLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="106" max="32767" attributes="0"/>

View File

@ -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();
}
}
}

View File

@ -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

View File

@ -43,13 +43,13 @@
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="hitLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="hitCountLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="hitCountLabel" min="-2" pref="26" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="hitOfLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="hitTotalLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
<Component id="hitTotalLabel" min="-2" pref="34" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="hitButtonsLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="hitPreviousButton" min="-2" pref="23" max="-2" attributes="0"/>

View File

@ -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)

View File

@ -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);

View File

@ -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 {

View File

@ -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

View File

@ -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;
}
}
}

View File

@ -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<ContentHit> 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;

View File

@ -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<Term> 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<String, List<ContentHit>> performQuery() throws NoOpenCoreException{
public Map<String, List<ContentHit>> performQuery() throws NoOpenCoreException {
Map<String, List<ContentHit>> results = new HashMap<String, List<ContentHit>>();
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<String, List<ContentHit>> subResults = filesQuery.performQuery();
Set<ContentHit> filesResults = new HashSet<ContentHit>();
@ -248,12 +238,10 @@ public class TermComponentQuery implements KeywordSearchQuery {
filesResults.addAll(subResults.get(key));
}
results.put(term.getTerm(), new ArrayList<ContentHit>(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;
}
}

View File

@ -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;

View File

@ -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

View File

@ -137,6 +137,14 @@
<runtime-relative-path>ext/junit-3.8.1.jar</runtime-relative-path>
<binary-origin>release/modules/ext/junit-3.8.1.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/commons-logging-1.1.1.jar</runtime-relative-path>
<binary-origin>release/modules/ext/commons-logging-1.1.1.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/commons-lang-2.4.jar</runtime-relative-path>
<binary-origin>release/modules/ext/commons-lang-2.4.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/poi-ooxml-schemas-3.8-20120326.jar</runtime-relative-path>
<binary-origin>release/modules/ext/poi-ooxml-schemas-3.8-20120326.jar</binary-origin>
@ -165,10 +173,6 @@
<runtime-relative-path>ext/stax-api-1.0.1.jar</runtime-relative-path>
<binary-origin>release/modules/ext/stax-api-1.0.1.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/commons-logging-1.1.jar</runtime-relative-path>
<binary-origin>release/modules/ext/commons-logging-1.1.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/log4j-1.2.13.jar</runtime-relative-path>
<binary-origin>release/modules/ext/log4j-1.2.13.jar</binary-origin>
@ -177,10 +181,6 @@
<runtime-relative-path>ext/xmlbeans-2.3.0.jar</runtime-relative-path>
<binary-origin>release/modules/ext/xmlbeans-2.3.0.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/commons-lang3-3.1.jar</runtime-relative-path>
<binary-origin>release/modules/ext/commons-lang3-3.1.jar</binary-origin>
</class-path-extension>
</data>
</configuration>
</project>

Binary file not shown.

Binary file not shown.

View File

@ -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, "<br>", 30);
attributes.put(type, value);
attributes.put(type, StringEscapeUtils.escapeHtml(value));
}

View File

@ -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<Integer, String> attributes = new TreeMap<Integer, String>();
// 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()));
}

View File

@ -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);

View File

@ -1,71 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
<!-- for some information on what you could do (e.g. targets to override). -->
<!-- If you delete this file and reopen the project it will be recreated. -->
<project name="org.sleuthkit.autopsy.testing" default="netbeans" basedir=".">
<description>Builds, tests, and runs the project org.sleuthkit.autopsy.testing.</description>
<import file="nbproject/build-impl.xml"/>
<target name="set-args">
<property name="img_path" value="C:\Users\dfickling\Desktop\test-data\64mb2.img"/>
<property name="known_bad_path" value="C:\Users\dfickling\Desktop\test-data\notable_files.txt"/>
<property name="nsrl_path" value="C:\Users\dfickling\Desktop\NSRLComplete.txt-md5.idx"/>
<property name="keyword_path" value="C:\Users\dfickling\Desktop\test-data\notable_words.xml"/>
<property name="gold_path" value="C:\Users\dfickling\Desktop\test-data\win7-ren.txt"/>
<property name="out_path" value="C:\Users\dfickling\Desktop\test-data"/>
</target>
<target name="check-args"> <!-- remove dependency on set-args to get from script -->
<fail message="Missing required argument: img_path" unless="img_path"/>
<fail message="Missing required argument: gold_path" unless="gold_path"/>
<fail message="Missing required argument: out_path" unless="out_path"/>
<fail message="Missing required argument: known_bad_path" unless="known_bad_path"/>
<fail message="Missing required argument: nsrl_path" unless="nsrl_path"/>
<fail message="Missing required argument: keyword_path" unless="keyword_path"/>
</target>
<target name="regression-test" depends="check-args,init,test-init,test-build" if="exists.test.qa-functional.src.dir">
<test test.type="qa-functional"/>
</target>
<macrodef name="test">
<attribute name="test.type"/>
<attribute name="disable.apple.ui" default="false"/>
<sequential>
<property name="test.config" value="default"/>
<property name="test.config.default.includes" value="**/*Test.class"/>
<property name="test.config.${test.config}.includes" value="NOTHING"/>
<metaproperty name="test.includes" value="test.config.${test.config}.includes"/>
<property name="test.config.${test.config}.excludes" value=""/>
<metaproperty name="test.excludes" value="test.config.${test.config}.excludes"/>
<mkdir dir="${build.test.@{test.type}.results.dir}"/>
<junit fork="true" failureproperty="tests.failed" errorproperty="tests.failed" filtertrace="${test.filter.trace}" tempdir="${build.test.@{test.type}.results.dir}">
<batchtest todir="${build.test.@{test.type}.results.dir}">
<fileset dir="${build.test.@{test.type}.classes.dir}" includes="${test.includes}" excludes="${test.excludes}"/>
</batchtest>
<classpath refid="test.@{test.type}.run.cp"/>
<syspropertyset refid="test.@{test.type}.properties"/>
<jvmarg line="${test.bootclasspath.prepend.args}"/>
<jvmarg line="${test.run.args}"/>
<sysproperty key="img_path" value="${img_path}"/>
<sysproperty key="gold_path" value="${gold_path}"/>
<sysproperty key="out_path" value="${out_path}"/>
<sysproperty key="known_bad_path" value="${known_bad_path}"/>
<sysproperty key="nsrl_path" value="${nsrl_path}"/>
<sysproperty key="keyword_path" value="${keyword_path}"/>
<!--needed to have tests NOT to steal focus when running, works in latest apple jdk update only.-->
<sysproperty key="apple.awt.UIElement" value="@{disable.apple.ui}"/>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
</junit>
<fail message="Some tests failed; see details above.">
<condition>
<and>
<isset property="tests.failed"/>
<isfalse value="${continue.after.failing.tests}"/>
</and>
</condition>
</fail>
</sequential>
</macrodef>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
<!-- for some information on what you could do (e.g. targets to override). -->
<!-- If you delete this file and reopen the project it will be recreated. -->
<project name="org.sleuthkit.autopsy.testing" default="netbeans" basedir=".">
<description>Builds, tests, and runs the project org.sleuthkit.autopsy.testing.</description>
<import file="nbproject/build-impl.xml"/>
<target name="set-args">
<property name="img_path" value="C:\Users\dfickling\Desktop\test-data\64mb2.img"/>
<property name="known_bad_path" value="C:\Users\dfickling\Desktop\test-data\notable_files.txt"/>
<property name="nsrl_path" value="C:\Users\dfickling\Desktop\NSRLComplete.txt-md5.idx"/>
<property name="keyword_path" value="C:\Users\dfickling\Desktop\test-data\notable_words.xml"/>
<property name="gold_path" value="C:\Users\dfickling\Desktop\test-data\win7-ren.txt"/>
<property name="out_path" value="C:\Users\dfickling\Desktop\test-data"/>
</target>
<target name="check-args"> <!-- remove dependency on set-args to get from script -->
<fail message="Missing required argument: img_path" unless="img_path"/>
<fail message="Missing required argument: gold_path" unless="gold_path"/>
<fail message="Missing required argument: out_path" unless="out_path"/>
<fail message="Missing required argument: known_bad_path" unless="known_bad_path"/>
<fail message="Missing required argument: nsrl_path" unless="nsrl_path"/>
<fail message="Missing required argument: keyword_path" unless="keyword_path"/>
</target>
<target name="regression-test" depends="check-args,init,test-init,test-build" if="exists.test.qa-functional.src.dir">
<test test.type="qa-functional"/>
</target>
<macrodef name="test">
<attribute name="test.type"/>
<attribute name="disable.apple.ui" default="false"/>
<sequential>
<property name="test.config" value="default"/>
<property name="test.config.default.includes" value="**/*Test.class"/>
<property name="test.config.${test.config}.includes" value="NOTHING"/>
<metaproperty name="test.includes" value="test.config.${test.config}.includes"/>
<property name="test.config.${test.config}.excludes" value=""/>
<metaproperty name="test.excludes" value="test.config.${test.config}.excludes"/>
<mkdir dir="${build.test.@{test.type}.results.dir}"/>
<junit fork="true" failureproperty="tests.failed" errorproperty="tests.failed" filtertrace="${test.filter.trace}" tempdir="${build.test.@{test.type}.results.dir}">
<batchtest todir="${build.test.@{test.type}.results.dir}">
<fileset dir="${build.test.@{test.type}.classes.dir}" includes="${test.includes}" excludes="${test.excludes}"/>
</batchtest>
<classpath refid="test.@{test.type}.run.cp"/>
<syspropertyset refid="test.@{test.type}.properties"/>
<jvmarg line="${test.bootclasspath.prepend.args}"/>
<jvmarg line="${test.run.args}"/>
<jvmarg line="-Xmx1024m"/>
<sysproperty key="img_path" value="${img_path}"/>
<sysproperty key="gold_path" value="${gold_path}"/>
<sysproperty key="out_path" value="${out_path}"/>
<sysproperty key="known_bad_path" value="${known_bad_path}"/>
<sysproperty key="nsrl_path" value="${nsrl_path}"/>
<sysproperty key="keyword_path" value="${keyword_path}"/>
<!--needed to have tests NOT to steal focus when running, works in latest apple jdk update only.-->
<sysproperty key="apple.awt.UIElement" value="@{disable.apple.ui}"/>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
</junit>
<fail message="Some tests failed; see details above.">
<condition>
<and>
<isset property="tests.failed"/>
<isfalse value="${continue.after.failing.tests}"/>
</and>
</condition>
</fail>
</sequential>
</macrodef>
</project>