From f941eddd8c3adb691c790a2bd6e66f914099f38a Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Fri, 27 Mar 2015 10:18:15 -0400 Subject: [PATCH 1/7] Revert "Revert "used non deprecated complete(ReportStatus)"" This reverts commit b1284625d220c203467112afe26441aeba941fdc. --- .../sleuthkit/autopsy/casemodule/StartupWindow.java | 2 +- .../autopsy/modules/stix/STIXReportModule.java | 13 ++++++++----- .../sleuthkit/autopsy/report/ReportGenerator.java | 4 ++-- .../src/org/sleuthkit/autopsy/report/ReportKML.java | 4 ++-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindow.java b/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindow.java index b274c851a1..bd9e3d3d23 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindow.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindow.java @@ -63,7 +63,7 @@ public final class StartupWindow extends JDialog implements StartupWindowInterfa setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2); CueBannerPanel welcomeWindow = new CueBannerPanel(); - welcomeWindow.refresh(); + CueBannerPanel.refresh(); // add the command to close the window to the button on the Volume Detail Panel welcomeWindow.setCloseButtonActionListener(new ActionListener() { diff --git a/Core/src/org/sleuthkit/autopsy/modules/stix/STIXReportModule.java b/Core/src/org/sleuthkit/autopsy/modules/stix/STIXReportModule.java index ee1021944b..6431f4ab87 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/stix/STIXReportModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/stix/STIXReportModule.java @@ -59,6 +59,7 @@ import org.mitre.cybox.objects.DomainName; import org.mitre.cybox.objects.WindowsRegistryKey; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.coreutils.ModuleSettings; +import org.sleuthkit.autopsy.report.ReportProgressPanel.ReportStatus; /** * @@ -120,7 +121,7 @@ public class STIXReportModule implements GeneralReportModule { "STIXReportModule.notifyMsg.unableToOpenReportFile", reportPath), MessageNotifyUtil.MessageType.ERROR); - progressPanel.complete(); + progressPanel.complete(ReportStatus.ERROR); progressPanel.updateStatusLabel( NbBundle.getMessage(this.getClass(), "STIXReportModule.progress.completedWithErrors")); return; @@ -135,7 +136,7 @@ public class STIXReportModule implements GeneralReportModule { logger.log(Level.SEVERE, "STIXReportModuleConfigPanel.stixFile not initialized "); //NON-NLS MessageNotifyUtil.Message.error( NbBundle.getMessage(this.getClass(), "STIXReportModule.notifyErr.noFildDirProvided")); - progressPanel.complete(); + progressPanel.complete(ReportStatus.ERROR); progressPanel.updateStatusLabel( NbBundle.getMessage(this.getClass(), "STIXReportModule.progress.noFildDirProvided")); return; @@ -144,7 +145,7 @@ public class STIXReportModule implements GeneralReportModule { logger.log(Level.SEVERE, "No STIX file/directory provided "); //NON-NLS MessageNotifyUtil.Message.error( NbBundle.getMessage(this.getClass(), "STIXReportModule.notifyErr.noFildDirProvided")); - progressPanel.complete(); + progressPanel.complete(ReportStatus.ERROR); progressPanel.updateStatusLabel( NbBundle.getMessage(this.getClass(), "STIXReportModule.progress.noFildDirProvided")); return; @@ -156,7 +157,7 @@ public class STIXReportModule implements GeneralReportModule { MessageNotifyUtil.Message.error(NbBundle.getMessage(this.getClass(), "STIXReportModule.notifyMsg.unableToOpenFileDir", stixFileName)); - progressPanel.complete(); + progressPanel.complete(ReportStatus.ERROR); progressPanel.updateStatusLabel( NbBundle.getMessage(this.getClass(), "STIXReportModule.progress.couldNotOpenFileDir", stixFileName)); return; @@ -201,10 +202,12 @@ public class STIXReportModule implements GeneralReportModule { // Set the progress bar to done. If any errors occurred along the way, modify // the "complete" message to indicate this. - progressPanel.complete(); if (hadErrors) { + progressPanel.complete(ReportStatus.ERROR); progressPanel.updateStatusLabel( NbBundle.getMessage(this.getClass(), "STIXReportModule.progress.completedWithErrors")); + } else { + progressPanel.complete(ReportStatus.COMPLETE); } } diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportGenerator.java b/Core/src/org/sleuthkit/autopsy/report/ReportGenerator.java index dfa627fa91..40801f4ab2 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ReportGenerator.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportGenerator.java @@ -358,7 +358,7 @@ import org.sleuthkit.datamodel.TskData; for (FileReportModule module : fileModules) { module.endTable(); module.endReport(); - fileProgress.get(module).complete(); + fileProgress.get(module).complete(ReportStatus.COMPLETE); } return 0; @@ -463,7 +463,7 @@ import org.sleuthkit.datamodel.TskData; // finish progress, wrap up for (TableReportModule module : tableModules) { - tableProgress.get(module).complete(); + tableProgress.get(module).complete(ReportStatus.COMPLETE); module.endReport(); } diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportKML.java b/Core/src/org/sleuthkit/autopsy/report/ReportKML.java index 4b03caf8f6..1f6c5a665b 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ReportKML.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportKML.java @@ -339,12 +339,12 @@ class ReportKML implements GeneralReportModule { } catch (IOException ex) { logger.log(Level.WARNING, "Could not write the KML report.", ex); //NON-NLS } - progressPanel.complete(); + progressPanel.complete(ReportProgressPanel.ReportStatus.ERROR); } catch (TskCoreException ex) { logger.log(Level.WARNING, "Failed to get the unique path.", ex); //NON-NLS } progressPanel.increment(); - progressPanel.complete(); + progressPanel.complete(ReportProgressPanel.ReportStatus.COMPLETE); } public static void copyFileUsingStream(AbstractFile file, File jFile) throws IOException { From e4c40ec86620164387c2eb795bbe3fd88cdc84e0 Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Fri, 27 Mar 2015 11:29:41 -0400 Subject: [PATCH 2/7] getOneHitPerObject() optimized --- .../autopsy/keywordsearch/QueryResults.java | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/QueryResults.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/QueryResults.java index 96784a86c7..835485096e 100755 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/QueryResults.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/QueryResults.java @@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.keywordsearch; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -167,17 +166,26 @@ class QueryResults { return newArtifacts; } - private List getOneHitPerObject(Keyword keyword) { - List hits = new ArrayList<>(); - Set uniqueObjectIds = new HashSet<>(); - for (KeywordHit hit : getResults(keyword)) { - long objectId = hit.getSolrObjectId(); - if (!uniqueObjectIds.contains(objectId)) { - uniqueObjectIds.add(objectId); - hits.add(hit); + /** + * Gets the first hit of the keyword. + * @param keyword + * @return Collection containing KeywordHits with lowest SolrObjectID-ChunkID pairs. + */ + private Collection getOneHitPerObject(Keyword keyword) { + + HashMap hits = new HashMap(); + + // create a list of KeywordHits. KeywordHits with lowest chunkID is added the the list. + for(KeywordHit hit: getResults(keyword)) { + if(!hits.containsKey(hit.getSolrObjectId())) { + hits.put(hit.getSolrObjectId(), hit); + } else { + if(hit.getChunkId() < hits.get(hit.getSolrObjectId()).getChunkId()) { + hits.put(hit.getSolrObjectId(), hit); + } } } - return hits; + return hits.values(); } /** From feaaedbf7c4efd0e1da848a435d8894e069792d5 Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Fri, 27 Mar 2015 12:25:19 -0400 Subject: [PATCH 3/7] refresh() made nonstatic --- .../org/sleuthkit/autopsy/casemodule/CaseCloseAction.java | 1 - .../org/sleuthkit/autopsy/casemodule/CueBannerPanel.form | 6 ------ .../org/sleuthkit/autopsy/casemodule/CueBannerPanel.java | 7 ++++--- .../org/sleuthkit/autopsy/casemodule/StartupWindow.java | 5 +++-- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/CaseCloseAction.java b/Core/src/org/sleuthkit/autopsy/casemodule/CaseCloseAction.java index cb2e098be1..900a355bf0 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/CaseCloseAction.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/CaseCloseAction.java @@ -83,7 +83,6 @@ import org.openide.util.actions.Presenter; */ @Override public void actionPerformed(ActionEvent e) { - CueBannerPanel.refresh(); if (Case.existsCurrentCase() == false) return; diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/CueBannerPanel.form b/Core/src/org/sleuthkit/autopsy/casemodule/CueBannerPanel.form index b1274c117a..57670e96aa 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/CueBannerPanel.form +++ b/Core/src/org/sleuthkit/autopsy/casemodule/CueBannerPanel.form @@ -126,9 +126,6 @@ - - - @@ -149,9 +146,6 @@ - - - diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/CueBannerPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/CueBannerPanel.java index 103d19c488..d5a974a587 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/CueBannerPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/CueBannerPanel.java @@ -47,6 +47,7 @@ public class CueBannerPanel extends javax.swing.JPanel { public CueBannerPanel() { initComponents(); + refresh(); } public CueBannerPanel(String welcomeLogo) { @@ -179,7 +180,7 @@ public class CueBannerPanel extends javax.swing.JPanel { ); }// //GEN-END:initComponents - public static void refresh() { + public void refresh() { if (RecentCases.getInstance().getTotalRecentCases() == 0) { openRecentButton.setEnabled(false); openRecentLabel.setEnabled(false); @@ -236,8 +237,8 @@ public class CueBannerPanel extends javax.swing.JPanel { private javax.swing.JButton newCaseButton; private javax.swing.JButton openCaseButton; private javax.swing.JLabel openLabel; - private static javax.swing.JButton openRecentButton; - private static javax.swing.JLabel openRecentLabel; + private javax.swing.JButton openRecentButton; + private javax.swing.JLabel openRecentLabel; // End of variables declaration//GEN-END:variables /** diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindow.java b/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindow.java index bd9e3d3d23..21281c2743 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindow.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindow.java @@ -40,6 +40,7 @@ public final class StartupWindow extends JDialog implements StartupWindowInterfa private static StartupWindow instance; private static final String TITLE = NbBundle.getMessage(StartupWindow.class, "StartupWindow.title.text"); private static Dimension DIMENSIONS = new Dimension(750, 400); + CueBannerPanel welcomeWindow; public StartupWindow() { super(WindowManager.getDefault().getMainWindow(), TITLE, true); @@ -62,8 +63,7 @@ public final class StartupWindow extends JDialog implements StartupWindowInterfa // set the location of the popUp Window on the center of the screen setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2); - CueBannerPanel welcomeWindow = new CueBannerPanel(); - CueBannerPanel.refresh(); + welcomeWindow = new CueBannerPanel(); // add the command to close the window to the button on the Volume Detail Panel welcomeWindow.setCloseButtonActionListener(new ActionListener() { @@ -82,6 +82,7 @@ public final class StartupWindow extends JDialog implements StartupWindowInterfa @Override public void open() { + welcomeWindow.refresh(); setVisible(true); } From 899203b67169435c322579ba93ba42087e7fd937 Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Fri, 27 Mar 2015 12:30:09 -0400 Subject: [PATCH 4/7] changed access modifier of welcomeWindow --- Core/src/org/sleuthkit/autopsy/casemodule/StartupWindow.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindow.java b/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindow.java index 21281c2743..caff6ed884 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindow.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindow.java @@ -40,7 +40,7 @@ public final class StartupWindow extends JDialog implements StartupWindowInterfa private static StartupWindow instance; private static final String TITLE = NbBundle.getMessage(StartupWindow.class, "StartupWindow.title.text"); private static Dimension DIMENSIONS = new Dimension(750, 400); - CueBannerPanel welcomeWindow; + private static CueBannerPanel welcomeWindow; public StartupWindow() { super(WindowManager.getDefault().getMainWindow(), TITLE, true); From f5a327f5c9bf311ff3951eba0d640981c3b979f2 Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Fri, 27 Mar 2015 13:57:26 -0400 Subject: [PATCH 5/7] appropriate format strings used for stripping time --- test/script/regression.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/script/regression.py b/test/script/regression.py index 95742d63fe..8b3fa274ff 100755 --- a/test/script/regression.py +++ b/test/script/regression.py @@ -1310,10 +1310,10 @@ class Logs(object): Errors.print_error("Error: Unable to open autopsy.log.0.") Errors.print_error(str(e) + "\n") logging.warning(traceback.format_exc()) - # Start date must look like: "Jul 16, 2012 12:57:53 PM" + # Start date must look like: "Fri Mar 27 13:27:34 EDT 2015" # End date must look like: "Mon Jul 16 13:02:42 2012" # *** If logging time format ever changes this will break *** - start = datetime.datetime.strptime(test_data.start_date, "%b %d, %Y %I:%M:%S %p") + start = datetime.datetime.strptime(test_data.start_date, "%a %b %d %H:%M:%S %Z %Y") end = datetime.datetime.strptime(test_data.end_date, "%a %b %d %H:%M:%S %Y") test_data.total_test_time = str(end - start) From 4d97fb3e2c239daaf8bb1b9963a470ecff9fafe9 Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Fri, 27 Mar 2015 15:03:39 -0400 Subject: [PATCH 6/7] file names consistent --- test/script/regression.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/script/regression.py b/test/script/regression.py index 95742d63fe..f41084dc1f 100755 --- a/test/script/regression.py +++ b/test/script/regression.py @@ -83,7 +83,7 @@ AUTOPSY_TEST_CASE = "AutopsyTestCase" # TODO: Double check this purpose statement # The filename of the log to store error messages -COMMON_LOG = "AutopsyErrors.txt" +COMMON_LOG = "AutopsyExceptions.txt" Day = 0 @@ -576,7 +576,7 @@ class TestData(object): Args: file_type: the DBType of the path to be generated """ - return self._get_path_to_file(file_type, "SortedData.txt") + return self._get_path_to_file(file_type, "BlackboardDump.txt") def get_sorted_errors_path(self, file_type): """Get the path to the SortedErrors file that correspodns to the given @@ -585,7 +585,7 @@ class TestData(object): Args: file_type: the DBType of the path to be generated """ - return self._get_path_to_file(file_type, "SortedErrors.txt") + return self._get_path_to_file(file_type, "BlackboardDumpErrors.txt") def get_db_dump_path(self, file_type): """Get the path to the DBDump file that corresponds to the given DBType. @@ -598,7 +598,7 @@ class TestData(object): def get_run_time_path(self, file_type): """Get the path to the run time storage file." """ - return self._get_path_to_file(file_type, "_time.txt") + return self._get_path_to_file(file_type, "Time.txt") def _get_path_to_file(self, file_type, file_name): """Get the path to the specified file with the specified type. From a6b58adacc2f1d7ffde8d57530eebc1ad6c8157d Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Fri, 27 Mar 2015 15:08:52 -0400 Subject: [PATCH 7/7] file names consistent --- test/script/regression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/script/regression.py b/test/script/regression.py index f41084dc1f..bc1ef228c1 100755 --- a/test/script/regression.py +++ b/test/script/regression.py @@ -83,7 +83,7 @@ AUTOPSY_TEST_CASE = "AutopsyTestCase" # TODO: Double check this purpose statement # The filename of the log to store error messages -COMMON_LOG = "AutopsyExceptions.txt" +COMMON_LOG = "Exceptions.txt" Day = 0