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;
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());
// NOTE: This completely destroys our lazy-loading ideal
// 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.Children;
import org.openide.util.lookup.Lookups;
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 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.setDisplayName(EXTRACTED_NAME);
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/artifact-icon.png");

View File

@ -35,7 +35,7 @@ public class FileSearchFilterNode extends AbstractNode implements DisplayableIte
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.setDisplayName(filter.getDisplayName());
this.filter = filter;

View File

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

View File

@ -22,6 +22,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -36,7 +37,7 @@ import org.sleuthkit.datamodel.SleuthkitCase;
public class RecentFilesChildren extends ChildFactory<RecentFiles.RecentFilesFilter>{
SleuthkitCase skCase;
long latestUpdateTime;
Calendar lastDay;
private final static Logger logger = Logger.getLogger(RecentFilesChildren.class.getName());
public RecentFilesChildren(SleuthkitCase skCase) {
@ -46,13 +47,18 @@ public class RecentFilesChildren extends ChildFactory<RecentFiles.RecentFilesFil
@Override
protected boolean createKeys(List<RecentFiles.RecentFilesFilter> list) {
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;
}
@Override
protected Node createNodeForKey(RecentFiles.RecentFilesFilter key){
return new RecentFilesFilterNode(skCase, key, latestUpdateTime);
return new RecentFilesFilterNode(skCase, key, lastDay);
}
private long getLastTime() {

View File

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

View File

@ -18,11 +18,8 @@
*/
package org.sleuthkit.autopsy.datamodel;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Date;
import java.util.logging.Level;
import java.util.Calendar;
import java.util.Locale;
import java.util.logging.Logger;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children;
@ -39,15 +36,19 @@ public class RecentFilesFilterNode extends AbstractNode implements DisplayableIt
SleuthkitCase skCase;
RecentFilesFilter filter;
private final static Logger logger = Logger.getLogger(RecentFilesFilterNode.class.getName());
RecentFilesFilterNode(SleuthkitCase skCase, RecentFilesFilter filter, long latestUpdate) {
super(Children.create(new RecentFilesFilterChildren(filter, skCase, latestUpdate), true), Lookups.singleton(filter));
RecentFilesFilterNode(SleuthkitCase skCase, RecentFilesFilter filter, Calendar lastDay) {
super(Children.create(new RecentFilesFilterChildren(filter, skCase, lastDay), true), Lookups.singleton(filter.getDisplayName()));
super.setName(filter.getName());
super.setDisplayName(filter.getDisplayName());
this.skCase = skCase;
this.filter = filter;
String tooltip = "Between " + new Date((latestUpdate-filter.getDurationSeconds())*1000).toString();
tooltip += "\n and " + new Date(latestUpdate*1000).toString();
Calendar prevDay = (Calendar) lastDay.clone();
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.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.Children;
import org.openide.util.lookup.Lookups;
import org.sleuthkit.datamodel.SleuthkitCase;
/**
@ -31,7 +32,7 @@ public class RecentFilesNode extends AbstractNode implements DisplayableItemNode
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.setDisplayName("Recent Files");
this.skCase = skCase;

View File

@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.datamodel;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children;
import org.openide.util.lookup.Lookups;
import org.sleuthkit.datamodel.SleuthkitCase;
/**
@ -31,7 +32,7 @@ public class SearchFiltersNode extends AbstractNode implements DisplayableItemNo
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.setDisplayName("File Types");
this.skCase = skCase;

View File

@ -43,11 +43,11 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="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"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="searchBoxPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="34" max="32767" attributes="0"/>
<Component id="searchBoxPanel" min="-2" pref="245" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -79,20 +79,15 @@
<Group type="102" alignment="0" attributes="0">
<Component id="settingsLabel" min="-2" 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>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<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>
</DimensionLayout>
</Layout>
<SubComponents>

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.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.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "KeywordSearchPanel.searchBox.text")); // NOI18N
searchBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 3, 4, 1));
@ -175,15 +175,12 @@ public class KeywordSearchPanel extends AbstractKeywordSearchPerformer{
.addGroup(searchBoxPanelLayout.createSequentialGroup()
.addComponent(settingsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.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.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(searchBoxPanelLayout.createSequentialGroup()
.addGroup(searchBoxPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.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))
.addComponent(searchBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
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.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(listsButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(searchBoxPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(34, Short.MAX_VALUE))
.addComponent(searchBoxPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(2, 2, 2))
);
layout.setVerticalGroup(
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
if (filesIndexed == 0)
return;
this.getTopLevelAncestor().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
getRootPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try {
search();
} finally {
this.getTopLevelAncestor().setCursor(null);
getRootPane().setCursor(null);
}
}//GEN-LAST:event_searchBoxActionPerformed