Removed pop ups or other GUI related features that require user interaction

This commit is contained in:
Eugene Livis 2019-08-27 15:46:32 -04:00
parent 974068df3a
commit a1286e5fa1
10 changed files with 25 additions and 50 deletions

View File

@ -6,7 +6,6 @@ STIXReportModule.getDesc.text=Generate a report by running a collection of STIX
STIXReportModule.progress.readSTIX=Parsing STIX files
STIXReportModule.srcModuleName.text=STIX Report
STIXReportModuleConfigPanel.jLabel2.text=Select a STIX file or directory of STIX files
STIXReportModuleConfigPanel.jTextField1.text=
STIXReportModuleConfigPanel.jButton1.text=Choose file
STIXReportModuleConfigPanel.jCheckBox1.text=Include results for false indicators in output file
STIXReportModule.notifyMsg.unableToOpenReportFile=Unable to complete STIX report.
@ -16,3 +15,4 @@ STIXReportModule.progress.couldNotOpenFileDir=Could not open file/directory {0}
STIXReportModule.notifyMsg.tooManyArtifactsgt1000=Too many STIX-related artifacts generated for "{0}". Only saving first 1000.
STIXReportModule.notifyErr.noFildDirProvided=No STIX file/directory provided
STIXReportModule.progress.noFildDirProvided=No STIX file/directory provided
STIXReportModuleConfigPanel.jStixFileTextField.text=

View File

@ -54,7 +54,6 @@ import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.report.GeneralReportModule;
import org.sleuthkit.autopsy.report.NoReportModuleSettings;
import org.sleuthkit.autopsy.report.ReportModuleSettings;
@ -116,8 +115,6 @@ public class STIXReportModule implements GeneralReportModule {
if (stixFileName == null) {
logger.log(Level.SEVERE, "STIXReportModuleConfigPanel.stixFile not initialized "); //NON-NLS
MessageNotifyUtil.Message.error(
NbBundle.getMessage(this.getClass(), "STIXReportModule.notifyErr.noFildDirProvided"));
progressPanel.complete(ReportStatus.ERROR);
progressPanel.updateStatusLabel(
NbBundle.getMessage(this.getClass(), "STIXReportModule.progress.noFildDirProvided"));
@ -126,8 +123,6 @@ public class STIXReportModule implements GeneralReportModule {
}
if (stixFileName.isEmpty()) {
logger.log(Level.SEVERE, "No STIX file/directory provided "); //NON-NLS
MessageNotifyUtil.Message.error(
NbBundle.getMessage(this.getClass(), "STIXReportModule.notifyErr.noFildDirProvided"));
progressPanel.complete(ReportStatus.ERROR);
progressPanel.updateStatusLabel(
NbBundle.getMessage(this.getClass(), "STIXReportModule.progress.noFildDirProvided"));
@ -138,9 +133,6 @@ public class STIXReportModule implements GeneralReportModule {
if (!stixFile.exists()) {
logger.log(Level.SEVERE, String.format("Unable to open STIX file/directory %s", stixFileName)); //NON-NLS
MessageNotifyUtil.Message.error(NbBundle.getMessage(this.getClass(),
"STIXReportModule.notifyMsg.unableToOpenFileDir",
stixFileName));
progressPanel.complete(ReportStatus.ERROR);
progressPanel.updateStatusLabel(
NbBundle.getMessage(this.getClass(), "STIXReportModule.progress.couldNotOpenFileDir", stixFileName));
@ -172,9 +164,7 @@ public class STIXReportModule implements GeneralReportModule {
} catch (TskCoreException | JAXBException ex) {
String errMsg = String.format("Unable to process STIX file %s", file);
logger.log(Level.SEVERE, errMsg, ex); //NON-NLS
MessageNotifyUtil.Notify.show("STIXReportModule", //NON-NLS
errMsg,
MessageNotifyUtil.MessageType.ERROR);
progressPanel.updateStatusLabel(NbBundle.getMessage(this.getClass(), errMsg));
hadErrors = true;
break;
}
@ -195,10 +185,6 @@ public class STIXReportModule implements GeneralReportModule {
}
} catch (IOException ex) {
logger.log(Level.SEVERE, "Unable to complete STIX report.", ex); //NON-NLS
MessageNotifyUtil.Notify.show("STIXReportModule", //NON-NLS
NbBundle.getMessage(this.getClass(),
"STIXReportModule.notifyMsg.unableToOpenReportFile"),
MessageNotifyUtil.MessageType.ERROR);
progressPanel.complete(ReportStatus.ERROR);
progressPanel.updateStatusLabel(
NbBundle.getMessage(this.getClass(), "STIXReportModule.progress.completedWithErrors"));
@ -234,7 +220,7 @@ public class STIXReportModule implements GeneralReportModule {
registryFileData = EvalRegistryObj.copyRegistryFiles();
// Process the indicators
processIndicators(stix, output);
processIndicators(stix, output, progressPanel);
progressPanel.increment();
}
@ -282,7 +268,7 @@ public class STIXReportModule implements GeneralReportModule {
* @param stix STIXPackage
* @param output
*/
private void processIndicators(STIXPackage stix, BufferedWriter output) throws TskCoreException {
private void processIndicators(STIXPackage stix, BufferedWriter output, ReportProgressPanel progressPanel) throws TskCoreException {
if (stix.getIndicators() != null) {
List<IndicatorBaseType> s = stix.getIndicators().getIndicators();
for (IndicatorBaseType t : s) {
@ -295,7 +281,7 @@ public class STIXReportModule implements GeneralReportModule {
writeResultsToFile(ind, result.getDescription(), result.isTrue(), output);
}
if (result.isTrue()) {
saveResultsAsArtifacts(ind, result);
saveResultsAsArtifacts(ind, result, progressPanel);
}
} else if (ind.getObservable().getObservableComposition() != null) {
ObservableResult result = evaluateObservableComposition(ind.getObservable().getObservableComposition(), " ");
@ -304,7 +290,7 @@ public class STIXReportModule implements GeneralReportModule {
writeResultsToFile(ind, result.getDescription(), result.isTrue(), output);
}
if (result.isTrue()) {
saveResultsAsArtifacts(ind, result);
saveResultsAsArtifacts(ind, result, progressPanel);
}
}
}
@ -321,7 +307,7 @@ public class STIXReportModule implements GeneralReportModule {
*
* @throws TskCoreException
*/
private void saveResultsAsArtifacts(Indicator ind, ObservableResult result) throws TskCoreException {
private void saveResultsAsArtifacts(Indicator ind, ObservableResult result, ReportProgressPanel progressPanel) throws TskCoreException {
if (result.getArtifacts() == null) {
return;
@ -347,11 +333,8 @@ public class STIXReportModule implements GeneralReportModule {
// for a single observable because the condition was not restrictive enough
count++;
if (count > 1000) {
MessageNotifyUtil.Notify.show("STIXReportModule", //NON-NLS
NbBundle.getMessage(this.getClass(),
"STIXReportModule.notifyMsg.tooManyArtifactsgt1000",
ind.getId()),
MessageNotifyUtil.MessageType.INFO);
progressPanel.updateStatusLabel(NbBundle.getMessage(this.getClass(),
"STIXReportModule.notifyMsg.tooManyArtifactsgt1000"));
break;
}
}

View File

@ -26,7 +26,6 @@ import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Blackboard;
import org.sleuthkit.datamodel.BlackboardArtifact;
@ -76,7 +75,6 @@ class StixArtifactData {
blackboard = Case.getCurrentCaseThrows().getSleuthkitCase().getBlackboard();
} catch (NoCurrentCaseException ex) {
logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS
MessageNotifyUtil.Notify.error(Bundle.StixArtifactData_noOpenCase_errMsg(), ex.getLocalizedMessage());
return;
}
@ -100,7 +98,6 @@ class StixArtifactData {
blackboard.postArtifact(bba, MODULE_NAME);
} catch (Blackboard.BlackboardException ex) {
logger.log(Level.SEVERE, "Unable to index blackboard artifact " + bba.getArtifactID(), ex); //NON-NLS
MessageNotifyUtil.Notify.error(Bundle.StixArtifactData_indexError_message(), bba.getDisplayName());
}
}
}

View File

@ -116,8 +116,9 @@ class PortableCaseInterestingItemsListPanel extends javax.swing.JPanel {
setCounts = callback.getSetCountMap();
setNames.addAll(setCounts.keySet());
} catch (TskCoreException ex) {
Logger.getLogger(ReportWizardPortableCaseOptionsVisualPanel.class.getName()).log(Level.WARNING, "Failed to get interesting item set names", ex); // NON-NLS
Logger.getLogger(ReportWizardPortableCaseOptionsVisualPanel.class.getName()).log(Level.SEVERE, "Failed to get interesting item set names", ex); // NON-NLS
} catch (NoCurrentCaseException ex) {
// There may not be a case open when configuring report modules for Command Line execution
Logger.getLogger(ReportWizardPortableCaseOptionsVisualPanel.class.getName()).log(Level.WARNING, "Exception while getting open case.", ex); // NON-NLS
}
Collections.sort(setNames);

View File

@ -38,7 +38,6 @@ import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.coreutils.FileUtil;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.datamodel.ContentUtils;
import org.sleuthkit.autopsy.coreutils.FileTypeUtils.FileTypeCategory;
@ -153,7 +152,7 @@ class PortableCaseReportModule implements ReportModule {
} else {
logger.log(Level.SEVERE, logWarning, ex);
}
MessageNotifyUtil.Message.error(dialogWarning);
progressPanel.updateStatusLabel(dialogWarning);
progressPanel.setIndeterminate(false);
progressPanel.complete(ReportProgressPanel.ReportStatus.ERROR);
cleanup();

View File

@ -119,8 +119,9 @@ class PortableCaseTagsListPanel extends javax.swing.JPanel {
}
}
} catch (TskCoreException ex) {
Logger.getLogger(ReportWizardPortableCaseOptionsVisualPanel.class.getName()).log(Level.WARNING, "Failed to get tag names", ex); // NON-NLS
Logger.getLogger(ReportWizardPortableCaseOptionsVisualPanel.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); // NON-NLS
} catch (NoCurrentCaseException ex) {
// There may not be a case open when configuring report modules for Command Line execution
Logger.getLogger(ReportWizardPortableCaseOptionsVisualPanel.class.getName()).log(Level.WARNING, "Exception while getting open case.", ex); // NON-NLS
}

View File

@ -42,7 +42,7 @@ import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; // ELTODO do we need to remove this?
import org.sleuthkit.autopsy.report.ReportProgressPanel.ReportStatus;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.SleuthkitCase;

View File

@ -41,7 +41,6 @@ import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.casemodule.services.TagsManager;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.datamodel.ContentUtils;
import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.autopsy.report.ReportProgressPanel;
@ -103,14 +102,14 @@ public final class CaseUcoFormatExporter {
Files.createDirectories(Paths.get(reportFile.getParent()));
} catch (IOException ex) {
logger.log(Level.SEVERE, "Unable to create directory for CASE-UCO report", ex); //NON-NLS
MessageNotifyUtil.Message.error(Bundle.ReportCaseUco_unableToCreateDirectories());
progressPanel.updateStatusLabel(Bundle.ReportCaseUco_unableToCreateDirectories());
progressPanel.complete(ReportProgressPanel.ReportStatus.ERROR);
return;
}
// Check if ingest has finished
if (IngestManager.getInstance().isIngestRunning()) {
MessageNotifyUtil.Message.warn(Bundle.ReportCaseUco_ingestWarning());
progressPanel.updateStatusLabel(Bundle.ReportCaseUco_ingestWarning());
}
JsonGenerator jsonGenerator = null;

View File

@ -22,15 +22,12 @@ import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import org.openide.util.NbBundle.Messages;
import org.openide.util.lookup.ServiceProvider;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.casemodule.services.TagsManager;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb;
import org.sleuthkit.autopsy.report.GeneralReportModule;
import org.sleuthkit.autopsy.report.NoReportModuleSettings;
@ -123,7 +120,8 @@ public class AddTaggedHashesToHashDb implements GeneralReportModule {
openCase = Case.getCurrentCaseThrows();
} catch (NoCurrentCaseException ex) {
Logger.getLogger(AddTaggedHashesToHashDb.class.getName()).log(Level.SEVERE, "Exception while getting open case.", ex);
JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), "No open Case", "Exception while getting open case.", JOptionPane.ERROR_MESSAGE);
progressPanel.updateStatusLabel("Exception while getting open case.");
progressPanel.complete(ReportProgressPanel.ReportStatus.ERROR);
return;
}
progressPanel.setIndeterminate(true);
@ -133,7 +131,7 @@ public class AddTaggedHashesToHashDb implements GeneralReportModule {
HashDb hashSet = configPanel.getSelectedHashDatabase();
if (hashSet == null) {
logger.log(Level.WARNING, "No hash set selected for export."); //NON-NLS
MessageNotifyUtil.Message.error(Bundle.AddTaggedHashesToHashDb_error_noHashSetsSelected());
progressPanel.updateStatusLabel(Bundle.AddTaggedHashesToHashDb_error_noHashSetsSelected());
progressPanel.setIndeterminate(false);
progressPanel.complete(ReportProgressPanel.ReportStatus.ERROR);
return;
@ -145,7 +143,7 @@ public class AddTaggedHashesToHashDb implements GeneralReportModule {
List<TagName> tagNames = configPanel.getSelectedTagNames();
if (tagNames.isEmpty()) {
logger.log(Level.WARNING, "No tags selected for export."); //NON-NLS
MessageNotifyUtil.Message.error(Bundle.AddTaggedHashesToHashDb_error_noTagsSelected());
progressPanel.updateStatusLabel(Bundle.AddTaggedHashesToHashDb_error_noTagsSelected());
progressPanel.setIndeterminate(false);
progressPanel.complete(ReportProgressPanel.ReportStatus.ERROR);
return;
@ -172,14 +170,14 @@ public class AddTaggedHashesToHashDb implements GeneralReportModule {
failedExports.add(tag.getContent().getName());
}
} else {
JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), "Unable to add the " + (tags.size() > 1 ? "files" : "file") + " to the hash set. Hashes have not been calculated. Please configure and run an appropriate ingest module.", "Add to Hash Set Error", JOptionPane.ERROR_MESSAGE);
progressPanel.updateStatusLabel("Unable to add the " + (tags.size() > 1 ? "files" : "file") + " to the hash set. Hashes have not been calculated. Please configure and run an appropriate ingest module.");
break;
}
}
}
} catch (TskCoreException ex) {
Logger.getLogger(AddTaggedHashesToHashDb.class.getName()).log(Level.SEVERE, "Error adding to hash set", ex);
JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), "Error getting selected tags for case.", "Hash Export Error", JOptionPane.ERROR_MESSAGE);
progressPanel.updateStatusLabel("Error getting selected tags for case.");
}
}
if (!failedExports.isEmpty()) {
@ -193,7 +191,7 @@ public class AddTaggedHashesToHashDb implements GeneralReportModule {
errorMessage.append(".");
}
}
JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), errorMessage.toString(), "Hash Export Error", JOptionPane.ERROR_MESSAGE);
progressPanel.updateStatusLabel(errorMessage.toString());
}
progressPanel.setIndeterminate(false);

View File

@ -100,10 +100,7 @@ class AddTaggedHashesToHashDbConfigPanel extends javax.swing.JPanel {
// There may not be a case open when configuring report modules for Command Line execution
tagNames = Case.getCurrentCaseThrows().getServices().getTagsManager().getTagNamesInUse();
} catch (TskCoreException ex) {
Logger.getLogger(AddTaggedHashesToHashDbConfigPanel.class.getName()).log(Level.WARNING, "Failed to get tag names", ex);
// ELTODO remove all these JOptionPane.showMessageDialog(this, "Error getting tag names for case.", "Tag Names Not Found", JOptionPane.ERROR_MESSAGE);
// import javax.swing.JOptionPane;
// import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
Logger.getLogger(AddTaggedHashesToHashDbConfigPanel.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex);
} catch (NoCurrentCaseException ex) {
// There may not be a case open when configuring report modules for Command Line execution
Logger.getLogger(AddTaggedHashesToHashDbConfigPanel.class.getName()).log(Level.WARNING, "Exception while getting open case.", ex);