mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
2229: Part 3: Use getOpenCase() instead of getCurrentCase() in casemodule.
This commit is contained in:
parent
9feb88822b
commit
3cebe82f40
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2011-2017 Basis Technology Corp.
|
* Copyright 2011-2018 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -58,10 +58,15 @@ final class AddImageWizardSelectDspVisual extends JPanel {
|
|||||||
initComponents();
|
initComponents();
|
||||||
selectedDsp = lastDspUsed;
|
selectedDsp = lastDspUsed;
|
||||||
//if the last selected DSP was the Local Disk DSP and it would be disabled then we want to select a different DSP
|
//if the last selected DSP was the Local Disk DSP and it would be disabled then we want to select a different DSP
|
||||||
if ((Case.getCurrentCase().getCaseType() == Case.CaseType.MULTI_USER_CASE) && selectedDsp.equals(LocalDiskDSProcessor.getType())) {
|
try {
|
||||||
selectedDsp = ImageDSProcessor.getType();
|
if ((Case.getOpenCase().getCaseType() == Case.CaseType.MULTI_USER_CASE) && selectedDsp.equals(LocalDiskDSProcessor.getType())) {
|
||||||
|
selectedDsp = ImageDSProcessor.getType();
|
||||||
|
}
|
||||||
|
createDataSourceProcessorButtons();
|
||||||
|
} catch (NoCurrentCaseException ex) {
|
||||||
|
logger.log(Level.SEVERE, "Exception while getting open case.", ex);
|
||||||
}
|
}
|
||||||
createDataSourceProcessorButtons();
|
|
||||||
//add actionlistner to listen for change
|
//add actionlistner to listen for change
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +101,7 @@ final class AddImageWizardSelectDspVisual extends JPanel {
|
|||||||
* Create the a button for each DataSourceProcessor that should exist as an
|
* Create the a button for each DataSourceProcessor that should exist as an
|
||||||
* option.
|
* option.
|
||||||
*/
|
*/
|
||||||
private void createDataSourceProcessorButtons() {
|
private void createDataSourceProcessorButtons() throws NoCurrentCaseException {
|
||||||
//Listener for button selection
|
//Listener for button selection
|
||||||
ActionListener cbActionListener = new ActionListener() {
|
ActionListener cbActionListener = new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -126,7 +131,7 @@ final class AddImageWizardSelectDspVisual extends JPanel {
|
|||||||
//Add the button
|
//Add the button
|
||||||
JToggleButton dspButton = createDspButton(dspType);
|
JToggleButton dspButton = createDspButton(dspType);
|
||||||
dspButton.addActionListener(cbActionListener);
|
dspButton.addActionListener(cbActionListener);
|
||||||
if ((Case.getCurrentCase().getCaseType() == Case.CaseType.MULTI_USER_CASE) && dspType.equals(LocalDiskDSProcessor.getType())){
|
if ((Case.getOpenCase().getCaseType() == Case.CaseType.MULTI_USER_CASE) && dspType.equals(LocalDiskDSProcessor.getType())){
|
||||||
dspButton.setEnabled(false); //disable the button for local disk DSP when this is a multi user case
|
dspButton.setEnabled(false); //disable the button for local disk DSP when this is a multi user case
|
||||||
dspButton.setSelected(false);
|
dspButton.setSelected(false);
|
||||||
shouldAddMultiUserWarning = true;
|
shouldAddMultiUserWarning = true;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2013-2016 Basis Technology Corp.
|
* Copyright 2013-2018 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -87,10 +87,10 @@ class AddLocalFilesTask implements Runnable {
|
|||||||
List<String> errors = new ArrayList<>();
|
List<String> errors = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
progress.setIndeterminate(true);
|
progress.setIndeterminate(true);
|
||||||
FileManager fileManager = Case.getCurrentCase().getServices().getFileManager();
|
FileManager fileManager = Case.getOpenCase().getServices().getFileManager();
|
||||||
LocalFilesDataSource newDataSource = fileManager.addLocalFilesDataSource(deviceId, rootVirtualDirectoryName, "", localFilePaths, new ProgressUpdater());
|
LocalFilesDataSource newDataSource = fileManager.addLocalFilesDataSource(deviceId, rootVirtualDirectoryName, "", localFilePaths, new ProgressUpdater());
|
||||||
newDataSources.add(newDataSource);
|
newDataSources.add(newDataSource);
|
||||||
} catch (TskDataException | TskCoreException ex) {
|
} catch (TskDataException | TskCoreException | NoCurrentCaseException ex) {
|
||||||
errors.add(ex.getMessage());
|
errors.add(ex.getMessage());
|
||||||
LOGGER.log(Level.SEVERE, String.format("Failed to add datasource: %s", ex.getMessage()), ex);
|
LOGGER.log(Level.SEVERE, String.format("Failed to add datasource: %s", ex.getMessage()), ex);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -264,7 +264,7 @@ public class ImageDSProcessor implements DataSourceProcessor, AutoIngestDataSour
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// verify that the image has a file system that TSK can process
|
// verify that the image has a file system that TSK can process
|
||||||
Case currentCase = Case.getCurrentCase();
|
Case currentCase = Case.getOpenCase();
|
||||||
if (!DataSourceUtils.imageHasFileSystem(dataSourcePath)) {
|
if (!DataSourceUtils.imageHasFileSystem(dataSourcePath)) {
|
||||||
// image does not have a file system that TSK can process
|
// image does not have a file system that TSK can process
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2011-2017 Basis Technology Corp.
|
* Copyright 2011-2018 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -42,7 +42,9 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
|||||||
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
||||||
import org.sleuthkit.autopsy.imagewriter.ImageWriterSettings;
|
import org.sleuthkit.autopsy.imagewriter.ImageWriterSettings;
|
||||||
|
|
||||||
@NbBundle.Messages({"LocalDiskPanel.refreshTablebutton.text=Refresh Local Disks"
|
@NbBundle.Messages({"LocalDiskPanel.refreshTablebutton.text=Refresh Local Disks",
|
||||||
|
"LocalDiskPanel.listener.getOpenCase.errTitle=No open case availabe",
|
||||||
|
"LocalDiskPanel.listener.getOpenCase.errMsg=LocalDiskPanel listener couldn't get the open case."
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* ImageTypePanel for adding a local disk or partition such as PhysicalDrive0 or
|
* ImageTypePanel for adding a local disk or partition such as PhysicalDrive0 or
|
||||||
@ -74,9 +76,14 @@ final class LocalDiskPanel extends JPanel {
|
|||||||
public void valueChanged(ListSelectionEvent e) {
|
public void valueChanged(ListSelectionEvent e) {
|
||||||
if (diskTable.getSelectedRow() >= 0 && diskTable.getSelectedRow() < disks.size()) {
|
if (diskTable.getSelectedRow() >= 0 && diskTable.getSelectedRow() < disks.size()) {
|
||||||
enableNext = true;
|
enableNext = true;
|
||||||
setPotentialImageWriterPath(disks.get(diskTable.getSelectedRow()));
|
|
||||||
try {
|
try {
|
||||||
|
setPotentialImageWriterPath(disks.get(diskTable.getSelectedRow()));
|
||||||
firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.UPDATE_UI.toString(), false, true);
|
firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.UPDATE_UI.toString(), false, true);
|
||||||
|
} catch (NoCurrentCaseException ex) {
|
||||||
|
logger.log(Level.SEVERE, "Exception while getting open case.", e); //NON-NLS
|
||||||
|
MessageNotifyUtil.Notify.show(Bundle.LocalDiskPanel_listener_getOpenCase_errTitle(),
|
||||||
|
Bundle.LocalDiskPanel_listener_getOpenCase_errMsg(),
|
||||||
|
MessageNotifyUtil.MessageType.ERROR);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
logger.log(Level.SEVERE, "LocalDiskPanel listener threw exception", e); //NON-NLS
|
logger.log(Level.SEVERE, "LocalDiskPanel listener threw exception", e); //NON-NLS
|
||||||
MessageNotifyUtil.Notify.show(NbBundle.getMessage(this.getClass(), "LocalDiskPanel.moduleErr"),
|
MessageNotifyUtil.Notify.show(NbBundle.getMessage(this.getClass(), "LocalDiskPanel.moduleErr"),
|
||||||
@ -375,11 +382,11 @@ final class LocalDiskPanel extends JPanel {
|
|||||||
return noFatOrphansCheckbox.isSelected();
|
return noFatOrphansCheckbox.isSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getDefaultImageWriterFolder() {
|
private static String getDefaultImageWriterFolder() throws NoCurrentCaseException {
|
||||||
return Paths.get(Case.getCurrentCase().getModuleDirectory(), "Image Writer").toString();
|
return Paths.get(Case.getOpenCase().getModuleDirectory(), "Image Writer").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setPotentialImageWriterPath(LocalDisk disk) {
|
private void setPotentialImageWriterPath(LocalDisk disk) throws NoCurrentCaseException {
|
||||||
|
|
||||||
File subDirectory = Paths.get(getDefaultImageWriterFolder()).toFile();
|
File subDirectory = Paths.get(getDefaultImageWriterFolder()).toFile();
|
||||||
if (!subDirectory.exists()) {
|
if (!subDirectory.exists()) {
|
||||||
|
@ -31,6 +31,7 @@ import javax.swing.JPanel;
|
|||||||
import javax.swing.filechooser.FileFilter;
|
import javax.swing.filechooser.FileFilter;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.openide.modules.InstalledFileLocator;
|
import org.openide.modules.InstalledFileLocator;
|
||||||
|
import org.openide.util.Exceptions;
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
import org.openide.util.NbBundle.Messages;
|
import org.openide.util.NbBundle.Messages;
|
||||||
import org.openide.util.lookup.ServiceProvider;
|
import org.openide.util.lookup.ServiceProvider;
|
||||||
@ -166,6 +167,9 @@ public class LocalFilesDSProcessor implements DataSourceProcessor, AutoIngestDat
|
|||||||
errors.add(ex.getMessage());
|
errors.add(ex.getMessage());
|
||||||
callback.done(DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS, errors, new ArrayList<>());
|
callback.done(DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS, errors, new ArrayList<>());
|
||||||
return;
|
return;
|
||||||
|
} catch (NoCurrentCaseException ex) {
|
||||||
|
logger.log(Level.WARNING, "Exception while getting open case.", ex);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,7 +188,7 @@ public class LocalFilesDSProcessor implements DataSourceProcessor, AutoIngestDat
|
|||||||
* @throws
|
* @throws
|
||||||
* org.sleuthkit.autopsy.casemodule.LocalFilesDSProcessor.L01Exception
|
* org.sleuthkit.autopsy.casemodule.LocalFilesDSProcessor.L01Exception
|
||||||
*/
|
*/
|
||||||
private List<String> extractLogicalEvidenceFileContents(final List<String> logicalEvidenceFilePaths) throws L01Exception {
|
private List<String> extractLogicalEvidenceFileContents(final List<String> logicalEvidenceFilePaths) throws L01Exception, NoCurrentCaseException {
|
||||||
final List<String> extractedPaths = new ArrayList<>();
|
final List<String> extractedPaths = new ArrayList<>();
|
||||||
Path ewfexportPath;
|
Path ewfexportPath;
|
||||||
ewfexportPath = locateEwfexportExecutable();
|
ewfexportPath = locateEwfexportExecutable();
|
||||||
@ -195,7 +199,7 @@ public class LocalFilesDSProcessor implements DataSourceProcessor, AutoIngestDat
|
|||||||
command.add("-f");
|
command.add("-f");
|
||||||
command.add("files");
|
command.add("files");
|
||||||
command.add("-t");
|
command.add("-t");
|
||||||
File l01Dir = new File(Case.getCurrentCase().getModuleDirectory(), L01_EXTRACTION_DIR); //WJS-TODO change to getOpenCase() when that method exists
|
File l01Dir = new File(Case.getOpenCase().getModuleDirectory(), L01_EXTRACTION_DIR); //WJS-TODO change to getOpenCase() when that method exists
|
||||||
if (!l01Dir.exists()) {
|
if (!l01Dir.exists()) {
|
||||||
l01Dir.mkdirs();
|
l01Dir.mkdirs();
|
||||||
}
|
}
|
||||||
@ -354,6 +358,9 @@ public class LocalFilesDSProcessor implements DataSourceProcessor, AutoIngestDat
|
|||||||
logger.log(Level.WARNING, "File extension was .l01 but contents of logical evidence file were unable to be extracted", ex);
|
logger.log(Level.WARNING, "File extension was .l01 but contents of logical evidence file were unable to be extracted", ex);
|
||||||
//contents of l01 could not be extracted don't add data source or run ingest
|
//contents of l01 could not be extracted don't add data source or run ingest
|
||||||
return 0;
|
return 0;
|
||||||
|
} catch (NoCurrentCaseException ex) {
|
||||||
|
logger.log(Level.WARNING, "Exception while getting open case.", ex);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2011-2017 Basis Technology Corp.
|
* Copyright 2011-2018 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -91,9 +91,9 @@ final class NewCaseWizardAction extends CallableSystemAction {
|
|||||||
if (EamDb.isEnabled()) { //if the eam is enabled we need to save the case organization information now
|
if (EamDb.isEnabled()) { //if the eam is enabled we need to save the case organization information now
|
||||||
EamDb dbManager = EamDb.getInstance();
|
EamDb dbManager = EamDb.getInstance();
|
||||||
if (dbManager != null) {
|
if (dbManager != null) {
|
||||||
CorrelationCase cRCase = dbManager.getCase(Case.getCurrentCase());
|
CorrelationCase cRCase = dbManager.getCase(Case.getOpenCase());
|
||||||
if (cRCase == null) {
|
if (cRCase == null) {
|
||||||
cRCase = dbManager.newCase(Case.getCurrentCase());
|
cRCase = dbManager.newCase(Case.getOpenCase());
|
||||||
}
|
}
|
||||||
if (!organizationName.isEmpty()) {
|
if (!organizationName.isEmpty()) {
|
||||||
for (EamOrganization org : dbManager.getOrganizations()) {
|
for (EamOrganization org : dbManager.getOrganizations()) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2011-2017 Basis Technology Corp.
|
* Copyright 2011-2018 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -374,8 +374,8 @@ final class RecentCases extends CallableSystemAction implements Presenter.Menu {
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
String currentCaseName = null;
|
String currentCaseName = null;
|
||||||
try {
|
try {
|
||||||
currentCaseName = Case.getCurrentCase().getDisplayName();
|
currentCaseName = Case.getOpenCase().getDisplayName();
|
||||||
} catch (IllegalStateException ex) {
|
} catch (NoCurrentCaseException ex) {
|
||||||
// in case there is no current case.
|
// in case there is no current case.
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -407,8 +407,8 @@ final class RecentCases extends CallableSystemAction implements Presenter.Menu {
|
|||||||
String[] casePaths = new String[LENGTH];
|
String[] casePaths = new String[LENGTH];
|
||||||
String currentCasePath = null;
|
String currentCasePath = null;
|
||||||
try {
|
try {
|
||||||
currentCasePath = Case.getCurrentCase().getMetadata().getFilePath().toString();
|
currentCasePath = Case.getOpenCase().getMetadata().getFilePath().toString();
|
||||||
} catch (IllegalStateException ex) {
|
} catch (NoCurrentCaseException ex) {
|
||||||
/*
|
/*
|
||||||
* There may be no current case.
|
* There may be no current case.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user