This commit is contained in:
unknown 2012-03-02 15:36:31 -05:00
commit 569d4b47d3
11 changed files with 71 additions and 68 deletions

View File

@ -39,7 +39,7 @@ public class ArtifactTypeNode extends AbstractNode implements DisplayableItemNod
int childCount = 0; int childCount = 0;
ArtifactTypeNode(BlackboardArtifact.ARTIFACT_TYPE type, SleuthkitCase skCase) { ArtifactTypeNode(BlackboardArtifact.ARTIFACT_TYPE type, SleuthkitCase skCase) {
super(Children.create(new ArtifactTypeChildren(type, skCase), true), Lookups.singleton(type)); super(Children.create(new ArtifactTypeChildren(type, skCase), true), Lookups.singleton(type.getDisplayName()));
super.setName(type.getLabel()); super.setName(type.getLabel());
// NOTE: This completely destroys our lazy-loading ideal // NOTE: This completely destroys our lazy-loading ideal
// a performance increase might be had by adding a // a performance increase might be had by adding a

View File

@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.datamodel;
import org.openide.nodes.AbstractNode; import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children; import org.openide.nodes.Children;
import org.openide.util.lookup.Lookups;
import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.SleuthkitCase;
/** /**
@ -31,7 +32,7 @@ public class ExtractedContentNode extends AbstractNode implements DisplayableIte
public static final String EXTRACTED_NAME = "Extracted Content"; public static final String EXTRACTED_NAME = "Extracted Content";
public ExtractedContentNode(SleuthkitCase skCase){ public ExtractedContentNode(SleuthkitCase skCase){
super(Children.create(new ExtractedContentChildren(skCase), true)); super(Children.create(new ExtractedContentChildren(skCase), true), Lookups.singleton(EXTRACTED_NAME));
super.setName(EXTRACTED_NAME); super.setName(EXTRACTED_NAME);
super.setDisplayName(EXTRACTED_NAME); super.setDisplayName(EXTRACTED_NAME);
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/artifact-icon.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/artifact-icon.png");

View File

@ -35,7 +35,7 @@ public class FileSearchFilterNode extends AbstractNode implements DisplayableIte
SleuthkitCase skCase; SleuthkitCase skCase;
FileSearchFilterNode(FileSearchFilter filter, SleuthkitCase skCase) { FileSearchFilterNode(FileSearchFilter filter, SleuthkitCase skCase) {
super(Children.create(new FileSearchFilterChildren(filter, skCase), true), Lookups.singleton(filter)); super(Children.create(new FileSearchFilterChildren(filter, skCase), true), Lookups.singleton(filter.getDisplayName()));
super.setName(filter.getName()); super.setName(filter.getName());
super.setDisplayName(filter.getDisplayName()); super.setDisplayName(filter.getDisplayName());
this.filter = filter; this.filter = filter;

View File

@ -29,26 +29,24 @@ public class RecentFiles implements AutopsyVisitableItem {
SleuthkitCase skCase; SleuthkitCase skCase;
public enum RecentFilesFilter implements AutopsyVisitableItem { public enum RecentFilesFilter implements AutopsyVisitableItem {
AUT_1DAY_FILTER(0, "AUT_1DAY_FILTER", "Last 1 Day", 1), AUT_0DAY_FILTER(0, "AUT_0DAY_FILTER", "Final Day", 0),
AUT_2DAY_FILTER(0, "AUT_2DAY_FILTER", "Last 2 Days", 2), AUT_1DAY_FILTER(0, "AUT_1DAY_FILTER", "Final Day - 1", 1),
AUT_3DAY_FILTER(0, "AUT_3DAY_FILTER", "Last 3 Days", 3), AUT_2DAY_FILTER(0, "AUT_2DAY_FILTER", "Final Day - 2", 2),
AUT_4DAY_FILTER(0, "AUT_4DAY_FILTER", "Last 4 Days", 4), AUT_3DAY_FILTER(0, "AUT_3DAY_FILTER", "Final Day - 3", 3),
AUT_5DAY_FILTER(0, "AUT_5DAY_FILTER", "Last 5 Days", 5), AUT_4DAY_FILTER(0, "AUT_4DAY_FILTER", "Final Day - 4", 4),
AUT_10DAY_FILTER(0, "AUT_10DAY_FILTER", "Last 10 Days", 10), AUT_5DAY_FILTER(0, "AUT_5DAY_FILTER", "Final Day - 5", 5),
AUT_15DAY_FILTER(0, "AUT_15DAY_FILTER", "Last 15 Days", 15); AUT_6DAY_FILTER(0, "AUT_6DAY_FILTER", "Final Day - 6", 6);
int id; private int id;
String name; private String name;
String displayName; private String displayName;
int durationDays; private int durationDays;
int durationSeconds;
private RecentFilesFilter(int id, String name, String displayName, int durationDays){ private RecentFilesFilter(int id, String name, String displayName, int durationDays){
this.id = id; this.id = id;
this.name = name; this.name = name;
this.displayName = displayName; this.displayName = displayName;
this.durationDays = durationDays; this.durationDays = durationDays;
this.durationSeconds = durationDays*60*60*24;
} }
public String getName(){ public String getName(){
@ -62,9 +60,9 @@ public class RecentFiles implements AutopsyVisitableItem {
public String getDisplayName(){ public String getDisplayName(){
return this.displayName; return this.displayName;
} }
public int getDurationSeconds() { public int getDurationDays() {
return this.durationSeconds; return this.durationDays;
} }
@Override @Override

View File

@ -22,6 +22,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -36,7 +37,7 @@ import org.sleuthkit.datamodel.SleuthkitCase;
public class RecentFilesChildren extends ChildFactory<RecentFiles.RecentFilesFilter>{ public class RecentFilesChildren extends ChildFactory<RecentFiles.RecentFilesFilter>{
SleuthkitCase skCase; SleuthkitCase skCase;
long latestUpdateTime; Calendar lastDay;
private final static Logger logger = Logger.getLogger(RecentFilesChildren.class.getName()); private final static Logger logger = Logger.getLogger(RecentFilesChildren.class.getName());
public RecentFilesChildren(SleuthkitCase skCase) { public RecentFilesChildren(SleuthkitCase skCase) {
@ -46,13 +47,18 @@ public class RecentFilesChildren extends ChildFactory<RecentFiles.RecentFilesFil
@Override @Override
protected boolean createKeys(List<RecentFiles.RecentFilesFilter> list) { protected boolean createKeys(List<RecentFiles.RecentFilesFilter> list) {
list.addAll(Arrays.asList(RecentFiles.RecentFilesFilter.values())); list.addAll(Arrays.asList(RecentFiles.RecentFilesFilter.values()));
latestUpdateTime = getLastTime(); lastDay = Calendar.getInstance();
lastDay.setTimeInMillis(getLastTime()*1000);
lastDay.set(Calendar.HOUR_OF_DAY, 0);
lastDay.set(Calendar.MINUTE, 0);
lastDay.set(Calendar.SECOND, 0);
lastDay.set(Calendar.MILLISECOND, 0);
return true; return true;
} }
@Override @Override
protected Node createNodeForKey(RecentFiles.RecentFilesFilter key){ protected Node createNodeForKey(RecentFiles.RecentFilesFilter key){
return new RecentFilesFilterNode(skCase, key, latestUpdateTime); return new RecentFilesFilterNode(skCase, key, lastDay);
} }
private long getLastTime() { private long getLastTime() {

View File

@ -22,6 +22,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -44,13 +45,14 @@ public class RecentFilesFilterChildren extends ChildFactory<Content>{
SleuthkitCase skCase; SleuthkitCase skCase;
RecentFilesFilter filter; RecentFilesFilter filter;
long latestUpdate; Calendar prevDay;
private final static Logger logger = Logger.getLogger(RecentFilesFilterChildren.class.getName()); private final static Logger logger = Logger.getLogger(RecentFilesFilterChildren.class.getName());
RecentFilesFilterChildren(RecentFilesFilter filter, SleuthkitCase skCase, long latestUpdate) { RecentFilesFilterChildren(RecentFilesFilter filter, SleuthkitCase skCase, Calendar lastDay) {
this.skCase = skCase; this.skCase = skCase;
this.filter = filter; this.filter = filter;
this.latestUpdate = latestUpdate; this.prevDay = (Calendar) lastDay.clone();
prevDay.add(Calendar.DATE, -filter.getDurationDays());
} }
@Override @Override
@ -61,11 +63,14 @@ public class RecentFilesFilterChildren extends ChildFactory<Content>{
private String createQuery(){ private String createQuery(){
String query = "select * from tsk_files where "; String query = "select * from tsk_files where ";
long threshold = latestUpdate-filter.getDurationSeconds(); long lowerLimit = prevDay.getTimeInMillis()/1000;
query += "(crtime between " + threshold + " and " + latestUpdate + ") or "; prevDay.add(Calendar.DATE, 1);
query += "(ctime between " + threshold + " and " + latestUpdate + ") or "; prevDay.add(Calendar.MILLISECOND, -1);
query += "(atime between " + threshold + " and " + latestUpdate + ") or "; long upperLimit = prevDay.getTimeInMillis()/1000;
query += "(mtime between " + threshold + " and " + latestUpdate + ")"; query += "(crtime between " + lowerLimit + " and " + upperLimit + ") or ";
query += "(ctime between " + lowerLimit + " and " + upperLimit + ") or ";
query += "(atime between " + lowerLimit + " and " + upperLimit + ") or ";
query += "(mtime between " + lowerLimit + " and " + upperLimit + ")";
return query; return query;
} }
@ -74,7 +79,7 @@ public class RecentFilesFilterChildren extends ChildFactory<Content>{
try { try {
ResultSet rs = skCase.runQuery(createQuery()); ResultSet rs = skCase.runQuery(createQuery());
for(FsContent c : skCase.resultSetToFsContents(rs)){ for(FsContent c : skCase.resultSetToFsContents(rs)){
if(!c.getName().equals(".") && !c.getName().equals("..")){ if(c.isFile()){
list.add(c); list.add(c);
} }
} }

View File

@ -18,11 +18,8 @@
*/ */
package org.sleuthkit.autopsy.datamodel; package org.sleuthkit.autopsy.datamodel;
import java.sql.ResultSet; import java.util.Calendar;
import java.sql.SQLException; import java.util.Locale;
import java.sql.Statement;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.openide.nodes.AbstractNode; import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children; import org.openide.nodes.Children;
@ -39,15 +36,19 @@ public class RecentFilesFilterNode extends AbstractNode implements DisplayableIt
SleuthkitCase skCase; SleuthkitCase skCase;
RecentFilesFilter filter; RecentFilesFilter filter;
private final static Logger logger = Logger.getLogger(RecentFilesFilterNode.class.getName());
RecentFilesFilterNode(SleuthkitCase skCase, RecentFilesFilter filter, long latestUpdate) { RecentFilesFilterNode(SleuthkitCase skCase, RecentFilesFilter filter, Calendar lastDay) {
super(Children.create(new RecentFilesFilterChildren(filter, skCase, latestUpdate), true), Lookups.singleton(filter)); super(Children.create(new RecentFilesFilterChildren(filter, skCase, lastDay), true), Lookups.singleton(filter.getDisplayName()));
super.setName(filter.getName()); super.setName(filter.getName());
super.setDisplayName(filter.getDisplayName()); super.setDisplayName(filter.getDisplayName());
this.skCase = skCase; this.skCase = skCase;
this.filter = filter; this.filter = filter;
String tooltip = "Between " + new Date((latestUpdate-filter.getDurationSeconds())*1000).toString(); Calendar prevDay = (Calendar) lastDay.clone();
tooltip += "\n and " + new Date(latestUpdate*1000).toString(); prevDay.add(Calendar.DATE, -filter.getDurationDays());
String tooltip = prevDay.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.ENGLISH) + " " +
prevDay.get(Calendar.DATE) + ", " +
prevDay.get(Calendar.YEAR);
this.setShortDescription(tooltip); this.setShortDescription(tooltip);
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/recent-icon.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/recent-icon.png");
} }

View File

@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.datamodel;
import org.openide.nodes.AbstractNode; import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children; import org.openide.nodes.Children;
import org.openide.util.lookup.Lookups;
import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.SleuthkitCase;
/** /**
@ -31,7 +32,7 @@ public class RecentFilesNode extends AbstractNode implements DisplayableItemNode
SleuthkitCase skCase; SleuthkitCase skCase;
RecentFilesNode(SleuthkitCase skCase) { RecentFilesNode(SleuthkitCase skCase) {
super(Children.create(new RecentFilesChildren(skCase), true)); super(Children.create(new RecentFilesChildren(skCase), true), Lookups.singleton("Recent Files"));
super.setName("Recent Files"); super.setName("Recent Files");
super.setDisplayName("Recent Files"); super.setDisplayName("Recent Files");
this.skCase = skCase; this.skCase = skCase;

View File

@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.datamodel;
import org.openide.nodes.AbstractNode; import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children; import org.openide.nodes.Children;
import org.openide.util.lookup.Lookups;
import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.SleuthkitCase;
/** /**
@ -31,7 +32,7 @@ public class SearchFiltersNode extends AbstractNode implements DisplayableItemNo
SleuthkitCase skCase; SleuthkitCase skCase;
SearchFiltersNode(SleuthkitCase skCase) { SearchFiltersNode(SleuthkitCase skCase) {
super(Children.create(new SearchFiltersChildren(skCase), true)); super(Children.create(new SearchFiltersChildren(skCase), true), Lookups.singleton("Search Filters"));
super.setName("File Types"); super.setName("File Types");
super.setDisplayName("File Types"); super.setDisplayName("File Types");
this.skCase = skCase; this.skCase = skCase;

View File

@ -43,11 +43,11 @@
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/> <EmptySpace max="32767" attributes="0"/>
<Component id="listsButton" min="-2" max="-2" attributes="0"/> <Component id="listsButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/> <EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="searchBoxPanel" min="-2" max="-2" attributes="0"/> <Component id="searchBoxPanel" min="-2" pref="245" max="-2" attributes="0"/>
<EmptySpace pref="34" max="32767" attributes="0"/> <EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -79,19 +79,14 @@
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<Component id="settingsLabel" min="-2" max="-2" attributes="0"/> <Component id="settingsLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="searchBox" pref="226" max="32767" attributes="0"/> <Component id="searchBox" pref="216" max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
<DimensionLayout dim="1"> <DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0"> <Component id="settingsLabel" min="-2" pref="21" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Component id="searchBox" alignment="0" min="-2" max="-2" attributes="2"/>
<Component id="settingsLabel" min="-2" pref="21" max="-2" attributes="0"/>
<Component id="searchBox" alignment="0" min="-2" max="-2" attributes="2"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
</Layout> </Layout>

View File

@ -145,7 +145,7 @@ public class KeywordSearchPanel extends AbstractKeywordSearchPerformer{
searchBoxPanel.setBorder(new javax.swing.border.LineBorder(java.awt.Color.lightGray, 1, true)); searchBoxPanel.setBorder(new javax.swing.border.LineBorder(java.awt.Color.lightGray, 1, true));
searchBoxPanel.setPreferredSize(new java.awt.Dimension(255, 18)); searchBoxPanel.setPreferredSize(new java.awt.Dimension(255, 18));
searchBox.setFont(new java.awt.Font("Tahoma", 0, 12)); searchBox.setFont(new java.awt.Font("Tahoma", 0, 12)); // 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));
@ -175,15 +175,12 @@ public class KeywordSearchPanel extends AbstractKeywordSearchPerformer{
.addGroup(searchBoxPanelLayout.createSequentialGroup() .addGroup(searchBoxPanelLayout.createSequentialGroup()
.addComponent(settingsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(settingsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(searchBox, javax.swing.GroupLayout.DEFAULT_SIZE, 226, Short.MAX_VALUE)) .addComponent(searchBox, javax.swing.GroupLayout.DEFAULT_SIZE, 216, Short.MAX_VALUE))
); );
searchBoxPanelLayout.setVerticalGroup( searchBoxPanelLayout.setVerticalGroup(
searchBoxPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) searchBoxPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(searchBoxPanelLayout.createSequentialGroup() .addComponent(settingsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(searchBoxPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(searchBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(settingsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(searchBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
); );
listsButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "KeywordSearchPanel.listsButton.text")); // NOI18N listsButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "KeywordSearchPanel.listsButton.text")); // NOI18N
@ -204,11 +201,11 @@ public class KeywordSearchPanel extends AbstractKeywordSearchPerformer{
layout.setHorizontalGroup( layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(listsButton) .addComponent(listsButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(searchBoxPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(searchBoxPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(34, Short.MAX_VALUE)) .addGap(2, 2, 2))
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -220,13 +217,11 @@ public class KeywordSearchPanel extends AbstractKeywordSearchPerformer{
private void searchBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchBoxActionPerformed private void searchBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchBoxActionPerformed
if (filesIndexed == 0) if (filesIndexed == 0)
return; return;
getRootPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
this.getTopLevelAncestor().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try { try {
search(); search();
} finally { } finally {
this.getTopLevelAncestor().setCursor(null); getRootPane().setCursor(null);
} }
}//GEN-LAST:event_searchBoxActionPerformed }//GEN-LAST:event_searchBoxActionPerformed