Merge branch 'develop' of https://github.com/sleuthkit/autopsy into 7852-CleanUpScoCrChanges

This commit is contained in:
William Schaefer 2021-09-01 14:56:36 -04:00
commit c3880f11dc
42 changed files with 564 additions and 1461 deletions

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2017 Basis Technology Corp.
* Copyright 2011-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -43,6 +43,7 @@ import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.autopsy.coreutils.Version;
import org.sleuthkit.autopsy.guiutils.JFileChooserFactory;
/**
* The action associated with the Case/Open Case menu item via the layer.xml
@ -64,6 +65,8 @@ public final class CaseOpenAction extends CallableSystemAction implements Action
private static final Logger LOGGER = Logger.getLogger(CaseOpenAction.class.getName());
private final FileFilter caseMetadataFileFilter;
private final JFileChooserFactory fileChooserHelper;
/**
* Constructs the action associated with the Case/Open Case menu item via
* the layer.xml file, a toolbar button, and the Open Case button of the
@ -72,6 +75,7 @@ public final class CaseOpenAction extends CallableSystemAction implements Action
*/
public CaseOpenAction() {
caseMetadataFileFilter = new FileNameExtensionFilter(NbBundle.getMessage(CaseOpenAction.class, "CaseOpenAction.autFilter.title", Version.getName(), CaseMetadata.getFileExtension()), CaseMetadata.getFileExtension().substring(1));
fileChooserHelper = new JFileChooserFactory();
}
/**
@ -80,7 +84,7 @@ public final class CaseOpenAction extends CallableSystemAction implements Action
* to open the case described by the file.
*/
void openCaseSelectionWindow() {
JFileChooser fileChooser = new JFileChooser();
JFileChooser fileChooser = fileChooserHelper.getChooser();
fileChooser.setDragEnabled(false);
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
fileChooser.setMultiSelectionEnabled(false);

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2018 Basis Technology Corp.
* Copyright 2011-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -35,6 +35,7 @@ import org.sleuthkit.autopsy.coreutils.DriveUtils;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.autopsy.coreutils.PathValidator;
import org.sleuthkit.autopsy.coreutils.TimeZoneUtils;
import org.sleuthkit.autopsy.guiutils.JFileChooserFactory;
import org.sleuthkit.datamodel.HashUtility;
/**
@ -48,8 +49,10 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
private static final long serialVersionUID = 1L;
private static final String PROP_LASTIMAGE_PATH = "LBL_LastImage_PATH"; //NON-NLS
private static final String[] SECTOR_SIZE_CHOICES = {"Auto Detect", "512", "1024", "2048", "4096"};
private final JFileChooser fileChooser = new JFileChooser();
private final JFileChooserFactory fileChooserHelper = new JFileChooserFactory();
private JFileChooser fileChooser;
private final String contextName;
private final List<FileFilter> fileChooserFilters;
/**
* Creates new form ImageFilePanel
@ -73,14 +76,7 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
sectorSizeComboBox.setSelectedIndex(0);
errorLabel.setVisible(false);
fileChooser.setDragEnabled(false);
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
fileChooser.setMultiSelectionEnabled(false);
fileChooserFilters.forEach(fileChooser::addChoosableFileFilter);
if (fileChooserFilters.isEmpty() == false) {
fileChooser.setFileFilter(fileChooserFilters.get(0));
}
this.fileChooserFilters = fileChooserFilters;
}
/**
@ -133,6 +129,21 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
return sha256HashTextField;
}
private JFileChooser getChooser() {
if(fileChooser == null) {
fileChooser = fileChooserHelper.getChooser();
fileChooser.setDragEnabled(false);
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
fileChooser.setMultiSelectionEnabled(false);
fileChooserFilters.forEach(fileChooser::addChoosableFileFilter);
if (fileChooserFilters.isEmpty() == false) {
fileChooser.setFileFilter(fileChooserFilters.get(0));
}
}
return fileChooser;
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
@ -298,12 +309,13 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
String oldText = getContentPaths();
// set the current directory of the FileChooser if the ImagePath Field is valid
File currentDir = new File(oldText);
JFileChooser chooser = getChooser();
if (currentDir.exists()) {
fileChooser.setCurrentDirectory(currentDir);
chooser.setCurrentDirectory(currentDir);
}
if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
String path = fileChooser.getSelectedFile().getPath();
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
String path = chooser.getSelectedFile().getPath();
if (path.endsWith(".001")) {
String zeroX3_path = StringUtils.removeEnd(path, ".001") + ".000";
if (new File(zeroX3_path).exists()) {

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2018 Basis Technology Corp.
* Copyright 2011-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -32,6 +32,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.coreutils.TimeZoneUtils;
import org.sleuthkit.autopsy.guiutils.JFileChooserFactory;
import org.sleuthkit.autopsy.imagewriter.ImageWriterSettings;
/**
@ -58,7 +59,8 @@ final class LocalDiskPanel extends JPanel {
private static final long serialVersionUID = 1L;
private LocalDisk localDisk;
private boolean enableNext = false;
private final JFileChooser fc = new JFileChooser();
private JFileChooser fc;
private final JFileChooserFactory chooserHelper;
/**
* Creates new form LocalDiskPanel
@ -68,6 +70,7 @@ final class LocalDiskPanel extends JPanel {
customInit();
createTimeZoneList();
createSectorSizeList();
chooserHelper = new JFileChooserFactory();
}
/**
@ -261,6 +264,7 @@ final class LocalDiskPanel extends JPanel {
}//GEN-LAST:event_pathTextFieldKeyReleased
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
fc = chooserHelper.getChooser();
String oldText = pathTextField.getText();
// set the current directory of the FileChooser if the ImagePath Field is valid
File currentFile = new File(oldText);

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2012-2018 Basis Technology Corp.
* Copyright 2012-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -32,6 +32,7 @@ import org.openide.util.NbBundle;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.coreutils.DriveUtils;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.guiutils.JFileChooserFactory;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
@ -45,7 +46,8 @@ class MissingImageDialog extends javax.swing.JDialog {
long obj_id;
SleuthkitCase db;
private final JFileChooser fileChooser = new JFileChooser();
private JFileChooser fileChooser;
private final JFileChooserFactory chooserHelper;
/**
* Instantiate a MissingImageDialog.
@ -59,16 +61,7 @@ class MissingImageDialog extends javax.swing.JDialog {
this.db = db;
initComponents();
fileChooser.setDragEnabled(false);
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
fileChooser.setMultiSelectionEnabled(false);
List<FileFilter> fileFiltersList = ImageDSProcessor.getFileFiltersList();
for (FileFilter fileFilter : fileFiltersList) {
fileChooser.addChoosableFileFilter(fileFilter);
}
fileChooser.setFileFilter(fileFiltersList.get(0));
chooserHelper = new JFileChooserFactory();
selectButton.setEnabled(false);
}
@ -270,6 +263,19 @@ class MissingImageDialog extends javax.swing.JDialog {
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
if(fileChooser == null) {
fileChooser = chooserHelper.getChooser();
fileChooser.setDragEnabled(false);
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
fileChooser.setMultiSelectionEnabled(false);
List<FileFilter> fileFiltersList = ImageDSProcessor.getFileFiltersList();
for (FileFilter fileFilter : fileFiltersList) {
fileChooser.addChoosableFileFilter(fileFilter);
}
fileChooser.setFileFilter(fileFiltersList.get(0));
}
String oldText = pathNameTextField.getText();
lbWarning.setText("");
// set the current directory of the FileChooser if the ImagePath Field is valid

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2020 Basis Technology Corp.
* Copyright 2011-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -30,6 +30,7 @@ import javax.swing.event.DocumentListener;
import org.sleuthkit.autopsy.casemodule.Case.CaseType;
import org.sleuthkit.autopsy.coreutils.PathValidator;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.guiutils.JFileChooserFactory;
/**
* The JPanel for the first page of the new case wizard.
@ -37,7 +38,7 @@ import org.sleuthkit.autopsy.coreutils.PlatformUtil;
@SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
final class NewCaseVisualPanel1 extends JPanel implements DocumentListener {
private final JFileChooser fileChooser = new JFileChooser();
private final JFileChooserFactory fileChooserHelper = new JFileChooserFactory();
private final NewCaseWizardPanel1 wizPanel;
/**
@ -353,8 +354,9 @@ final class NewCaseVisualPanel1 extends JPanel implements DocumentListener {
* @param evt the action event
*/
private void caseDirBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_caseDirBrowseButtonActionPerformed
JFileChooser fileChooser = fileChooserHelper.getChooser();
fileChooser.setDragEnabled(false);
if (!caseParentDirTextField.getText().trim().equals("")) {
if (!caseParentDirTextField.getText().trim().isEmpty()) {
fileChooser.setCurrentDirectory(new File(caseParentDirTextField.getText()));
}
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2019 Basis Technology Corp.
* Copyright 2019-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,8 +1,9 @@
CommandLineIngestSettingPanel_empty_report_name_mgs=Report profile name was empty, no profile created.
CommandLineIngestSettingPanel_existing_report_name_mgs=Report profile name was already exists, no profile created.
CommandLineIngestSettingPanel_invalid_report_name_mgs=Report profile name contained illegal characters, no profile created.
CommandListIngestSettingsPanel_Default_Report_DisplayName=Default
CommandListIngestSettingsPanel_Make_Config=Make new profile...
CommandListIngestSettingsPanel_Report_Name_Msg=Please supply a report profile name (commas not allowed):
CommandListIngestSettingsPanel_Report_Name_Msg=Please supply a report profile name (letters, digits, and underscore characters only):
OpenIDE-Module-Name=CommandLineAutopsy
OptionsCategory_Keywords_Command_Line_Ingest_Settings=Command Line Ingest Settings
OptionsCategory_Keywords_General=Options

View File

@ -280,19 +280,16 @@ public class CommandLineIngestSettingsPanel extends javax.swing.JPanel {
add(nodePanel, java.awt.BorderLayout.CENTER);
}// </editor-fold>//GEN-END:initComponents
@Messages({
"CommandListIngestSettingsPanel_Report_Name_Msg=Please supply a report profile name (commas not allowed):",
"CommandListIngestSettingsPanel_Report_Name_Msg=Please supply a report profile name (letters, digits, and underscore characters only):",
"CommandLineIngestSettingPanel_empty_report_name_mgs=Report profile name was empty, no profile created.",
"CommandLineIngestSettingPanel_existing_report_name_mgs=Report profile name was already exists, no profile created."
"CommandLineIngestSettingPanel_existing_report_name_mgs=Report profile name was already exists, no profile created.",
"CommandLineIngestSettingPanel_invalid_report_name_mgs=Report profile name contained illegal characters, no profile created."
})
private void bnEditReportSettingsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnEditReportSettingsActionPerformed
String reportName = getReportName();
if (reportName.equals(Bundle.CommandListIngestSettingsPanel_Make_Config())) {
reportName = JOptionPane.showInputDialog(this, Bundle.CommandListIngestSettingsPanel_Report_Name_Msg());
// sanitize report name. Remove all commas because in CommandLineOptionProcessor we use commas
// to separate multiple report names
reportName = reportName.replaceAll(",", "");
// User hit cancel
if (reportName == null) {
return;
@ -302,6 +299,15 @@ public class CommandLineIngestSettingsPanel extends javax.swing.JPanel {
} else if (doesReportProfileNameExist(reportName)) {
JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.CommandLineIngestSettingPanel_existing_report_name_mgs());
return;
} else {
// sanitize report name
String originalReportName = reportName;
reportName = reportName.replaceAll("[^A-Za-z0-9_]", "");
if (reportName.isEmpty() || (!(originalReportName.equals(reportName)))) {
// report name contained only invalid characters, display error
JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.CommandLineIngestSettingPanel_invalid_report_name_mgs());
return;
}
}
}

View File

@ -24,6 +24,7 @@ import java.awt.KeyboardFocusManager;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.logging.Level;
@ -38,6 +39,7 @@ import org.openide.nodes.AbstractNode;
import org.openide.nodes.Node;
import org.openide.util.Lookup;
import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.communications.ModifiableProxyLookup;
import org.sleuthkit.autopsy.corecomponents.TableFilterNode;
import org.sleuthkit.autopsy.coreutils.Logger;
@ -46,8 +48,10 @@ import org.sleuthkit.autopsy.directorytree.DataResultFilterNode;
import org.sleuthkit.datamodel.AbstractContent;
import org.sleuthkit.datamodel.Account;
import org.sleuthkit.datamodel.BlackboardArtifact;
import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_ASSOCIATED_OBJECT;
import org.sleuthkit.datamodel.BlackboardAttribute;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.SleuthkitCase;
/**
* A Panel that shows the media (thumbnails) for the selected account.
@ -65,6 +69,7 @@ final class MediaViewer extends JPanel implements RelationshipsViewer, ExplorerM
private final MessageDataContent contentViewer;
private MediaViewerWorker worker;
private SelectionWorker selectionWorker;
@Messages({
"MediaViewer_Name=Media Attachments"
@ -106,12 +111,16 @@ final class MediaViewer extends JPanel implements RelationshipsViewer, ExplorerM
@Override
public void setSelectionInfo(SelectionInfo info) {
contentViewer.setNode(null);
thumbnailViewer.resetComponent();
thumbnailViewer.setNode(null);
if (worker != null) {
worker.cancel(true);
}
if(selectionWorker != null) {
selectionWorker.cancel(true);
}
worker = new MediaViewerWorker(info);
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
@ -181,21 +190,66 @@ final class MediaViewer extends JPanel implements RelationshipsViewer, ExplorerM
*/
private void handleNodeSelectionChange() {
final Node[] nodes = tableEM.getSelectedNodes();
contentViewer.setNode(null);
if(selectionWorker != null) {
selectionWorker.cancel(true);
}
if (nodes != null && nodes.length == 1) {
AbstractContent thumbnail = nodes[0].getLookup().lookup(AbstractContent.class);
if (thumbnail != null) {
try {
Content parentContent = thumbnail.getParent();
if (parentContent != null && parentContent instanceof BlackboardArtifact) {
contentViewer.setNode(new BlackboardArtifactNode((BlackboardArtifact) parentContent));
}
} catch (TskCoreException ex) {
logger.log(Level.WARNING, "Unable to get parent Content from AbstraceContent instance.", ex); //NON-NLS
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
selectionWorker = new SelectionWorker(thumbnail);
selectionWorker.execute();
}
}
}
/**
* A SwingWorker to get the artifact associated with the selected thumbnail.
*/
private class SelectionWorker extends SwingWorker<BlackboardArtifact, Void> {
private final AbstractContent thumbnail;
// Construct a SelectionWorker.
SelectionWorker(AbstractContent thumbnail) {
this.thumbnail = thumbnail;
}
@Override
protected BlackboardArtifact doInBackground() throws Exception {
SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase();
List<BlackboardArtifact> artifactsList = skCase.getBlackboardArtifacts(TSK_ASSOCIATED_OBJECT, thumbnail.getId());
for (BlackboardArtifact contextArtifact : artifactsList) {
BlackboardAttribute associatedArtifactAttribute = contextArtifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT));
if (associatedArtifactAttribute != null) {
long artifactId = associatedArtifactAttribute.getValueLong();
return contextArtifact.getSleuthkitCase().getBlackboardArtifact(artifactId);
}
}
} else {
contentViewer.setNode(null);
return null;
}
@Override
protected void done() {
if (isCancelled()) {
return;
}
try {
BlackboardArtifact artifact = get();
if (artifact != null) {
contentViewer.setNode(new BlackboardArtifactNode(artifact));
} else {
contentViewer.setNode(null);
}
} catch (InterruptedException | ExecutionException ex) {
logger.log(Level.SEVERE, "Failed message viewer based on thumbnail selection. thumbnailID = " + thumbnail.getId(), ex);
} finally {
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2018-2019 Basis Technology Corp.
* Copyright 2018-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -56,6 +56,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.guiutils.JFileChooserFactory;
import org.sleuthkit.datamodel.TskCoreException;
import org.xml.sax.SAXException;
@ -76,6 +77,8 @@ class PListViewer extends javax.swing.JPanel implements FileTypeViewer, Explorer
private NSObject rootDict;
private final JFileChooserFactory fileChooserHelper = new JFileChooserFactory();
/**
* Creates new form PListViewer
*/
@ -203,7 +206,7 @@ class PListViewer extends javax.swing.JPanel implements FileTypeViewer, Explorer
return;
}
final JFileChooser fileChooser = new JFileChooser();
final JFileChooser fileChooser = fileChooserHelper.getChooser();
fileChooser.setCurrentDirectory(new File(openCase.getExportDirectory()));
fileChooser.setFileFilter(new FileNameExtensionFilter("XML file", "xml"));

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2018-2019 Basis Technology Corp.
* Copyright 2018-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -49,6 +49,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.autopsy.coreutils.SQLiteTableReader;
import org.sleuthkit.autopsy.guiutils.JFileChooserFactory;
/**
* A file content viewer for SQLite database files.
@ -75,6 +76,8 @@ class SQLiteViewer extends javax.swing.JPanel implements FileTypeViewer {
SwingWorker<?, ?> worker;
private final JFileChooserFactory chooserHelper = new JFileChooserFactory();
/**
* Constructs a file content viewer for SQLite database files.
*/
@ -280,7 +283,7 @@ class SQLiteViewer extends javax.swing.JPanel implements FileTypeViewer {
private void exportCsvButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportCsvButtonActionPerformed
Case openCase = Case.getCurrentCase();
File caseDirectory = new File(openCase.getExportDirectory());
JFileChooser fileChooser = new JFileChooser();
JFileChooser fileChooser = chooserHelper.getChooser();
fileChooser.setDragEnabled(false);
fileChooser.setCurrentDirectory(caseDirectory);
//Set a filter to let the filechooser only work for csv files

View File

@ -40,6 +40,7 @@ import org.sleuthkit.datamodel.TskCoreException;
*/
@ServiceProvider(service = DataContentViewer.class, position = 7)
public class AnalysisResultsContentViewer implements DataContentViewer {
private static final Logger logger = Logger.getLogger(AnalysisResultsContentPanel.class.getName());
// isPreferred value
@ -50,8 +51,6 @@ public class AnalysisResultsContentViewer implements DataContentViewer {
private SwingWorker<?, ?> worker = null;
@NbBundle.Messages({
"AnalysisResultsContentViewer_title=Analysis Results"
})

View File

@ -55,6 +55,7 @@ import org.sleuthkit.autopsy.machinesettings.UserMachinePreferencesException;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.coreutils.Version;
import org.sleuthkit.autopsy.guiutils.JFileChooserFactory;
import org.sleuthkit.autopsy.machinesettings.UserMachinePreferences.TempDirChoice;
import org.sleuthkit.autopsy.report.ReportBranding;
@ -82,8 +83,8 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
private static final long serialVersionUID = 1L;
private static final String DEFAULT_HEAP_DUMP_FILE_FIELD = "";
private final JFileChooser logoFileChooser;
private final JFileChooser tempDirChooser;
private JFileChooser logoFileChooser;
private JFileChooser tempDirChooser;
private static final String ETC_FOLDER_NAME = "etc";
private static final String CONFIG_FILE_EXTENSION = ".conf";
private static final long ONE_BILLION = 1000000000L; //used to roughly convert system memory from bytes to gigabytes
@ -94,27 +95,17 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
private String initialMemValue = Long.toString(Runtime.getRuntime().maxMemory() / ONE_BILLION);
private final ReportBranding reportBranding;
private final JFileChooser heapFileChooser;
private JFileChooser heapFileChooser;
private final JFileChooserFactory logoChooserHelper = new JFileChooserFactory();
private final JFileChooserFactory heapChooserHelper = new JFileChooserFactory();
private final JFileChooserFactory tempChooserHelper = new JFileChooserFactory();
/**
* Instantiate the Autopsy options panel.
*/
AutopsyOptionsPanel() {
initComponents();
logoFileChooser = new JFileChooser();
logoFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
logoFileChooser.setMultiSelectionEnabled(false);
logoFileChooser.setAcceptAllFileFilterUsed(false);
logoFileChooser.setFileFilter(new GeneralFilter(GeneralFilter.GRAPHIC_IMAGE_EXTS, GeneralFilter.GRAPHIC_IMG_DECR));
tempDirChooser = new JFileChooser();
tempDirChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
tempDirChooser.setMultiSelectionEnabled(false);
heapFileChooser = new JFileChooser();
heapFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
heapFileChooser.setMultiSelectionEnabled(false);
if (!isJVMHeapSettingsCapable()) {
//32 bit JVM has a max heap size of 1.4 gb to 4 gb depending on OS
//So disabling the setting of heap size when the JVM is not 64 bit
@ -1242,6 +1233,11 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
"# {0} - path",
"AutopsyOptionsPanel_tempDirectoryBrowseButtonActionPerformed_onInvalidPath_description=Unable to create temporary directory within specified path: {0}",})
private void tempDirectoryBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tempDirectoryBrowseButtonActionPerformed
if(tempDirChooser == null) {
tempDirChooser = tempChooserHelper.getChooser();
tempDirChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
tempDirChooser.setMultiSelectionEnabled(false);
}
int returnState = tempDirChooser.showOpenDialog(this);
if (returnState == JFileChooser.APPROVE_OPTION) {
String specifiedPath = tempDirChooser.getSelectedFile().getPath();
@ -1318,6 +1314,13 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
}//GEN-LAST:event_defaultLogoRBActionPerformed
private void browseLogosButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseLogosButtonActionPerformed
if(logoFileChooser == null) {
logoFileChooser = logoChooserHelper.getChooser();
logoFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
logoFileChooser.setMultiSelectionEnabled(false);
logoFileChooser.setAcceptAllFileFilterUsed(false);
logoFileChooser.setFileFilter(new GeneralFilter(GeneralFilter.GRAPHIC_IMAGE_EXTS, GeneralFilter.GRAPHIC_IMG_DECR));
}
String oldLogoPath = agencyLogoPathField.getText();
int returnState = logoFileChooser.showOpenDialog(this);
if (returnState == JFileChooser.APPROVE_OPTION) {
@ -1360,6 +1363,11 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
"AutopsyOptionsPanel_heapDumpBrowseButtonActionPerformed_fileAlreadyExistsMessage=File already exists. Please select a new location."
})
private void heapDumpBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_heapDumpBrowseButtonActionPerformed
if(heapFileChooser == null) {
heapFileChooser = heapChooserHelper.getChooser();
heapFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
heapFileChooser.setMultiSelectionEnabled(false);
}
String oldHeapPath = heapDumpFileField.getText();
if (!StringUtils.isBlank(oldHeapPath)) {
heapFileChooser.setCurrentDirectory(new File(oldHeapPath));

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2018 Basis Technology Corp.
* Copyright 2011-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -32,6 +32,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.autopsy.coreutils.PathValidator;
import org.sleuthkit.autopsy.coreutils.TimeZoneUtils;
import org.sleuthkit.autopsy.guiutils.JFileChooserFactory;
/**
* Allows examiner to supply a raw data source.
@ -41,7 +42,8 @@ final class RawDSInputPanel extends JPanel implements DocumentListener {
private static final long TWO_GB = 2000000000L;
private static final long serialVersionUID = 1L; //default
private final String PROP_LASTINPUT_PATH = "LBL_LastInputFile_PATH";
private final JFileChooser fc = new JFileChooser();
private JFileChooser fc;
private JFileChooserFactory chooserHelper = new JFileChooserFactory();
// Externally supplied name is used to store settings
private final String contextName;
/**
@ -51,11 +53,6 @@ final class RawDSInputPanel extends JPanel implements DocumentListener {
initComponents();
errorLabel.setVisible(false);
fc.setDragEnabled(false);
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
fc.setMultiSelectionEnabled(false);
this.contextName = context;
}
@ -200,18 +197,25 @@ final class RawDSInputPanel extends JPanel implements DocumentListener {
}// </editor-fold>//GEN-END:initComponents
@SuppressWarnings("deprecation")
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
String oldText = pathTextField.getText();
// set the current directory of the FileChooser if the ImagePath Field is valid
File currentDir = new File(oldText);
if (currentDir.exists()) {
fc.setCurrentDirectory(currentDir);
}
if (fc == null) {
fc = chooserHelper.getChooser();
fc.setDragEnabled(false);
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
fc.setMultiSelectionEnabled(false);
}
int retval = fc.showOpenDialog(this);
if (retval == JFileChooser.APPROVE_OPTION) {
String path = fc.getSelectedFile().getPath();
pathTextField.setText(path);
}
String oldText = pathTextField.getText();
// set the current directory of the FileChooser if the ImagePath Field is valid
File currentDir = new File(oldText);
if (currentDir.exists()) {
fc.setCurrentDirectory(currentDir);
}
int retval = fc.showOpenDialog(this);
if (retval == JFileChooser.APPROVE_OPTION) {
String path = fc.getSelectedFile().getPath();
pathTextField.setText(path);
}
}//GEN-LAST:event_browseButtonActionPerformed
private void j2GBBreakupRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_j2GBBreakupRadioButtonActionPerformed

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2019 Basis Technology Corp.
* Copyright 2019-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -30,6 +30,7 @@ import javax.swing.JPanel;
import org.apache.commons.lang3.StringUtils;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.autopsy.guiutils.JFileChooserFactory;
/**
* Allows an examiner to configure the XRY Data source processor.
@ -49,6 +50,8 @@ final class XRYDataSourceProcessorConfigPanel extends JPanel {
//panel will indicate when it is ready for an update.
private final PropertyChangeSupport pcs;
private final JFileChooserFactory chooserHelper = new JFileChooserFactory();
/**
* Creates new form XRYDataSourceConfigPanel.
* Prevent direct instantiation.
@ -191,7 +194,7 @@ final class XRYDataSourceProcessorConfigPanel extends JPanel {
* report folder.
*/
private void fileBrowserButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileBrowserButtonActionPerformed
JFileChooser fileChooser = new JFileChooser();
JFileChooser fileChooser = chooserHelper.getChooser();
fileChooser.setMultiSelectionEnabled(false);
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
Optional<Path> lastUsedPath = getLastUsedPath();

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2018 Basis Technology Corp.
* Copyright 2011-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -26,6 +26,7 @@ import javax.swing.event.DocumentListener;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.GeneralFilter;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.guiutils.JFileChooserFactory;
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
/**
@ -35,7 +36,9 @@ import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
class AddExternalViewerRulePanel extends javax.swing.JPanel {
private static final Logger logger = Logger.getLogger(AddExternalViewerRulePanel.class.getName());
private final JFileChooser fc = new JFileChooser();
private static final long serialVersionUID = 1L;
private JFileChooser fc;
private final JFileChooserFactory chooserHelper = new JFileChooserFactory();
private static final GeneralFilter exeFilter = new GeneralFilter(GeneralFilter.EXECUTABLE_EXTS, GeneralFilter.EXECUTABLE_DESC);
enum EVENT {
@ -47,10 +50,6 @@ class AddExternalViewerRulePanel extends javax.swing.JPanel {
*/
AddExternalViewerRulePanel() {
initComponents();
fc.setDragEnabled(false);
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
fc.setMultiSelectionEnabled(false);
fc.setFileFilter(exeFilter);
customize();
}
@ -260,6 +259,13 @@ class AddExternalViewerRulePanel extends javax.swing.JPanel {
}// </editor-fold>//GEN-END:initComponents
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
if(fc == null) {
fc = chooserHelper.getChooser();
fc.setDragEnabled(false);
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
fc.setMultiSelectionEnabled(false);
fc.setFileFilter(exeFilter);
}
int returnState = fc.showOpenDialog(this);
if (returnState == JFileChooser.APPROVE_OPTION) {
String path = fc.getSelectedFile().getPath();

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2019 Basis Technology Corp.
* Copyright 2019-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -51,6 +51,7 @@ import org.sleuthkit.autopsy.datamodel.AbstractAbstractFileNode.AbstractFileProp
import org.openide.nodes.Node;
import org.openide.nodes.Node.PropertySet;
import org.openide.nodes.Node.Property;
import org.sleuthkit.autopsy.guiutils.JFileChooserFactory;
/**
* Exports CSV version of result nodes to a location selected by the user.
@ -69,6 +70,8 @@ public final class ExportCSVAction extends AbstractAction {
// node in the array returns a reference to the same action object from Node.getActions(boolean).
private static ExportCSVAction instance;
private static final JFileChooserFactory chooserHelper = new JFileChooserFactory();
/**
* Get an instance of the Action. See above for why
* the class is a singleton.
@ -125,7 +128,7 @@ public final class ExportCSVAction extends AbstractAction {
// Set up the file chooser with a default name and either the Export
// folder or the last used folder.
String fileName = getDefaultOutputFileName(nodesToExport.iterator().next().getParentNode());
JFileChooser fileChooser = new JFileChooser();
JFileChooser fileChooser = chooserHelper.getChooser();
fileChooser.setCurrentDirectory(new File(getExportDirectory(Case.getCurrentCaseThrows())));
fileChooser.setSelectedFile(new File(fileName));
fileChooser.setFileFilter(new FileNameExtensionFilter("csv file", "csv"));

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2018 Basis Technology Corp.
* Copyright 2011-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -33,6 +33,7 @@ import org.netbeans.spi.options.OptionsPanelController;
import org.sleuthkit.autopsy.casemodule.GeneralFilter;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.guiutils.JFileChooserFactory;
/**
* An options panel for the user to create, edit, and delete associations for
@ -42,9 +43,13 @@ import org.sleuthkit.autopsy.coreutils.PlatformUtil;
@SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
final class ExternalViewerGlobalSettingsPanel extends javax.swing.JPanel implements OptionsPanel {
private static final long serialVersionUID = 1L;
private ExternalViewerGlobalSettingsTableModel tableModel;
public ExternalViewerGlobalSettingsPanel() {
private final JFileChooserFactory chooserHelper = new JFileChooserFactory();
ExternalViewerGlobalSettingsPanel() {
this(new ExternalViewerGlobalSettingsTableModel(new String[] {
"Mime type/Extension", "Application"}));
}
@ -52,7 +57,7 @@ final class ExternalViewerGlobalSettingsPanel extends javax.swing.JPanel impleme
/**
* Creates new form ExternalViewerGlobalSettingsPanel
*/
public ExternalViewerGlobalSettingsPanel(ExternalViewerGlobalSettingsTableModel tableModel) {
ExternalViewerGlobalSettingsPanel(ExternalViewerGlobalSettingsTableModel tableModel) {
initComponents();
this.tableModel = tableModel;
customizeComponents(tableModel);
@ -335,7 +340,7 @@ final class ExternalViewerGlobalSettingsPanel extends javax.swing.JPanel impleme
}//GEN-LAST:event_deleteRuleButtonActionPerformed
private void browseHxDDirectoryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseHxDDirectoryActionPerformed
JFileChooser fileWindow = new JFileChooser();
JFileChooser fileWindow = chooserHelper.getChooser();
fileWindow.setFileSelectionMode(JFileChooser.FILES_ONLY);
GeneralFilter exeFilter = new GeneralFilter(GeneralFilter.EXECUTABLE_EXTS, GeneralFilter.EXECUTABLE_DESC);
File HxDPathFile = new File(HxDPath.getText());

View File

@ -33,9 +33,6 @@ import java.util.List;
import java.util.Set;
import java.util.HashSet;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;
import java.util.logging.Level;
import javax.swing.AbstractAction;
import javax.swing.JFileChooser;
@ -50,6 +47,7 @@ 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.guiutils.JFileChooserFactory;
import org.sleuthkit.datamodel.AbstractContent;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Content;
@ -78,9 +76,7 @@ final class ExtractUnallocAction extends AbstractAction {
private final Volume volume;
private final Image image;
private final FutureTask<JFileChooser> futureFileChooser = new FutureTask<>(CustomFileChooser::new);
private JFileChooser fileChooser = null;
private final JFileChooserFactory chooserFactory;
/**
* Create an instance of ExtractUnallocAction with a volume.
@ -111,8 +107,7 @@ final class ExtractUnallocAction extends AbstractAction {
this.volume = null;
this.image = image;
ExecutorService executor = Executors.newSingleThreadExecutor();
executor.execute(futureFileChooser);
chooserFactory = new JFileChooserFactory(CustomFileChooser.class);
}
/**
@ -138,13 +133,7 @@ final class ExtractUnallocAction extends AbstractAction {
return;
}
if (fileChooser == null) {
try {
fileChooser = futureFileChooser.get();
} catch (InterruptedException | ExecutionException ex) {
fileChooser = new CustomFileChooser();
}
}
JFileChooser fileChooser = chooserFactory.getChooser();
fileChooser.setCurrentDirectory(new File(getExportDirectory(openCase)));
if (JFileChooser.APPROVE_OPTION != fileChooser.showSaveDialog((Component) event.getSource())) {
@ -753,11 +742,11 @@ final class ExtractUnallocAction extends AbstractAction {
}
// A Custome JFileChooser for this Action Class.
private class CustomFileChooser extends JFileChooser {
public static class CustomFileChooser extends JFileChooser {
private static final long serialVersionUID = 1L;
CustomFileChooser() {
public CustomFileChooser() {
initalize();
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013-2019 Basis Technology Corp.
* Copyright 2013-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -42,6 +42,7 @@ import org.sleuthkit.autopsy.coreutils.FileUtil;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.datamodel.ContentUtils;
import org.sleuthkit.autopsy.guiutils.JFileChooserFactory;
import org.sleuthkit.datamodel.AbstractFile;
/**
@ -52,6 +53,9 @@ public class ExtractActionHelper {
private final Logger logger = Logger.getLogger(ExtractActionHelper.class.getName());
private String userDefinedExportPath;
private final JFileChooserFactory extractFileHelper = new JFileChooserFactory();
private final JFileChooserFactory extractFilesHelper = new JFileChooserFactory();
/**
* Extract the specified collection of files with an event specified for
* context.
@ -89,7 +93,7 @@ public class ExtractActionHelper {
logger.log(Level.INFO, "Exception while getting open case.", ex); //NON-NLS
return;
}
JFileChooser fileChooser = new JFileChooser();
JFileChooser fileChooser = extractFileHelper.getChooser();
fileChooser.setCurrentDirectory(new File(getExportDirectory(openCase)));
// If there is an attribute name, change the ":". Otherwise the extracted file will be hidden
fileChooser.setSelectedFile(new File(FileUtil.escapeFileName(selectedFile.getName())));
@ -117,7 +121,7 @@ public class ExtractActionHelper {
logger.log(Level.INFO, "Exception while getting open case.", ex); //NON-NLS
return;
}
JFileChooser folderChooser = new JFileChooser();
JFileChooser folderChooser = extractFilesHelper.getChooser();
folderChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
folderChooser.setCurrentDirectory(new File(getExportDirectory(openCase)));
if (folderChooser.showSaveDialog((Component) event.getSource()) == JFileChooser.APPROVE_OPTION) {

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2019 Basis Technology Corp.
* Copyright 2019-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -35,6 +35,7 @@ import org.sleuthkit.autopsy.casemodule.GeneralFilter;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.guiutils.JFileChooserFactory;
/**
* A panel to allow the user to set the custom properties of the geolocation
@ -47,6 +48,8 @@ final class GeolocationSettingsPanel extends javax.swing.JPanel implements Optio
private static final Logger logger = Logger.getLogger(GeolocationSettingsPanel.class.getName());
private static final JFileChooserFactory chooserHelper = new JFileChooserFactory();
/**
* Creates new GeolocationSettingsPanel
*/
@ -313,7 +316,7 @@ final class GeolocationSettingsPanel extends javax.swing.JPanel implements Optio
}// </editor-fold>//GEN-END:initComponents
private void zipFileBrowseBntActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_zipFileBrowseBntActionPerformed
JFileChooser fileWindow = new JFileChooser();
JFileChooser fileWindow = chooserHelper.getChooser();
fileWindow.setFileSelectionMode(JFileChooser.FILES_ONLY);
GeneralFilter fileFilter = new GeneralFilter(Arrays.asList(".zip"), "Zips (*.zip)"); //NON-NLS
fileWindow.setDragEnabled(false);
@ -374,7 +377,7 @@ final class GeolocationSettingsPanel extends javax.swing.JPanel implements Optio
}//GEN-LAST:event_mbtilesRBtnActionPerformed
private void mbtilesBrowseBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mbtilesBrowseBtnActionPerformed
JFileChooser fileWindow = new JFileChooser();
JFileChooser fileWindow = chooserHelper.getChooser();
fileWindow.setFileSelectionMode(JFileChooser.FILES_ONLY);
GeneralFilter fileFilter = new GeneralFilter(Arrays.asList(".mbtiles"), "MBTiles (*.mbtiles)"); //NON-NLS
fileWindow.setDragEnabled(false);

View File

@ -0,0 +1,147 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.guiutils;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.awt.Cursor;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
/**
* Factory class for initializing JFileChooser instances in a background thread.
*
* It is a known issue that on Windows a JFileChooser can take an indeterminate
* amount of time to initialize. Therefore when a JFileChooser is initialized on
* the EDT there is the potential for the UI to appear hung while initialization
* is occurring.
*
* Initializing a JFileChooser in a background thread should prevent the UI from
* hanging. Using this Factory class at component construction time should allow
* enough time for the JFileChooser to be initialized in the background before
* the UI user causes an event which will launch the JFileChooser. If the
* JFileChooser is not initialized prior to the event occurring, the EDT will be
* blocked, but the wait cursor will appear.
*
* https://stackoverflow.com/questions/49792375/jfilechooser-is-very-slow-when-using-windows-look-and-feel
*/
public final class JFileChooserFactory {
private static final Logger logger = Logger.getLogger(JFileChooserFactory.class.getName());
private final FutureTask<JFileChooser> futureFileChooser;
private JFileChooser chooser;
private final ExecutorService executor;
/**
* Create a new instance of the factory. The constructor will kick off an
* executor to execute the initializing the JFileChooser task.
*/
public JFileChooserFactory() {
this(null);
}
/**
* Create a new instance of the factory using a class that extends
* JFileChooser. The class default constructor will be called to initialize
* the class.
*
* The passed in Class must be public and its default constructor must be
* public.
*
* @param cls Class type to initialize.
*/
public JFileChooserFactory(Class<? extends JFileChooser> cls) {
if (cls == null) {
futureFileChooser = new FutureTask<>(JFileChooser::new);
} else {
futureFileChooser = new FutureTask<>(new ChooserCallable(cls));
}
executor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("JFileChooser-background-thread").build());
executor.execute(futureFileChooser);
}
/**
* Return and instance of JFileChooser to the caller.
*
* This call may block the EDT if the JFileChooser initialization has not
* completed.
*
* @return
*/
@ThreadConfined(type = ThreadConfined.ThreadType.AWT)
public JFileChooser getChooser() {
if (chooser == null) {
// In case this takes a moment show the wait cursor.
try {
WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try {
// get() will only return when the initilization of the
// JFileChooser has completed.
chooser = futureFileChooser.get();
} catch (InterruptedException | ExecutionException ex) {
// An exception is generally not expected. On the off chance
// one does occur save the situation by created a new
// instance in the EDT.
logger.log(Level.WARNING, "Failed to initialize JFileChooser in background thread.");
chooser = new JFileChooser();
}
} finally {
WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
executor.shutdown();
}
}
return chooser;
}
/**
* Simple Callable that will initialize any subclass of JFileChooser using
* the default constructor.
*
* Note that the class and default constructor must be public for this to
* work properly.
*/
private class ChooserCallable implements Callable<JFileChooser> {
private final Class<? extends JFileChooser> type;
/**
* Construct a new instance for the given class type.
*
* @param type Class type to initialize.
*/
ChooserCallable(Class<? extends JFileChooser> type) {
this.type = type;
}
@Override
public JFileChooser call() throws Exception {
return type.newInstance();
}
}
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2018 Basis Technology Corp.
* Copyright 2018-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -61,6 +61,7 @@ import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.guiutils.JFileChooserFactory;
/**
* Dashboard for viewing metrics and controlling the health monitor.
@ -86,6 +87,8 @@ public class HealthMonitorDashboard {
private JDialog dialog = null;
private final Container parentWindow;
private final JFileChooserFactory chooserHelper;
/**
* Create an instance of the dashboard.
* Call display() after creation to show the dashboard.
@ -95,6 +98,7 @@ public class HealthMonitorDashboard {
timingData = new HashMap<>();
userData = new ArrayList<>();
parentWindow = parent;
chooserHelper = new JFileChooserFactory();
}
/**
@ -495,7 +499,7 @@ public class HealthMonitorDashboard {
reportButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
JFileChooser reportFileChooser = new JFileChooser();
JFileChooser reportFileChooser = chooserHelper.getChooser();
reportFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
reportFileChooser.setCurrentDirectory(new File(UserPreferences.getHealthMonitorReportPath()));
final DateFormat csvTimestampFormat = new SimpleDateFormat("yyyyMMdd_HHmmss");

View File

@ -115,7 +115,7 @@ IngestJobSettingsPanel.jButtonSelectAll.text=Select All
IngestJobSettingsPanel.jButtonDeselectAll.text=Deselect All
IngestManager.cancellingIngest.msgDlg.text=Cancelling all currently running ingest jobs
IngestManager.serviceIsDown.msgDlg.text={0} is down
ProfilePanel.messages.profileNameContainsIllegalCharacter=Profile name contains an illegal character
ProfilePanel.messages.profileNameContainsIllegalCharacter=Profile name contains an illegal character. Only \nletters, digits, and underscore characters are allowed.
ProfilePanel.messages.profilesMustBeNamed=Ingest profile must be named.
ProfilePanel.newProfileText=NewEmptyProfile
ProfilePanel.profileDescLabel.text=Description:

View File

@ -135,7 +135,6 @@ ModuleTableModel.colName.module=\u30e2\u30b8\u30e5\u30fc\u30eb
OpenIDE-Module-Name=\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8
OptionsCategory_Keywords_IngestOptions=\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8
OptionsCategory_Name_IngestOptions=\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8
ProfilePanel.messages.profileNameContainsIllegalCharacter=\u30d7\u30ed\u30d5\u30a1\u30a4\u30eb\u540d\u306b\u4e0d\u6b63\u306a\u6587\u5b57\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059
ProfilePanel.messages.profilesMustBeNamed=\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u30d7\u30ed\u30d5\u30a1\u30a4\u30eb\u306b\u540d\u524d\u3092\u4ed8\u3051\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002
ProfilePanel.newProfileText=NewEmptyProfile
ProfilePanel.profileDescLabel.text=\u8aac\u660e\:

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2018 Basis Technology Corp.
* Copyright 2011-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -19,10 +19,6 @@
package org.sleuthkit.autopsy.ingest;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.util.NbBundle;
@ -39,13 +35,12 @@ class ProfilePanel extends IngestModuleGlobalSettingsPanel {
"ProfilePanel.profileNameLabel.text=Profile Name:",
"ProfilePanel.newProfileText=NewEmptyProfile",
"ProfilePanel.messages.profilesMustBeNamed=Ingest profile must be named.",
"ProfilePanel.messages.profileNameContainsIllegalCharacter=Profile name contains an illegal character"})
"ProfilePanel.messages.profileNameContainsIllegalCharacter=Profile name contains an illegal character. Only \nletters, digits, and underscore characters are allowed."})
private final IngestJobSettingsPanel ingestSettingsPanel;
private final IngestJobSettings settings;
private IngestProfile profile;
private final static String NEW_PROFILE_NAME = NbBundle.getMessage(ProfilePanel.class, "ProfilePanel.newProfileText");
private static final List<String> ILLEGAL_NAME_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", "/", ":", "*", "?", "\"", "<", ">")));
/**
* Creates new form ProfilePanel
@ -231,8 +226,12 @@ class ProfilePanel extends IngestModuleGlobalSettingsPanel {
/**
* Save a new or edited profile.
*/
void store() {
boolean store() {
if (!isValidDefinition(false)) {
return false;
}
saveSettings();
return true;
}
void load() {
@ -241,40 +240,32 @@ class ProfilePanel extends IngestModuleGlobalSettingsPanel {
/**
* Checks that information entered constitutes a valid ingest profile.
*
* @param dispayWarnings boolean flag whether to display warnings if an error occurred.
*
* @return true for valid, false for invalid.
*/
boolean isValidDefinition() {
if (getProfileName().isEmpty()) {
NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(
NbBundle.getMessage(ProfilePanel.class, "ProfilePanel.messages.profilesMustBeNamed"),
NotifyDescriptor.WARNING_MESSAGE);
DialogDisplayer.getDefault().notify(notifyDesc);
return false;
}
if (!containsOnlyLegalChars(getProfileName(), ILLEGAL_NAME_CHARS)) {
NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(
NbBundle.getMessage(ProfilePanel.class, "ProfilePanel.messages.profileNameContainsIllegalCharacter"),
NotifyDescriptor.WARNING_MESSAGE);
DialogDisplayer.getDefault().notify(notifyDesc);
return false;
}
return true;
}
/**
* Checks an input string for the use of illegal characters.
*
* @param toBeChecked The input string.
* @param illegalChars The characters deemed to be illegal.
*
* @return True if the string does not contain illegal characters, false
* otherwise.
*/
private static boolean containsOnlyLegalChars(String toBeChecked, List<String> illegalChars) {
for (String illegalChar : illegalChars) {
if (toBeChecked.contains(illegalChar)) {
return false;
boolean isValidDefinition(boolean dispayWarnings) {
String profileName = getProfileName();
if (profileName.isEmpty()) {
if (dispayWarnings) {
NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(
NbBundle.getMessage(ProfilePanel.class, "ProfilePanel.messages.profilesMustBeNamed"),
NotifyDescriptor.WARNING_MESSAGE);
DialogDisplayer.getDefault().notify(notifyDesc);
}
return false;
}
// check if the name contains illegal characters
String sanitizedName = profileName.replaceAll("[^A-Za-z0-9_]", "");
if (!(profileName.equals(sanitizedName))) {
if (dispayWarnings) {
NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(
NbBundle.getMessage(ProfilePanel.class, "ProfilePanel.messages.profileNameContainsIllegalCharacter"),
NotifyDescriptor.WARNING_MESSAGE);
DialogDisplayer.getDefault().notify(notifyDesc);
}
return false;
}
return true;
}

View File

@ -416,7 +416,7 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op
do {
option = JOptionPane.CANCEL_OPTION;
dialog.display(panel);
} while (option == JOptionPane.OK_OPTION && !panel.isValidDefinition());
} while (option == JOptionPane.OK_OPTION && !panel.isValidDefinition(true));
if (option == JOptionPane.OK_OPTION) {

View File

@ -1,7 +1,7 @@
/*
* Autopsy
*
* Copyright 2019 Basis Technology Corp.
* Copyright 2019-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -50,6 +50,7 @@ import org.apache.commons.lang.StringUtils;
import org.openide.util.NbBundle;
import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.guiutils.JFileChooserFactory;
import org.sleuthkit.autopsy.logicalimager.dsp.DriveListUtils;
/**
@ -63,6 +64,7 @@ final class ConfigVisualPanel1 extends JPanel {
private static final String DEFAULT_CONFIG_FILE_NAME = "logical-imager-config.json";
private static final String UPDATE_UI_EVENT_NAME = "UPDATE_UI";
private String configFilename;
private final JFileChooserFactory chooserHelper;
/**
* Creates new form ConfigVisualPanel1
@ -74,6 +76,7 @@ final class ConfigVisualPanel1 extends JPanel {
refreshDriveList();
updateControls();
});
chooserHelper = new JFileChooserFactory();
}
@NbBundle.Messages({
@ -332,7 +335,7 @@ final class ConfigVisualPanel1 extends JPanel {
"ConfigVisualPanel1.configurationError=Configuration error",})
private void chooseFile(String title) {
final String jsonExt = ".json"; // NON-NLS
JFileChooser fileChooser = new JFileChooser();
JFileChooser fileChooser = chooserHelper.getChooser();
fileChooser.setDialogTitle(title);
fileChooser.setDragEnabled(false);
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);

View File

@ -1,7 +1,7 @@
/*
* Autopsy
*
* Copyright 2019 Basis Technology Corp.
* Copyright 2019-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -44,6 +44,7 @@ import javax.swing.table.TableColumn;
import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.guiutils.JFileChooserFactory;
/**
* Panel for adding an logical image file from drive letters. Allows the user to
@ -64,10 +65,10 @@ final class LogicalImagerPanel extends JPanel implements DocumentListener {
private static final int NUMBER_OF_VISIBLE_COLUMNS = 2;
private static final String[] EMPTY_LIST_DATA = {};
private final JFileChooser fileChooser = new JFileChooser();
private final Pattern regex = Pattern.compile("Logical_Imager_(.+)_(\\d{4})(\\d{2})(\\d{2})_(\\d{2})_(\\d{2})_(\\d{2})");
private Path manualImageDirPath;
private DefaultTableModel imageTableModel;
private final JFileChooserFactory chooserHelper;
/**
* Creates new form LogicalImagerPanel
@ -80,6 +81,7 @@ final class LogicalImagerPanel extends JPanel implements DocumentListener {
configureImageTable();
jScrollPane1.setBorder(null);
clearImageTable();
chooserHelper = new JFileChooserFactory();
}
/**
@ -316,6 +318,7 @@ final class LogicalImagerPanel extends JPanel implements DocumentListener {
"LogicalImagerPanel.messageLabel.directoryFormatInvalid=Directory {0} does not match format Logical_Imager_HOSTNAME_yyyymmdd_HH_MM_SS"
})
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
JFileChooser fileChooser = chooserHelper.getChooser();
imageTable.clearSelection();
manualImageDirPath = null;
setErrorMessage(NO_IMAGE_SELECTED);

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013-2020 Basis Technology Corp.
* Copyright 2013-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -45,6 +45,7 @@ import org.sleuthkit.datamodel.TskData;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
import org.sleuthkit.autopsy.featureaccess.FeatureAccessUtils;
import org.sleuthkit.autopsy.guiutils.JFileChooserFactory;
/**
* Instances of this class allow a user to create a new hash database and add it
@ -56,12 +57,14 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
private static final String DEFAULT_FILE_NAME = NbBundle
.getMessage(HashDbCreateDatabaseDialog.class, "HashDbCreateDatabaseDialog.defaultFileName");
private static final long serialVersionUID = 1L;
private JFileChooser fileChooser = null;
private HashDb newHashDb = null;
private final static String LAST_FILE_PATH_KEY = "HashDbCreate_Path";
private CentralRepoOrganization selectedOrg = null;
private List<CentralRepoOrganization> orgs = null;
static final String HASH_DATABASE_DIR_NAME = "HashDatabases";
private final JFileChooserFactory chooserFactory;
/**
* Displays a dialog that allows a user to create a new hash database and
@ -70,10 +73,11 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
*/
HashDbCreateDatabaseDialog() {
super((JFrame) WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(HashDbCreateDatabaseDialog.class, "HashDbCreateDatabaseDialog.createHashDbMsg"), true);
initFileChooser();
initComponents();
chooserFactory = new JFileChooserFactory(CustomFileChooser.class);
enableComponents();
display();
}
/**
@ -85,42 +89,6 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
return newHashDb;
}
private void initFileChooser() {
fileChooser = new JFileChooser() {
@Override
public void approveSelection() {
File selectedFile = getSelectedFile();
if (!FilenameUtils.getExtension(selectedFile.getName()).equalsIgnoreCase(HashDbManager.getHashDatabaseFileExtension())) {
if (JOptionPane.showConfirmDialog(this,
NbBundle.getMessage(this.getClass(),
"HashDbCreateDatabaseDialog.hashDbMustHaveFileExtensionMsg",
HashDbManager.getHashDatabaseFileExtension()),
NbBundle.getMessage(this.getClass(),
"HashDbCreateDatabaseDialog.fileNameErr"),
JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) {
cancelSelection();
}
return;
}
if (selectedFile.exists()) {
if (JOptionPane.showConfirmDialog(this,
NbBundle.getMessage(this.getClass(),
"HashDbCreateDatabaseDialog.fileNameAlreadyExistsMsg"),
NbBundle.getMessage(this.getClass(),
"HashDbCreateDatabaseDialog.fileExistsErr"),
JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) {
cancelSelection();
}
return;
}
super.approveSelection();
}
};
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
fileChooser.setDragEnabled(false);
fileChooser.setMultiSelectionEnabled(false);
}
private void display() {
setLocationRelativeTo(getOwner());
setVisible(true);
@ -170,6 +138,43 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
}
}
/**
* Customize the JFileChooser.
*/
public static class CustomFileChooser extends JFileChooser {
private static final long serialVersionUID = 1L;
@Override
public void approveSelection() {
File selectedFile = getSelectedFile();
if (!FilenameUtils.getExtension(selectedFile.getName()).equalsIgnoreCase(HashDbManager.getHashDatabaseFileExtension())) {
if (JOptionPane.showConfirmDialog(this,
NbBundle.getMessage(this.getClass(),
"HashDbCreateDatabaseDialog.hashDbMustHaveFileExtensionMsg",
HashDbManager.getHashDatabaseFileExtension()),
NbBundle.getMessage(this.getClass(),
"HashDbCreateDatabaseDialog.fileNameErr"),
JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) {
cancelSelection();
}
return;
}
if (selectedFile.exists()) {
if (JOptionPane.showConfirmDialog(this,
NbBundle.getMessage(this.getClass(),
"HashDbCreateDatabaseDialog.fileNameAlreadyExistsMsg"),
NbBundle.getMessage(this.getClass(),
"HashDbCreateDatabaseDialog.fileExistsErr"),
JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) {
cancelSelection();
}
return;
}
super.approveSelection();
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
@ -435,6 +440,16 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
path.append(File.separator).append(DEFAULT_FILE_NAME);
}
path.append(".").append(HashDbManager.getHashDatabaseFileExtension());
if(fileChooser == null) {
fileChooser = chooserFactory.getChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
fileChooser.setDragEnabled(false);
fileChooser.setMultiSelectionEnabled(false);
}
fileChooser.setSelectedFile(new File(path.toString()));
if (fileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
File databaseFile = fileChooser.getSelectedFile();

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013-2020 Basis Technology Corp.
* Copyright 2013-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -43,6 +43,7 @@ import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDbManagerExc
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
import org.sleuthkit.autopsy.featureaccess.FeatureAccessUtils;
import org.sleuthkit.autopsy.guiutils.JFileChooserFactory;
/**
* Instances of this class allow a user to select an existing hash database and
@ -52,12 +53,13 @@ import org.sleuthkit.autopsy.featureaccess.FeatureAccessUtils;
@SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
private final JFileChooser fileChooser;
private JFileChooser fileChooser;
private String selectedFilePath = "";
private HashDb selectedHashDb = null;
private final static String LAST_FILE_PATH_KEY = "HashDbImport_Path";
private CentralRepoOrganization selectedOrg = null;
private List<CentralRepoOrganization> orgs = null;
private final JFileChooserFactory chooserHelper;
/**
* Displays a dialog that allows a user to select an existing hash database
@ -68,10 +70,9 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
super((JFrame) WindowManager.getDefault().getMainWindow(),
NbBundle.getMessage(HashDbImportDatabaseDialog.class, "HashDbImportDatabaseDialog.importHashDbMsg"),
true);
this.fileChooser = new JFileChooser();
chooserHelper = new JFileChooserFactory();
initComponents();
enableComponents();
initFileChooser();
display();
}
@ -84,16 +85,6 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
return selectedHashDb;
}
private void initFileChooser() {
fileChooser.setDragEnabled(false);
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
String[] EXTENSION = new String[]{"txt", "kdb", "idx", "hash", "Hash", "hsh"}; //NON-NLS
FileNameExtensionFilter filter = new FileNameExtensionFilter(
NbBundle.getMessage(this.getClass(), "HashDbImportDatabaseDialog.fileNameExtFilter.text"), EXTENSION);
fileChooser.setFileFilter(filter);
fileChooser.setMultiSelectionEnabled(false);
}
private void display() {
setLocationRelativeTo(WindowManager.getDefault().getMainWindow());
setVisible(true);
@ -421,6 +412,17 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
}// </editor-fold>//GEN-END:initComponents
private void openButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openButtonActionPerformed
if(fileChooser == null) {
fileChooser = chooserHelper.getChooser();
fileChooser.setDragEnabled(false);
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
String[] EXTENSION = new String[]{"txt", "kdb", "idx", "hash", "Hash", "hsh"}; //NON-NLS
FileNameExtensionFilter filter = new FileNameExtensionFilter(
NbBundle.getMessage(this.getClass(), "HashDbImportDatabaseDialog.fileNameExtFilter.text"), EXTENSION);
fileChooser.setFileFilter(filter);
fileChooser.setMultiSelectionEnabled(false);
}
String lastBaseDirectory = Paths.get(PlatformUtil.getUserConfigDirectory(), HashDbCreateDatabaseDialog.HASH_DATABASE_DIR_NAME).toString();
if (ModuleSettings.settingExists(ModuleSettings.MAIN_SETTINGS, LAST_FILE_PATH_KEY)) {
lastBaseDirectory = ModuleSettings.getConfigSetting(ModuleSettings.MAIN_SETTINGS, LAST_FILE_PATH_KEY);

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2018 Basis Technology Corp.
* Copyright 2011-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -65,6 +65,7 @@ import org.sleuthkit.datamodel.SleuthkitJNI;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskData;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
import org.sleuthkit.autopsy.guiutils.JFileChooserFactory;
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb.KnownFilesType;
/**
@ -94,6 +95,8 @@ public class HashDbManager implements PropertyChangeListener {
private static final String KNOWN_STATUS_PARAM = "knownStatus";
private static final Pattern OFFICIAL_FILENAME = Pattern.compile("(?<" + DB_NAME_PARAM + ">.+?)\\.(?<" + KNOWN_STATUS_PARAM + ">.+?)\\." + KDB_EXT);
private final JFileChooserFactory chooserHelper;
private static final FilenameFilter DEFAULT_KDB_FILTER = new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
@ -136,6 +139,7 @@ public class HashDbManager implements PropertyChangeListener {
}
private HashDbManager() {
chooserHelper = new JFileChooserFactory();
loadHashsetsConfiguration();
}
@ -870,7 +874,7 @@ public class HashDbManager implements PropertyChangeListener {
private String searchForFile() {
String filePath = null;
JFileChooser fc = new JFileChooser();
JFileChooser fc = chooserHelper.getChooser();
fc.setDragEnabled(false);
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
String[] EXTENSION = new String[]{"txt", "idx", "hash", "Hash", "kdb"}; //NON-NLS

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013-2018 Basis Technology Corp.
* Copyright 2013-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.report.modules.stix;
import java.io.File;
import javax.swing.JFileChooser;
import org.sleuthkit.autopsy.guiutils.JFileChooserFactory;
/**
* Configuration panel for STIX report generation.
@ -29,6 +30,7 @@ public class STIXReportModuleConfigPanel extends javax.swing.JPanel {
String stixFile = null;
boolean showAllResults;
private final JFileChooserFactory chooserHelper;
/**
* Creates new form STIXReportModuleConfigPanel
@ -37,6 +39,7 @@ public class STIXReportModuleConfigPanel extends javax.swing.JPanel {
initComponents();
showAllResults = false;
jCheckBox1.setSelected(false);
chooserHelper = new JFileChooserFactory();
}
void setConfiguration(STIXReportModuleSettings settings) {
@ -138,7 +141,7 @@ public class STIXReportModuleConfigPanel extends javax.swing.JPanel {
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
JFileChooser fileChooser = new JFileChooser();
JFileChooser fileChooser = chooserHelper.getChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
File currentSelection = new File(jStixFileTextField.getText());

View File

@ -262,6 +262,7 @@ final class AutoIngestDashboard extends JPanel implements Observer {
* Shut down parts of the AutoIngestDashboard which were initialized
*/
void shutDown() {
scheduledRefreshThreadPoolExecutor.shutdownNow();
if (autoIngestMonitor != null) {
autoIngestMonitor.shutDown();
}

View File

@ -70,7 +70,7 @@ final class AutoIngestJobsNode extends AbstractNode {
* refresh events
*/
AutoIngestJobsNode(AutoIngestMonitor monitor, AutoIngestJobStatus status, EventBus eventBus) {
super(Children.create(new AutoIngestNodeChildren(monitor, status, eventBus), true));
super(Children.create(new AutoIngestNodeChildren(monitor, status, eventBus), false));
refreshChildrenEventBus = eventBus;
}

View File

@ -30,32 +30,35 @@ import javax.annotation.concurrent.Immutable;
public final class Manifest implements Serializable {
private static final long serialVersionUID = 1L;
private final String filePath;
private final Path filePath;
private final Date dateFileCreated;
private final String caseName;
private final String deviceId;
private final String dataSourcePath;
private final Path dataSourcePath;
private final String dataSourceFileName;
private final Map<String, String> manifestProperties;
public Manifest(Path manifestFilePath, Date dateFileCreated, String caseName, String deviceId, Path dataSourcePath, Map<String, String> manifestProperties) {
this.filePath = manifestFilePath.toString();
this.dateFileCreated = dateFileCreated;
this.filePath = Paths.get(manifestFilePath.toString());
this.dateFileCreated = new Date(dateFileCreated.getTime());
this.caseName = caseName;
this.deviceId = deviceId;
if (null != dataSourcePath) {
this.dataSourcePath = dataSourcePath.toString();
this.dataSourcePath = Paths.get(dataSourcePath.toString());
dataSourceFileName = dataSourcePath.getFileName().toString();
} else {
this.dataSourcePath = "";
this.dataSourcePath = Paths.get("");
dataSourceFileName = "";
}
this.manifestProperties = new HashMap<>(manifestProperties);
}
public Path getFilePath() {
return Paths.get(this.filePath);
return this.filePath;
}
public Date getDateFileCreated() {
return new Date(this.dateFileCreated.getTime());
return dateFileCreated;
}
public String getCaseName() {
@ -67,11 +70,11 @@ public final class Manifest implements Serializable {
}
public Path getDataSourcePath() {
return Paths.get(dataSourcePath);
return dataSourcePath;
}
public String getDataSourceFileName() {
return Paths.get(dataSourcePath).getFileName().toString();
return dataSourceFileName;
}
public Map<String, String> getManifestProperties() {

View File

@ -38,7 +38,7 @@ PROJECT_NAME = "Documentation utilisateur Autopsy"
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 4.19.0
PROJECT_NUMBER = 4.19.1
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
@ -1025,7 +1025,7 @@ GENERATE_HTML = YES
# The default directory is: html.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_OUTPUT = 4.19.0
HTML_OUTPUT = 4.19.1
# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
# generated HTML page (for example: .htm, .php, .asp).

View File

@ -0,0 +1,2 @@
# Sun Aug 29 15:02:07 2021 +0200
user-docs_fr.lastupdated=4f62b90f652ba12dae1b2286fb3eb065f00e5311

View File

@ -8,6 +8,9 @@ Ceci est le guide de l'utilisateur de la <a href="http://www.sleuthkit.org/autop
Remarque: pour les utilisateurs exécutant Autopsy sur des appareils Mac, les fonctionnalités disponibles via la boîte de dialogue "Tools"->"Options" et décritent dans cette documentation sont accessibles via la barre de menu système sous "Préférences" ou via le raccourci Cmd +, (touche "Cmd" + touche "plus").
Version originale de ce guide:
- <a href="https://sleuthkit.org/autopsy/docs/user-docs/latest">Dernière version à jour</a>
Rubriques d'aide
-------
Les rubriques suivantes sont disponibles:

View File

@ -16,18 +16,22 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import subprocess
import os
# import db_diff
sys.path.insert(0, os.path.join(subprocess.getoutput("cygpath -u $TSK_HOME"), "db_diff"))
from tskdbdiff import TskDbDiff, TskDbDiffException, PGSettings
import codecs
import datetime
import logging
import os
import re
import shutil
import socket
import sqlite3
import subprocess
import sys
from sys import platform as _platform
import time
import traceback

File diff suppressed because it is too large Load Diff