mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
Merge pull request #1245 from karlmortensen/output_paths
update paths for collab
This commit is contained in:
commit
0ce75e3e8b
@ -49,7 +49,12 @@ GetTagNameDialog.taggingErr=Tagging Error
|
||||
GetTagNameDialog.tagNameAlreadyDef.msg=A {0} tag name has already been defined.
|
||||
GetTagNameDialog.dupTagErr=Duplicate Tag Error
|
||||
OpenLogFolder.error1=Log File Not Found: {0}
|
||||
OpenLogFolder.CouldNotOpenLogFolder=Could not open log folder
|
||||
CTL_OpenLogFolder=Open Log Folder
|
||||
CTL_OpenOutputFolder=Open Output Folder
|
||||
OpenOutputFolder.error1=Output Folder Not Found: {0}
|
||||
OpenOutputFolder.noCaseOpen=No open case, therefore no current output folder available.
|
||||
OpenOutputFolder.CouldNotOpenOutputFolder=Could not open output folder
|
||||
ShowIngestProgressSnapshotAction.actionName.text=Get Ingest Progress Snapshot
|
||||
OpenPythonModulesFolderAction.actionName.text=Python Plugins
|
||||
OpenPythonModulesFolderAction.errorMsg.folderNotFound=Python plugins folder not found: {0}
|
||||
|
@ -23,16 +23,16 @@ import java.awt.event.ActionListener;
|
||||
import java.awt.Desktop;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import org.openide.DialogDisplayer;
|
||||
import org.openide.NotifyDescriptor;
|
||||
import org.openide.awt.ActionID;
|
||||
import org.openide.awt.ActionReference;
|
||||
import org.openide.awt.ActionRegistration;
|
||||
import org.openide.modules.Places;
|
||||
import org.openide.util.Exceptions;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
|
||||
/**
|
||||
* Action in menu to open the folder containing the log files
|
||||
@ -43,19 +43,20 @@ import org.sleuthkit.autopsy.casemodule.Case;
|
||||
@ActionID(id = "org.sleuthkit.autopsy.actions.OpenLogFolderAction", category = "Help")
|
||||
public final class OpenLogFolderAction implements ActionListener {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(OpenLogFolderAction.class.getName());
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
File logDir;
|
||||
if (Case.isCaseOpen()) {
|
||||
logDir = new File(Case.getCurrentCase().getLogDirectoryPath());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
logDir = new File(Places.getUserDirectory().getAbsolutePath() + File.separator + "var" + File.separator + "log");
|
||||
}
|
||||
if (logDir.exists() == false) {
|
||||
NotifyDescriptor d =
|
||||
new NotifyDescriptor.Message(
|
||||
NotifyDescriptor d
|
||||
= new NotifyDescriptor.Message(
|
||||
NbBundle.getMessage(this.getClass(), "OpenLogFolder.error1", logDir.getAbsolutePath()),
|
||||
NotifyDescriptor.ERROR_MESSAGE);
|
||||
DialogDisplayer.getDefault().notify(d);
|
||||
@ -63,7 +64,8 @@ public final class OpenLogFolderAction implements ActionListener {
|
||||
Desktop.getDesktop().open(logDir);
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(), "OpenLogFolder.CouldNotOpenLogFolder"), ex); //NON-NLS
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2015 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.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.Desktop;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.JOptionPane;
|
||||
import org.openide.DialogDisplayer;
|
||||
import org.openide.NotifyDescriptor;
|
||||
import org.openide.awt.ActionID;
|
||||
import org.openide.awt.ActionReference;
|
||||
import org.openide.awt.ActionRegistration;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
|
||||
/**
|
||||
* Action in menu to open the folder containing the output files
|
||||
*/
|
||||
@ActionRegistration(
|
||||
displayName = "#CTL_OpenOutputFolder", iconInMenu = true)
|
||||
@ActionReference(path = "Menu/Help", position = 1850)
|
||||
@ActionID(id = "org.sleuthkit.autopsy.actions.OpenOutputFolderAction", category = "Help")
|
||||
public final class OpenOutputFolderAction implements ActionListener {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(OpenOutputFolderAction.class.getName());
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
try {
|
||||
File outputDir;
|
||||
if (Case.isCaseOpen()) {
|
||||
outputDir = new File(Case.getCurrentCase().getOutputDirectory());
|
||||
if (outputDir.exists() == false) {
|
||||
NotifyDescriptor d
|
||||
= new NotifyDescriptor.Message(NbBundle.getMessage(this.getClass(),
|
||||
"OpenOutputFolder.error1", outputDir.getAbsolutePath()),
|
||||
NotifyDescriptor.ERROR_MESSAGE);
|
||||
DialogDisplayer.getDefault().notify(d);
|
||||
} else {
|
||||
Desktop.getDesktop().open(outputDir);
|
||||
}
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(null, NbBundle.getMessage(this.getClass(), "OpenOutputFolder.noCaseOpen"));
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(),"OpenOutputFolder.CouldNotOpenOutputFolder") , ex); //NON-NLS
|
||||
}
|
||||
}
|
||||
}
|
@ -133,6 +133,7 @@ Case.createCaseDir.exception.existCantRW=Cannot create case dir, already exists
|
||||
Case.createCaseDir.exception.cantCreate=Cannot create case dir\: {0}
|
||||
Case.createCaseDir.exception.cantCreateCaseDir=Could not create case directory\: {0}
|
||||
Case.createCaseDir.exception.cantCreateModDir=Could not create modules output directory\: {0}
|
||||
Case.createCaseDir.exception.cantCreateReportsDir=Could not create reports output directory\: {0}
|
||||
Case.createCaseDir.exception.gen=Could not create case directory\: {0}
|
||||
Case.OpenEventChannel.FailPopup.ErrMsg=Failed to connect to any other nodes that may be collaborating on this case.
|
||||
Case.OpenEventChannel.FailPopup.Title=Connection Failure
|
||||
|
@ -25,6 +25,9 @@ import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
@ -189,7 +192,15 @@ public class Case implements SleuthkitCase.ErrorObserver {
|
||||
private static final Logger logger = Logger.getLogger(Case.class.getName());
|
||||
static final String CASE_EXTENSION = "aut"; //NON-NLS
|
||||
static final String CASE_DOT_EXTENSION = "." + CASE_EXTENSION;
|
||||
private static String HostName;
|
||||
private final static String CACHE_FOLDER = "Cache"; //NON-NLS
|
||||
private final static String EXPORT_FOLDER = "Export"; //NON-NLS
|
||||
private final static String LOG_FOLDER = "Log"; //NON-NLS
|
||||
private final static String MODULE_FOLDER = "ModuleOutput"; //NON-NLS
|
||||
private final static String REPORTS_FOLDER = "Reports"; //NON-NLS
|
||||
private final static String TEMP_FOLDER = "Temp"; //NON-NLS
|
||||
|
||||
|
||||
// we cache if the case has data in it yet since a few places ask for it and we dont' need to keep going to DB
|
||||
private boolean hasData = false;
|
||||
|
||||
@ -322,7 +333,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
|
||||
|
||||
// create case directory if it doesn't already exist.
|
||||
if (new File(caseDir).exists() == false) {
|
||||
Case.createCaseDirectory(caseDir);
|
||||
Case.createCaseDirectory(caseDir, caseType);
|
||||
}
|
||||
|
||||
String configFilePath = caseDir + File.separator + caseName + CASE_DOT_EXTENSION;
|
||||
@ -737,100 +748,152 @@ public class Case implements SleuthkitCase.ErrorObserver {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the full path to the temp directory of this case
|
||||
* Gets the full path to the temp directory of this case. Will create it if
|
||||
* it does not already exist.
|
||||
*
|
||||
* @return tempDirectoryPath
|
||||
*/
|
||||
public String getTempDirectory() {
|
||||
if (xmlcm == null) {
|
||||
return "";
|
||||
} else {
|
||||
return xmlcm.getTempDir();
|
||||
}
|
||||
return getDirectory(TEMP_FOLDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the full path to the cache directory of this case
|
||||
* Gets the full path to the cache directory of this case. Will create it if
|
||||
* it does not already exist.
|
||||
*
|
||||
* @return cacheDirectoryPath
|
||||
*/
|
||||
public String getCacheDirectory() {
|
||||
if (xmlcm == null) {
|
||||
return "";
|
||||
} else {
|
||||
return xmlcm.getCacheDir();
|
||||
}
|
||||
return getDirectory(CACHE_FOLDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the full path to the export directory of this case
|
||||
* Gets the full path to the export directory of this case. Will create it
|
||||
* if it does not already exist.
|
||||
*
|
||||
* @return export DirectoryPath
|
||||
* @return exportDirectoryPath
|
||||
*/
|
||||
public String getExportDirectory() {
|
||||
if (xmlcm == null) {
|
||||
return "";
|
||||
} else {
|
||||
return xmlcm.getExportDir();
|
||||
}
|
||||
return getDirectory(EXPORT_FOLDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the full path to the log directory for this case.
|
||||
* Gets the full path to the log directory of this case. Will create it if
|
||||
* it does not already exist.
|
||||
*
|
||||
* @return The log directory path.
|
||||
* @return logDirectoryPath
|
||||
*/
|
||||
public String getLogDirectoryPath() {
|
||||
if (xmlcm == null) {
|
||||
return "";
|
||||
} else {
|
||||
return xmlcm.getLogDir();
|
||||
}
|
||||
return getDirectory(LOG_FOLDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the created date of this case
|
||||
* Get the reports directory path where modules should save their reports.
|
||||
* Will create it if it does not already exist.
|
||||
*
|
||||
* @return case creation date
|
||||
* @return absolute path to the report output directory
|
||||
*/
|
||||
public String getCreatedDate() {
|
||||
if (xmlcm == null) {
|
||||
return "";
|
||||
} else {
|
||||
return xmlcm.getCreatedDate();
|
||||
}
|
||||
public String getReportDirectory() {
|
||||
return getDirectory(REPORTS_FOLDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the index where extracted text is stored for the case.
|
||||
* Get module output directory path where modules should save their
|
||||
* permanent data.
|
||||
*
|
||||
* @return Index name.
|
||||
* @return absolute path to the module output directory
|
||||
*/
|
||||
public String getTextIndexName() {
|
||||
if (xmlcm == null) {
|
||||
return "";
|
||||
} else {
|
||||
return xmlcm.getTextIndexName();
|
||||
}
|
||||
public String getModuleDirectory() {
|
||||
return getDirectory(MODULE_FOLDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get absolute module output directory path where modules should save their
|
||||
* permanent data The directory is a subdirectory of this case dir.
|
||||
* Get the output directory path where modules should save their permanent
|
||||
* data. If single-user case, the directory is a subdirectory of the case
|
||||
* directory. If multi-user case, the directory is a subdirectory of
|
||||
* HostName, which is a subdirectory of the case directory.
|
||||
*
|
||||
* @return absolute path to the module output dir
|
||||
* @return the path to the host output directory
|
||||
*/
|
||||
public String getModulesOutputDirAbsPath() {
|
||||
return this.getCaseDirectory() + File.separator + getModulesOutputDirRelPath();
|
||||
public String getOutputDirectory() {
|
||||
return getHostDirectory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the specified directory path, create it if it does not already exist.
|
||||
*
|
||||
* @return absolute path to the directory
|
||||
*/
|
||||
private String getDirectory(String input) {
|
||||
File theDirectory = new File(getHostDirectory() + File.separator + input);
|
||||
if (!theDirectory.exists()) { // Create it if it doesn't exist already.
|
||||
theDirectory.mkdirs();
|
||||
}
|
||||
return theDirectory.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get relative (with respect to case dir) module output directory path
|
||||
* where modules should save their permanent data The directory is a
|
||||
* where modules should save their permanent data. The directory is a
|
||||
* subdirectory of this case dir.
|
||||
*
|
||||
* @return relative path to the module output dir
|
||||
*/
|
||||
public String getModuleOutputDirectoryRelativePath() {
|
||||
Path thePath;
|
||||
if (getCaseType() == CaseType.MULTI_USER_CASE) {
|
||||
thePath = Paths.get(getLocalHostName(), MODULE_FOLDER);
|
||||
} else {
|
||||
thePath = Paths.get(MODULE_FOLDER);
|
||||
}
|
||||
// Do not autocreate this relative path. It will have already been
|
||||
// created when the case was made.
|
||||
return thePath.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the host output directory path where modules should save their
|
||||
* permanent data. If single-user case, the directory is a subdirectory of
|
||||
* the case directory. If multi-user case, the directory is a subdirectory
|
||||
* of HostName, which is a subdirectory of the case directory.
|
||||
*
|
||||
* @return the path to the host output directory
|
||||
*/
|
||||
private String getHostDirectory() {
|
||||
String caseDirectory = getCaseDirectory();
|
||||
Path hostPath;
|
||||
if (caseType == CaseType.MULTI_USER_CASE) {
|
||||
hostPath = Paths.get(caseDirectory, getLocalHostName());
|
||||
} else {
|
||||
hostPath = Paths.get(caseDirectory);
|
||||
}
|
||||
if (!hostPath.toFile().exists()) {
|
||||
hostPath.toFile().mkdirs();
|
||||
}
|
||||
return hostPath.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get module output directory path where modules should save their
|
||||
* permanent data.
|
||||
*
|
||||
* @return absolute path to the module output directory
|
||||
* @deprecated Use getModuleDirectory() instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public String getModulesOutputDirAbsPath() {
|
||||
return getModuleDirectory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get relative (with respect to case dir) module output directory path
|
||||
* where modules should save their permanent data. The directory is a
|
||||
* subdirectory of this case dir.
|
||||
*
|
||||
* @return relative path to the module output dir
|
||||
* @deprecated Use getModuleOutputDirectoryRelativePath() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static String getModulesOutputDirRelPath() {
|
||||
return "ModuleOutput"; //NON-NLS
|
||||
}
|
||||
@ -860,6 +923,32 @@ public class Case implements SleuthkitCase.ErrorObserver {
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the created date of this case
|
||||
*
|
||||
* @return case creation date
|
||||
*/
|
||||
public String getCreatedDate() {
|
||||
if (xmlcm == null) {
|
||||
return "";
|
||||
} else {
|
||||
return xmlcm.getCreatedDate();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the index where extracted text is stored for the case.
|
||||
*
|
||||
* @return Index name.
|
||||
*/
|
||||
public String getTextIndexName() {
|
||||
if (xmlcm == null) {
|
||||
return "";
|
||||
} else {
|
||||
return xmlcm.getTextIndexName();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the time zone(s) of the image(s) in this case.
|
||||
*
|
||||
@ -1044,28 +1133,15 @@ public class Case implements SleuthkitCase.ErrorObserver {
|
||||
* The methods below are used to manage the case directories (creating,
|
||||
* checking, deleting, etc)
|
||||
*/
|
||||
/**
|
||||
* to create the case directory
|
||||
*
|
||||
* @param caseDir Path to the case directory (typically base + case name)
|
||||
* @param caseName the case name (used only for error messages)
|
||||
*
|
||||
* @throws CaseActionException throw if could not create the case dir
|
||||
* @Deprecated
|
||||
*/
|
||||
static void createCaseDirectory(String caseDir, String caseName) throws CaseActionException {
|
||||
createCaseDirectory(caseDir);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the case directory and its needed subfolders.
|
||||
*
|
||||
* @param caseDir Path to the case directory (typically base + case name)
|
||||
*
|
||||
* @param caseType The type of case, single-user or multi-user
|
||||
* @throws CaseActionException throw if could not create the case dir
|
||||
*/
|
||||
static void createCaseDirectory(String caseDir) throws CaseActionException {
|
||||
static void createCaseDirectory(String caseDir, CaseType caseType) throws CaseActionException {
|
||||
|
||||
File caseDirF = new File(caseDir);
|
||||
if (caseDirF.exists()) {
|
||||
@ -1086,17 +1162,22 @@ public class Case implements SleuthkitCase.ErrorObserver {
|
||||
}
|
||||
|
||||
// create the folders inside the case directory
|
||||
result = result && (new File(caseDir + File.separator + XMLCaseManagement.EXPORT_FOLDER_RELPATH)).mkdir()
|
||||
&& (new File(caseDir + File.separator + XMLCaseManagement.LOG_FOLDER_RELPATH)).mkdir()
|
||||
&& (new File(caseDir + File.separator + XMLCaseManagement.TEMP_FOLDER_RELPATH)).mkdir()
|
||||
&& (new File(caseDir + File.separator + XMLCaseManagement.CACHE_FOLDER_RELPATH)).mkdir();
|
||||
String hostClause="";
|
||||
|
||||
if (caseType == CaseType.MULTI_USER_CASE) {
|
||||
hostClause = File.separator + getLocalHostName();
|
||||
}
|
||||
result = result && (new File(caseDir + hostClause + File.separator + EXPORT_FOLDER)).mkdirs()
|
||||
&& (new File(caseDir + hostClause + File.separator + LOG_FOLDER)).mkdirs()
|
||||
&& (new File(caseDir + hostClause + File.separator + TEMP_FOLDER)).mkdirs()
|
||||
&& (new File(caseDir + hostClause + File.separator + CACHE_FOLDER)).mkdirs();
|
||||
|
||||
if (result == false) {
|
||||
throw new CaseActionException(
|
||||
NbBundle.getMessage(Case.class, "Case.createCaseDir.exception.cantCreateCaseDir", caseDir));
|
||||
}
|
||||
|
||||
final String modulesOutDir = caseDir + File.separator + getModulesOutputDirRelPath();
|
||||
final String modulesOutDir = caseDir + hostClause + File.separator + MODULE_FOLDER;
|
||||
result = new File(modulesOutDir).mkdir();
|
||||
if (result == false) {
|
||||
throw new CaseActionException(
|
||||
@ -1104,6 +1185,14 @@ public class Case implements SleuthkitCase.ErrorObserver {
|
||||
modulesOutDir));
|
||||
}
|
||||
|
||||
final String reportsOutDir = caseDir + hostClause + File.separator + REPORTS_FOLDER;
|
||||
result = new File(reportsOutDir).mkdir();
|
||||
if (result == false) {
|
||||
throw new CaseActionException(
|
||||
NbBundle.getMessage(Case.class, "Case.createCaseDir.exception.cantCreateReportsDir",
|
||||
modulesOutDir));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new CaseActionException(
|
||||
NbBundle.getMessage(Case.class, "Case.createCaseDir.exception.gen", caseDir), e);
|
||||
@ -1178,7 +1267,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
|
||||
* @param openedCase
|
||||
*/
|
||||
private static void checkSubFolders(Case openedCase) {
|
||||
String modulesOutputDir = openedCase.getModulesOutputDirAbsPath();
|
||||
String modulesOutputDir = openedCase.getModuleDirectory();
|
||||
File modulesOutputDirF = new File(modulesOutputDir);
|
||||
if (!modulesOutputDirF.exists()) {
|
||||
logger.log(Level.INFO, "Creating modules output dir for the case."); //NON-NLS
|
||||
@ -1290,5 +1379,28 @@ public class Case implements SleuthkitCase.ErrorObserver {
|
||||
}
|
||||
return hasData;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the host name variable. Sometimes the network can be finicky, so the
|
||||
* answer returned by getHostName() could throw an exception or be null.
|
||||
* Have it read the environment variable if getHostName() is unsuccessful.
|
||||
* Also note that some calls into the Case class are static via Case.*, so
|
||||
* anywhere we use HOSTNAME prior to a Case class being instantiated, we
|
||||
* must call getLocalHostName() first.
|
||||
*/
|
||||
private static String getLocalHostName() {
|
||||
if (HostName == null || HostName.isEmpty()) {
|
||||
try {
|
||||
HostName = java.net.InetAddress.getLocalHost().getHostName();
|
||||
} catch (UnknownHostException ex) {
|
||||
// getLocalHost().getHostName() can fail in some situations.
|
||||
// Use environment variable if so.
|
||||
HostName = System.getenv("COMPUTERNAME");
|
||||
}
|
||||
if (HostName == null || HostName.isEmpty()) {
|
||||
HostName = System.getenv("COMPUTERNAME");
|
||||
}
|
||||
}
|
||||
return HostName;
|
||||
}
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ class NewCaseWizardPanel1 implements WizardDescriptor.ValidatingPanel<WizardDesc
|
||||
if (res2 != null && res2 == DialogDescriptor.YES_OPTION) {
|
||||
// if user say yes
|
||||
try {
|
||||
createDirectory(caseDirPath);
|
||||
createDirectory(caseDirPath, getComponent().getCaseType());
|
||||
} catch (Exception ex) {
|
||||
String errorMsg = NbBundle.getMessage(this.getClass(),
|
||||
"NewCaseWizardPanel1.validate.errMsg.cantCreateParDir.msg",
|
||||
@ -258,7 +258,7 @@ class NewCaseWizardPanel1 implements WizardDescriptor.ValidatingPanel<WizardDesc
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
createDirectory(caseDirPath);
|
||||
createDirectory(caseDirPath, getComponent().getCaseType());
|
||||
} catch (Exception ex) {
|
||||
String errorMsg = NbBundle
|
||||
.getMessage(this.getClass(), "NewCaseWizardPanel1.validate.errMsg.cantCreateDir");
|
||||
@ -283,11 +283,11 @@ class NewCaseWizardPanel1 implements WizardDescriptor.ValidatingPanel<WizardDesc
|
||||
/*
|
||||
* create the directory and create a new case
|
||||
*/
|
||||
private void createDirectory(final String caseDirPath) throws WizardValidationException {
|
||||
// try to create the directory with the case name in the choosen parent directory
|
||||
private void createDirectory(final String caseDirPath, CaseType caseType) throws WizardValidationException {
|
||||
// try to create the directory with the case name in the chosen parent directory
|
||||
boolean success = false;
|
||||
try {
|
||||
Case.createCaseDirectory(caseDirPath);
|
||||
Case.createCaseDirectory(caseDirPath, caseType);
|
||||
success = true;
|
||||
} catch (CaseActionException ex) {
|
||||
logger.log(Level.SEVERE, "Could not createDirectory for the case, ", ex); //NON-NLS
|
||||
|
@ -122,7 +122,7 @@ import org.sleuthkit.datamodel.VolumeSystem;
|
||||
}
|
||||
};
|
||||
|
||||
fc.setCurrentDirectory(new File(Case.getCurrentCase().getCaseDirectory() + File.separator + "Export"));
|
||||
fc.setCurrentDirectory(new File(Case.getCurrentCase().getExportDirectory()));
|
||||
fc.setDialogTitle(
|
||||
NbBundle.getMessage(this.getClass(), "ExtractUnallocAction.dlgTitle.selectDirToSaveTo.msg"));
|
||||
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
@ -500,7 +500,7 @@ import org.sleuthkit.datamodel.VolumeSystem;
|
||||
this.ImageId = img.getId();
|
||||
this.ImageName = img.getName();
|
||||
this.FileName = this.ImageName + "-Unalloc-" + this.ImageId + "-" + 0 + ".dat"; //NON-NLS
|
||||
this.FileInstance = new File(Case.getCurrentCase().getCaseDirectory() + File.separator + "Export" + File.separator + this.FileName);
|
||||
this.FileInstance = new File(Case.getCurrentCase().getExportDirectory() + File.separator + this.FileName);
|
||||
this.SizeInBytes = calcSizeInBytes();
|
||||
}
|
||||
|
||||
@ -520,7 +520,7 @@ import org.sleuthkit.datamodel.VolumeSystem;
|
||||
this.ImageId = 0;
|
||||
}
|
||||
this.FileName = this.ImageName + "-Unalloc-" + this.ImageId + "-" + VolumeId + ".dat"; //NON-NLS
|
||||
this.FileInstance = new File(Case.getCurrentCase().getCaseDirectory() + File.separator + "Export" + File.separator + this.FileName);
|
||||
this.FileInstance = new File(Case.getCurrentCase().getExportDirectory() + File.separator + this.FileName);
|
||||
this.llf = getUnallocFiles(volu);
|
||||
Collections.sort(llf, new SortObjId());
|
||||
this.SizeInBytes = calcSizeInBytes();
|
||||
|
@ -84,7 +84,7 @@ public class SampleExecutableDataSourceIngestModule implements DataSourceIngestM
|
||||
this.context = context;
|
||||
if (refCounter.incrementAndGet(context.getJobId()) == 1) {
|
||||
// Create an output directory for this job.
|
||||
outputDirPath = Case.getCurrentCase().getModulesOutputDirAbsPath() + File.separator + moduleName; //NON-NLS
|
||||
outputDirPath = Case.getCurrentCase().getModuleDirectory() + File.separator + moduleName; //NON-NLS
|
||||
File outputDir = new File(outputDirPath);
|
||||
if (outputDir.exists() == false) {
|
||||
outputDir.mkdirs();
|
||||
|
@ -56,7 +56,7 @@ class ContactAnalyzer {
|
||||
List<AbstractFile> absFiles;
|
||||
try {
|
||||
SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase();
|
||||
absFiles = skCase.findAllFilesWhere("LOWER(name) LIKE '%call_history%' "); //NON-NLS //get exact file names
|
||||
absFiles = skCase.findAllFilesWhere("LOWER(name) LIKE LOWER('%call_history%') "); //NON-NLS //get exact file names
|
||||
if (absFiles.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -142,8 +142,10 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule {
|
||||
}
|
||||
|
||||
// Check that we have roughly enough disk space left to complete the operation
|
||||
// Some network drives always return -1 for free disk space.
|
||||
// In this case, expect enough space and move on.
|
||||
long freeDiskSpace = IngestServices.getInstance().getFreeDiskSpace();
|
||||
if ((file.getSize() * 2) > freeDiskSpace) {
|
||||
if ((freeDiskSpace!=-1) && ((file.getSize() * 2) > freeDiskSpace)) {
|
||||
logger.log(Level.SEVERE, "PhotoRec error processing {0} with {1} Not enough space on primary disk to carve unallocated space.", // NON-NLS
|
||||
new Object[]{file.getName(), PhotoRecCarverIngestModuleFactory.getModuleName()}); // NON-NLS
|
||||
return IngestModule.ProcessResult.ERROR;
|
||||
@ -278,7 +280,7 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule {
|
||||
* @throws org.sleuthkit.autopsy.ingest.IngestModule.IngestModuleException
|
||||
*/
|
||||
synchronized static Path createModuleOutputDirectoryForCase() throws IngestModule.IngestModuleException {
|
||||
Path path = Paths.get(Case.getCurrentCase().getModulesOutputDirAbsPath(), PhotoRecCarverIngestModuleFactory.getModuleName());
|
||||
Path path = Paths.get(Case.getCurrentCase().getModuleDirectory(), PhotoRecCarverIngestModuleFactory.getModuleName());
|
||||
try {
|
||||
Files.createDirectory(path);
|
||||
}
|
||||
|
@ -105,8 +105,8 @@ public final class SevenZipIngestModule implements FileIngestModule {
|
||||
|
||||
final Case currentCase = Case.getCurrentCase();
|
||||
|
||||
moduleDirRelative = Case.getModulesOutputDirRelPath() + File.separator + ArchiveFileExtractorModuleFactory.getModuleName();
|
||||
moduleDirAbsolute = currentCase.getModulesOutputDirAbsPath() + File.separator + ArchiveFileExtractorModuleFactory.getModuleName();
|
||||
moduleDirRelative = currentCase.getModuleOutputDirectoryRelativePath() + File.separator + ArchiveFileExtractorModuleFactory.getModuleName();
|
||||
moduleDirAbsolute = currentCase.getModuleDirectory() + File.separator + ArchiveFileExtractorModuleFactory.getModuleName();
|
||||
|
||||
|
||||
File unpackDirPathFile = new File(moduleDirAbsolute);
|
||||
|
@ -110,7 +110,7 @@ import org.sleuthkit.datamodel.TskData;
|
||||
DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy-HH-mm-ss");
|
||||
Date date = new Date();
|
||||
String dateNoTime = dateFormat.format(date);
|
||||
this.reportPath = currentCase.getCaseDirectory() + File.separator + REPORTS_DIR + File.separator + currentCase.getName() + " " + dateNoTime + File.separator;
|
||||
this.reportPath = currentCase.getReportDirectory()+ File.separator + currentCase.getName() + " " + dateNoTime + File.separator;
|
||||
|
||||
this.errorList = new ArrayList<String>();
|
||||
|
||||
|
@ -89,17 +89,6 @@ public final class ReportWizardAction extends CallableSystemAction implements P
|
||||
if (evt.getPropertyName().equals(Case.Events.CURRENT_CASE.toString())) {
|
||||
Case newCase = (Case) evt.getNewValue();
|
||||
setEnabled(newCase != null);
|
||||
|
||||
// Make the cases' Reoports folder, if it doesn't exist
|
||||
if (newCase != null) {
|
||||
boolean exists = (new File(newCase.getCaseDirectory() + File.separator + "Reports")).exists();
|
||||
if (!exists) {
|
||||
boolean reportCreate = (new File(newCase.getCaseDirectory() + File.separator + "Reports")).mkdirs();
|
||||
if (!reportCreate) {
|
||||
logger.log(Level.WARNING, "Could not create Reports directory for case. It does not exist."); //NON-NLS
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -69,7 +69,7 @@ public class SaveSnapshot extends Action {
|
||||
//choose location/name
|
||||
DirectoryChooser fileChooser = new DirectoryChooser();
|
||||
fileChooser.setTitle(NbBundle.getMessage(this.getClass(), "SaveSnapshot.fileChoose.title.text"));
|
||||
fileChooser.setInitialDirectory(new File(Case.getCurrentCase().getCaseDirectory() + File.separator + "Reports")); // NON-NLS
|
||||
fileChooser.setInitialDirectory(new File(Case.getCurrentCase().getReportDirectory()));
|
||||
File outFolder = fileChooser.showDialog(null);
|
||||
if (outFolder == null) {
|
||||
return;
|
||||
|
@ -22,6 +22,7 @@ import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.cache.RemovalNotification;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@ -93,6 +94,8 @@ public class EventsRepository {
|
||||
|
||||
private final LoadingCache<ZoomParams, List<AggregateEvent>> aggregateEventsCache;
|
||||
|
||||
private static final String TIMELINE = "Timeline";
|
||||
|
||||
public Interval getBoundingEventsInterval(Interval timeRange, Filter filter) {
|
||||
return eventDB.getBoundingEventsInterval(timeRange, filter);
|
||||
}
|
||||
@ -107,7 +110,11 @@ public class EventsRepository {
|
||||
|
||||
public EventsRepository(ReadOnlyObjectProperty<ZoomParams> currentStateProperty) {
|
||||
//TODO: we should check that case is open, or get passed a case object/directory -jm
|
||||
this.eventDB = EventDB.getEventDB(Case.getCurrentCase().getCaseDirectory());
|
||||
File thePath = new File(Case.getCurrentCase().getModuleDirectory() + File.separator + TIMELINE);
|
||||
if (!thePath.exists()) {
|
||||
thePath.mkdirs();
|
||||
}
|
||||
this.eventDB = EventDB.getEventDB(thePath.toString());
|
||||
|
||||
idToEventCache = CacheBuilder.newBuilder().maximumSize(5000L).expireAfterAccess(10, TimeUnit.MINUTES).removalListener((RemovalNotification<Long, TimeLineEvent> rn) -> {
|
||||
//LOGGER.log(Level.INFO, "evicting event: {0}", rn.toString());
|
||||
|
@ -19,6 +19,7 @@
|
||||
package org.sleuthkit.autopsy.imagegallery;
|
||||
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -84,6 +85,8 @@ public final class ImageGalleryController {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(ImageGalleryController.class.getName());
|
||||
|
||||
private static final String IMAGEGALLERY = "ImageGallery";
|
||||
|
||||
private final Region infoOverLayBackground = new Region() {
|
||||
{
|
||||
setBackground(new Background(new BackgroundFill(Color.GREY, CornerRadii.EMPTY, Insets.EMPTY)));
|
||||
@ -332,7 +335,7 @@ public final class ImageGalleryController {
|
||||
*/
|
||||
public synchronized void setCase(Case c) {
|
||||
|
||||
this.db = DrawableDB.getDrawableDB(c.getCaseDirectory(), this);
|
||||
this.db = DrawableDB.getDrawableDB(c.getModuleDirectory() + File.separator + IMAGEGALLERY, this);
|
||||
|
||||
setListeningEnabled(ImageGalleryModule.isEnabledforCase(c));
|
||||
setStale(ImageGalleryModule.isCaseStale(c));
|
||||
|
@ -88,7 +88,7 @@ class PerCaseProperties {
|
||||
* @return true if the config exists, false otherwise.
|
||||
*/
|
||||
public synchronized boolean configExists(String moduleName) {
|
||||
File f = new File(c.getCaseDirectory() + File.separator + moduleName + ".properties");
|
||||
File f = new File(getPropertyPath(moduleName)); // NON-NLS
|
||||
return f.exists();
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ class PerCaseProperties {
|
||||
* file doesn't exist.
|
||||
*/
|
||||
private synchronized String getPropertyPath(String moduleName) {
|
||||
return c.getCaseDirectory() + File.separator + moduleName + ".properties"; //NON-NLS
|
||||
return c.getModuleDirectory() + File.separator + moduleName + File.separator + moduleName + ".properties"; //NON-NLS
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -278,6 +278,10 @@ public class DrawableDB {
|
||||
public static DrawableDB getDrawableDB(String dbPath, ImageGalleryController controller) {
|
||||
|
||||
try {
|
||||
File db = new File(dbPath);
|
||||
if (!db.exists()) {
|
||||
db.mkdirs();
|
||||
}
|
||||
DrawableDB drawableDB = new DrawableDB(dbPath + File.separator + "drawable.db");
|
||||
drawableDB.controller = controller;
|
||||
return drawableDB;
|
||||
|
@ -625,40 +625,10 @@ public class Server {
|
||||
|
||||
Case currentCase = Case.getCurrentCase();
|
||||
|
||||
validateIndexLocation(currentCase);
|
||||
|
||||
currentCore = openCore(currentCase);
|
||||
serverAction.putValue(CORE_EVT, CORE_EVT_STATES.STARTED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if index dir exists, and moves it to new location if needed (for
|
||||
* backwards compatibility with older cases)
|
||||
*/
|
||||
private void validateIndexLocation(Case theCase) {
|
||||
logger.log(Level.INFO, "Validating keyword search index location"); //NON-NLS
|
||||
String properIndexPath = getIndexDirPath(theCase);
|
||||
|
||||
String legacyIndexPath = theCase.getCaseDirectory()
|
||||
+ File.separator + "keywordsearch" + File.separator + "data"; //NON-NLS
|
||||
|
||||
|
||||
File properIndexDir = new File(properIndexPath);
|
||||
File legacyIndexDir = new File(legacyIndexPath);
|
||||
if (!properIndexDir.exists()
|
||||
&& legacyIndexDir.exists() && legacyIndexDir.isDirectory()) {
|
||||
logger.log(Level.INFO, "Moving keyword search index location from: " //NON-NLS
|
||||
+ legacyIndexPath + " to: " + properIndexPath); //NON-NLS
|
||||
try {
|
||||
Files.move(Paths.get(legacyIndexDir.getParent()), Paths.get(properIndexDir.getParent()));
|
||||
} catch (IOException | SecurityException ex) {
|
||||
logger.log(Level.WARNING, "Error moving keyword search index folder from: " //NON-NLS
|
||||
+ legacyIndexPath + " to: " + properIndexPath //NON-NLS
|
||||
+ " will recreate a new index.", ex); //NON-NLS
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
synchronized void closeCore() throws KeywordSearchModuleException {
|
||||
if (currentCore == null) {
|
||||
return;
|
||||
@ -680,8 +650,8 @@ public class Server {
|
||||
* @return absolute path to index dir
|
||||
*/
|
||||
String getIndexDirPath(Case theCase) {
|
||||
String indexDir = theCase.getModulesOutputDirAbsPath()
|
||||
+ File.separator + "keywordsearch" + File.separator + "data"; //NON-NLS
|
||||
String indexDir = theCase.getModuleDirectory() +
|
||||
File.separator + "keywordsearch" + File.separator + "data"; //NON-NLS
|
||||
return indexDir;
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ public final class RAImageIngestModule implements DataSourceIngestModule {
|
||||
* @return Path to directory
|
||||
*/
|
||||
protected static String getRAOutputPath(Case a_case, String mod) {
|
||||
String tmpDir = a_case.getModulesOutputDirAbsPath() + File.separator + "RecentActivity" + File.separator + mod; //NON-NLS
|
||||
String tmpDir = a_case.getModuleDirectory() + File.separator + "RecentActivity" + File.separator + mod; //NON-NLS
|
||||
File dir = new File(tmpDir);
|
||||
if (dir.exists() == false) {
|
||||
dir.mkdirs();
|
||||
|
@ -83,7 +83,7 @@ class ScalpelCarverIngestModule implements FileIngestModule {
|
||||
}
|
||||
|
||||
// make sure module output directory exists; create it if it doesn't
|
||||
moduleOutputDirPath = Case.getCurrentCase().getModulesOutputDirAbsPath()
|
||||
moduleOutputDirPath = Case.getCurrentCase().getModuleDirectory()
|
||||
+ File.separator + MODULE_OUTPUT_DIR_NAME;
|
||||
File moduleOutputDir = new File(moduleOutputDirPath);
|
||||
if (!moduleOutputDir.exists()) {
|
||||
|
@ -252,7 +252,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule {
|
||||
}
|
||||
|
||||
public static String getModuleOutputPath() {
|
||||
String outDir = Case.getCurrentCase().getModulesOutputDirAbsPath() + File.separator
|
||||
String outDir = Case.getCurrentCase().getModuleDirectory() + File.separator
|
||||
+ EmailParserModuleFactory.getModuleName();
|
||||
File dir = new File(outDir);
|
||||
if (dir.exists() == false) {
|
||||
@ -262,7 +262,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule {
|
||||
}
|
||||
|
||||
public static String getRelModuleOutputPath() {
|
||||
return Case.getModulesOutputDirRelPath() + File.separator
|
||||
return Case.getCurrentCase().getModuleOutputDirectoryRelativePath() + File.separator
|
||||
+ EmailParserModuleFactory.getModuleName();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user