update paths for collab

This commit is contained in:
Karl Mortensen 2015-05-12 17:01:47 -04:00
parent e90f5c7203
commit 8d2f2fd21e
23 changed files with 354 additions and 143 deletions

View File

@ -50,6 +50,9 @@ GetTagNameDialog.tagNameAlreadyDef.msg=A {0} tag name has already been defined.
GetTagNameDialog.dupTagErr=Duplicate Tag Error GetTagNameDialog.dupTagErr=Duplicate Tag Error
OpenLogFolder.error1=Log File Not Found: {0} OpenLogFolder.error1=Log File Not Found: {0}
CTL_OpenLogFolder=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.
ShowIngestProgressSnapshotAction.actionName.text=Get Ingest Progress Snapshot ShowIngestProgressSnapshotAction.actionName.text=Get Ingest Progress Snapshot
OpenPythonModulesFolderAction.actionName.text=Python Plugins OpenPythonModulesFolderAction.actionName.text=Python Plugins
OpenPythonModulesFolderAction.errorMsg.folderNotFound=Python plugins folder not found: {0} OpenPythonModulesFolderAction.errorMsg.folderNotFound=Python plugins folder not found: {0}

View File

@ -0,0 +1,68 @@
/*
* 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 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.Exceptions;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case;
/**
* 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 {
@Override
public void actionPerformed(ActionEvent e) {
try {
File outputDir;
if (Case.isCaseOpen()) {
outputDir = new File(Case.getCurrentCase().getHostDirectory());
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) {
Exceptions.printStackTrace(ex);
}
}
}

View File

@ -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.cantCreate=Cannot create case dir\: {0}
Case.createCaseDir.exception.cantCreateCaseDir=Could not create case directory\: {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.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.createCaseDir.exception.gen=Could not create case directory\: {0}
Case.OpenEventChannel.ErrMsg=Case opening process failed to connect to nodes collaborating on case {0}. Case.OpenEventChannel.ErrMsg=Case opening process failed to connect to nodes collaborating on case {0}.
CaseDeleteAction.closeConfMsg.text=Are you sure want to close and delete this case? \n\ CaseDeleteAction.closeConfMsg.text=Are you sure want to close and delete this case? \n\

View File

@ -25,6 +25,9 @@ import java.io.BufferedInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; 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.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
@ -188,6 +191,9 @@ public class Case implements SleuthkitCase.ErrorObserver {
private static final Logger logger = Logger.getLogger(Case.class.getName()); private static final Logger logger = Logger.getLogger(Case.class.getName());
static final String CASE_EXTENSION = "aut"; //NON-NLS static final String CASE_EXTENSION = "aut"; //NON-NLS
static final String CASE_DOT_EXTENSION = "." + CASE_EXTENSION; static final String CASE_DOT_EXTENSION = "." + CASE_EXTENSION;
private static String HOSTNAME;
private static String REPORTOUTPUT = "Reports";
private static String MODULEOUTPUT = "ModuleOutput";
// 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 // 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; private boolean hasData = false;
@ -204,6 +210,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
this.caseType = type; this.caseType = type;
this.db = db; this.db = db;
this.services = new Services(db); this.services = new Services(db);
setHostName();
} }
/** /**
@ -315,7 +322,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
// create case directory if it doesn't already exist. // create case directory if it doesn't already exist.
if (new File(caseDir).exists() == false) { if (new File(caseDir).exists() == false) {
Case.createCaseDirectory(caseDir); Case.createCaseDirectory(caseDir, caseType);
} }
String configFilePath = caseDir + File.separator + caseName + CASE_DOT_EXTENSION; String configFilePath = caseDir + File.separator + caseName + CASE_DOT_EXTENSION;
@ -738,7 +745,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
if (xmlcm == null) { if (xmlcm == null) {
return ""; return "";
} else { } else {
return xmlcm.getTempDir(); return xmlcm.getTempDir(HOSTNAME, caseType);
} }
} }
@ -751,7 +758,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
if (xmlcm == null) { if (xmlcm == null) {
return ""; return "";
} else { } else {
return xmlcm.getCacheDir(); return xmlcm.getCacheDir(HOSTNAME, caseType);
} }
} }
@ -764,7 +771,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
if (xmlcm == null) { if (xmlcm == null) {
return ""; return "";
} else { } else {
return xmlcm.getExportDir(); return xmlcm.getExportDir(HOSTNAME, caseType);
} }
} }
@ -777,7 +784,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
if (xmlcm == null) { if (xmlcm == null) {
return ""; return "";
} else { } else {
return xmlcm.getLogDir(); return xmlcm.getLogDir(HOSTNAME, caseType);
} }
} }
@ -808,24 +815,65 @@ public class Case implements SleuthkitCase.ErrorObserver {
} }
/** /**
* Get absolute module output directory path where modules should save their * Get the host output directory path where modules should save their
* permanent data The directory is a subdirectory of this case dir. * 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
*/
public String getHostDirectory() {
if (xmlcm == null) {
return "";
} else {
return xmlcm.getHostPath(HOSTNAME, this.getCaseType());
}
}
/**
* Get the reports directory path where modules should save their reports.
*
* @return absolute path to the report output directory
*/
public String getReportDirectory() {
Path thePath = Paths.get(this.getHostDirectory(), REPORTOUTPUT);
if (!thePath.toFile().exists()) {
thePath.toFile().mkdirs();
}
return thePath.toString();
}
/**
* Get module output directory path where modules should save their
* permanent data.
* *
* @return absolute path to the module output dir * @return absolute path to the module output dir
*/ */
public String getModulesOutputDirAbsPath() { public String getModulesDirectory() {
return this.getCaseDirectory() + File.separator + getModulesOutputDirRelPath(); Path thePath = Paths.get(this.getHostDirectory(), MODULEOUTPUT);
if (!thePath.toFile().exists()) {
thePath.toFile().mkdirs();
}
return thePath.toString();
} }
/** /**
* Get relative (with respect to case dir) module output directory path * 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. * subdirectory of this case dir.
* *
* @return relative path to the module output dir * @return relative path to the module output dir
*/ */
public static String getModulesOutputDirRelPath() { public String getModuleOutputDirectoryRelativePath() {
return "ModuleOutput"; //NON-NLS Path thePath;
if (getCaseType() == CaseType.MULTI_USER_CASE) {
thePath = Paths.get(HOSTNAME, MODULEOUTPUT);
} else {
thePath = Paths.get(MODULEOUTPUT);
}
// Do not autocreate this relative path. It will have already been
// created when the case was made.
return thePath.toString();
} }
/** /**
@ -1046,8 +1094,8 @@ public class Case implements SleuthkitCase.ErrorObserver {
* @throws CaseActionException throw if could not create the case dir * @throws CaseActionException throw if could not create the case dir
* @Deprecated * @Deprecated
*/ */
static void createCaseDirectory(String caseDir, String caseName) throws CaseActionException { static void createCaseDirectory(String caseDir, String caseName, CaseType caseType) throws CaseActionException {
createCaseDirectory(caseDir); createCaseDirectory(caseDir, caseType);
} }
@ -1055,10 +1103,10 @@ public class Case implements SleuthkitCase.ErrorObserver {
* Create the case directory and its needed subfolders. * Create the case directory and its needed subfolders.
* *
* @param caseDir Path to the case directory (typically base + case name) * @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 * @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); File caseDirF = new File(caseDir);
if (caseDirF.exists()) { if (caseDirF.exists()) {
@ -1079,17 +1127,25 @@ public class Case implements SleuthkitCase.ErrorObserver {
} }
// create the folders inside the case directory // create the folders inside the case directory
result = result && (new File(caseDir + File.separator + XMLCaseManagement.EXPORT_FOLDER_RELPATH)).mkdir() String hostClause = "";
&& (new File(caseDir + File.separator + XMLCaseManagement.LOG_FOLDER_RELPATH)).mkdir() if (HOSTNAME == null || HOSTNAME.isEmpty()) {
&& (new File(caseDir + File.separator + XMLCaseManagement.TEMP_FOLDER_RELPATH)).mkdir() setHostName();
&& (new File(caseDir + File.separator + XMLCaseManagement.CACHE_FOLDER_RELPATH)).mkdir(); }
if (caseType == CaseType.MULTI_USER_CASE) {
hostClause = File.separator + HOSTNAME;
}
result = result && (new File(caseDir + hostClause + File.separator + XMLCaseManagement.EXPORT_FOLDER_RELPATH)).mkdirs()
&& (new File(caseDir + hostClause + File.separator + XMLCaseManagement.LOG_FOLDER_RELPATH)).mkdirs()
&& (new File(caseDir + hostClause + File.separator + XMLCaseManagement.TEMP_FOLDER_RELPATH)).mkdirs()
&& (new File(caseDir + hostClause + File.separator + XMLCaseManagement.CACHE_FOLDER_RELPATH)).mkdirs();
if (result == false) { if (result == false) {
throw new CaseActionException( throw new CaseActionException(
NbBundle.getMessage(Case.class, "Case.createCaseDir.exception.cantCreateCaseDir", caseDir)); NbBundle.getMessage(Case.class, "Case.createCaseDir.exception.cantCreateCaseDir", caseDir));
} }
final String modulesOutDir = caseDir + File.separator + getModulesOutputDirRelPath(); final String modulesOutDir = caseDir + hostClause + File.separator + MODULEOUTPUT;
result = new File(modulesOutDir).mkdir(); result = new File(modulesOutDir).mkdir();
if (result == false) { if (result == false) {
throw new CaseActionException( throw new CaseActionException(
@ -1097,6 +1153,14 @@ public class Case implements SleuthkitCase.ErrorObserver {
modulesOutDir)); modulesOutDir));
} }
final String reportsOutDir = caseDir + hostClause + File.separator + REPORTOUTPUT;
result = new File(reportsOutDir).mkdir();
if (result == false) {
throw new CaseActionException(
NbBundle.getMessage(Case.class, "Case.createCaseDir.exception.cantCreateReportsDir",
modulesOutDir));
}
} catch (Exception e) { } catch (Exception e) {
throw new CaseActionException( throw new CaseActionException(
NbBundle.getMessage(Case.class, "Case.createCaseDir.exception.gen", caseDir), e); NbBundle.getMessage(Case.class, "Case.createCaseDir.exception.gen", caseDir), e);
@ -1171,7 +1235,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
* @param openedCase * @param openedCase
*/ */
private static void checkSubFolders(Case openedCase) { private static void checkSubFolders(Case openedCase) {
String modulesOutputDir = openedCase.getModulesOutputDirAbsPath(); String modulesOutputDir = openedCase.getModulesDirectory();
File modulesOutputDirF = new File(modulesOutputDir); File modulesOutputDirF = new File(modulesOutputDir);
if (!modulesOutputDirF.exists()) { if (!modulesOutputDirF.exists()) {
logger.log(Level.INFO, "Creating modules output dir for the case."); //NON-NLS logger.log(Level.INFO, "Creating modules output dir for the case."); //NON-NLS
@ -1284,4 +1348,24 @@ public class Case implements SleuthkitCase.ErrorObserver {
return hasData; 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 setHostName() first.
*/
private static void setHostName() {
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");
}
}
} }

View File

@ -242,7 +242,7 @@ class NewCaseWizardPanel1 implements WizardDescriptor.ValidatingPanel<WizardDesc
if (res2 != null && res2 == DialogDescriptor.YES_OPTION) { if (res2 != null && res2 == DialogDescriptor.YES_OPTION) {
// if user say yes // if user say yes
try { try {
createDirectory(caseDirPath); createDirectory(caseDirPath, getComponent().getCaseType());
} catch (Exception ex) { } catch (Exception ex) {
String errorMsg = NbBundle.getMessage(this.getClass(), String errorMsg = NbBundle.getMessage(this.getClass(),
"NewCaseWizardPanel1.validate.errMsg.cantCreateParDir.msg", "NewCaseWizardPanel1.validate.errMsg.cantCreateParDir.msg",
@ -259,7 +259,7 @@ class NewCaseWizardPanel1 implements WizardDescriptor.ValidatingPanel<WizardDesc
} }
} else { } else {
try { try {
createDirectory(caseDirPath); createDirectory(caseDirPath, getComponent().getCaseType());
} catch (Exception ex) { } catch (Exception ex) {
String errorMsg = NbBundle String errorMsg = NbBundle
.getMessage(this.getClass(), "NewCaseWizardPanel1.validate.errMsg.cantCreateDir"); .getMessage(this.getClass(), "NewCaseWizardPanel1.validate.errMsg.cantCreateDir");
@ -284,11 +284,11 @@ class NewCaseWizardPanel1 implements WizardDescriptor.ValidatingPanel<WizardDesc
/* /*
* create the directory and create a new case * create the directory and create a new case
*/ */
private void createDirectory(final String caseDirPath) throws WizardValidationException { private void createDirectory(final String caseDirPath, CaseType caseType) throws WizardValidationException {
// try to create the directory with the case name in the choosen parent directory // try to create the directory with the case name in the chosen parent directory
boolean success = false; boolean success = false;
try { try {
Case.createCaseDirectory(caseDirPath); Case.createCaseDirectory(caseDirPath, caseType);
success = true; success = true;
} catch (CaseActionException ex) { } catch (CaseActionException ex) {
logger.log(Level.SEVERE, "Could not createDirectory for the case, ", ex); //NON-NLS logger.log(Level.SEVERE, "Could not createDirectory for the case, ", ex); //NON-NLS

View File

@ -19,6 +19,8 @@
package org.sleuthkit.autopsy.casemodule; package org.sleuthkit.autopsy.casemodule;
import java.io.*; import java.io.*;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
@ -85,7 +87,7 @@ import org.xml.sax.SAXException;
private String caseName; // case name private String caseName; // case name
private String caseNumber; // case number private String caseNumber; // case number
private String examiner; // examiner name private String examiner; // examiner name
private String schemaVersion = "1.0"; private String schemaVersion = "2.0";
private String autopsySavedVersion; private String autopsySavedVersion;
private CaseType caseType; // The type of case: local or shared private CaseType caseType; // The type of case: local or shared
private String dbName; // The name of the database private String dbName; // The name of the database
@ -344,13 +346,17 @@ import org.xml.sax.SAXException;
* *
* @return caseDirPath the case directory path * @return caseDirPath the case directory path
*/ */
public String getCaseDirectory() { public String getCaseDirectory() {
if (doc == null) { if (doc == null) {
return ""; return "";
} else { } else {
return caseDirPath; File casePath = new File(caseDirPath);
} if (!casePath.exists()) {
// Note: change this to get the case name from the xml file if needed casePath.mkdirs();
}
return caseDirPath;
}
// Note: change this to get the case name from the xml file if needed
} }
/** /**
@ -450,81 +456,139 @@ import org.xml.sax.SAXException;
} }
} }
/** /**
* Gets the full path to the log directory * Get the path to the case, with the host name in it if it's a multi-user
* * case, without the host name if it's a single-user case.
* @return logDir the full path of the "Log" directory *
*/ * @param hostname The host name
protected String getLogDir() { * @param caseType The case type
if (doc != null) { * @return
Element logElement = (Element) getCaseElement().getElementsByTagName(LOG_FOLDER_NAME).item(0); */
if (logElement.getAttribute(RELATIVE_NAME).equals(RELATIVE_TRUE)) { public String getHostPath(String hostname, CaseType caseType) {
return caseDirPath + File.separator + logElement.getTextContent(); Path thePath;
} else { if (caseType == CaseType.MULTI_USER_CASE) {
return logElement.getTextContent(); thePath = Paths.get(caseDirPath, hostname);
} } else {
} else { thePath = Paths.get(caseDirPath);
return ""; // should throw error or exception }
}
}
/** if (!thePath.toFile().exists()) {
* Gets the full path to the temp directory thePath.toFile().mkdirs();
* }
* @return tempDir the full path of the "Temp" directory return thePath.toString();
*/ }
protected String getTempDir() {
if (doc != null) {
Element tempElement = (Element) getCaseElement().getElementsByTagName(TEMP_FOLDER_NAME).item(0);
if (tempElement.getAttribute(RELATIVE_NAME).equals(RELATIVE_TRUE)) {
return caseDirPath + File.separator + tempElement.getTextContent();
} else {
return tempElement.getTextContent();
}
} else {
return ""; // should throw error or exception
}
}
/** /**
* Gets the full path to the Export directory * Gets the full path to the log directory
* *
* @return exportDir the full path of the "Export" directory * @param hostname The hostname of this machine
*/ * @param caseType The type of the case.
protected String getExportDir() { * @return logDir the full path of the "Log" directory
if (doc != null) { */
Element exportElement = (Element) getCaseElement().getElementsByTagName(EXPORT_FOLDER_NAME).item(0); protected String getLogDir(String hostname, CaseType caseType) {
if (exportElement.getAttribute(RELATIVE_NAME).equals(RELATIVE_TRUE)) { String thePath = getHostPath(hostname, caseType);
return caseDirPath + File.separator + exportElement.getTextContent(); if (doc != null) {
} else { Element logElement = (Element) getCaseElement().getElementsByTagName(LOG_FOLDER_NAME).item(0);
return exportElement.getTextContent(); if (logElement.getAttribute(RELATIVE_NAME).equals(RELATIVE_TRUE)) {
} thePath += File.separator + logElement.getTextContent();
} else { } else {
return ""; // should throw error or exception thePath = logElement.getTextContent();
} }
} } else {
thePath += File.separator + LOG_FOLDER_RELPATH;
}
/** File logPath = new File(thePath);
* Gets the full path to the Cache directory if (!logPath.exists()) {
* logPath.mkdirs();
* @return cacheDir the full path of the "Cache" directory }
*/ return thePath;
protected String getCacheDir() { }
if (doc != null) {
Element cacheElement = (Element) getCaseElement().getElementsByTagName(CACHE_FOLDER_NAME).item(0); /**
if (cacheElement.getAttribute(RELATIVE_NAME).equals(RELATIVE_TRUE)) { * Gets the full path to the temp directory
return caseDirPath + File.separator + cacheElement.getTextContent(); *
} else { * @param hostname The hostname of this machine
return cacheElement.getTextContent(); * @param caseType The type of the case.
} * @return tempDir the full path of the "Temp" directory
} else { */
return ""; // should throw error or exception protected String getTempDir(String hostname, CaseType caseType) {
} String thePath = getHostPath(hostname, caseType);
} if (doc != null) {
Element tempElement = (Element) getCaseElement().getElementsByTagName(TEMP_FOLDER_NAME).item(0);
if (tempElement.getAttribute(RELATIVE_NAME).equals(RELATIVE_TRUE)) {
thePath += File.separator + tempElement.getTextContent();
} else {
thePath = tempElement.getTextContent();
}
} else {
thePath += File.separator + TEMP_FOLDER_RELPATH;
}
File tempPath = new File(thePath);
if (!tempPath.exists()) {
tempPath.mkdirs();
}
return thePath;
}
/**
* Gets the full path to the Export directory
*
* @param hostname The hostname of this machine
* @param caseType The type of the case.
* @return exportDir the full path of the "Export" directory
*/
protected String getExportDir(String hostname, CaseType caseType) {
String thePath = getHostPath(hostname, caseType);
if (doc != null) {
Element exportElement = (Element) getCaseElement().getElementsByTagName(EXPORT_FOLDER_NAME).item(0);
if (exportElement.getAttribute(RELATIVE_NAME).equals(RELATIVE_TRUE)) {
thePath += File.separator + exportElement.getTextContent();
} else {
thePath = exportElement.getTextContent();
}
} else {
thePath += File.separator + EXPORT_FOLDER_RELPATH;
}
File exportPath = new File(thePath);
if (!exportPath.exists()) {
exportPath.mkdirs();
}
return thePath;
}
/**
* Gets the full path to the Cache directory
*
* @param hostname The hostname of this machine
* @param caseType The type of the case.
* @return cacheDir the full path of the "Cache" directory
*/
protected String getCacheDir(String hostname, CaseType caseType) {
String thePath = getHostPath(hostname, caseType);
if (doc != null) {
Element cacheElement = (Element) getCaseElement().getElementsByTagName(CACHE_FOLDER_NAME).item(0);
if (cacheElement.getAttribute(RELATIVE_NAME).equals(RELATIVE_TRUE)) {
thePath += File.separator + cacheElement.getTextContent();
} else {
thePath = cacheElement.getTextContent();
}
} else {
thePath += File.separator + CACHE_FOLDER_RELPATH;
}
File cachePath = new File(thePath);
if (!cachePath.exists()) {
cachePath.mkdirs();
}
return thePath;
}
/** /**
* Initialize the basic values for a new case management file. Note: this is * Initialize the basic values for a new case management file. Note: this is
* the schema version 1.0 * the schema version 2.0
* *
* @param dirPath case directory path * @param dirPath case directory path
* @param caseName the name of the config file to be located in the case * @param caseName the name of the config file to be located in the case
@ -532,7 +596,7 @@ import org.xml.sax.SAXException;
* @param examiner examiner for the case (optional, can be empty string * @param examiner examiner for the case (optional, can be empty string
* @param caseNumber case number (optional), can be empty * @param caseNumber case number (optional), can be empty
* @param dbName the name of the database. Could be a local path, could be * @param dbName the name of the database. Could be a local path, could be
* a Postgre db name. * a Postgres db name.
* @param textIndexName The name of the index where extracted text is stored. * @param textIndexName The name of the index where extracted text is stored.
*/ */
protected void create(String dirPath, String caseName, String examiner, String caseNumber, CaseType caseType, String dbName, String textIndexName) throws CaseActionException { protected void create(String dirPath, String caseName, String examiner, String caseNumber, CaseType caseType, String dbName, String textIndexName) throws CaseActionException {

View File

@ -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( fc.setDialogTitle(
NbBundle.getMessage(this.getClass(), "ExtractUnallocAction.dlgTitle.selectDirToSaveTo.msg")); NbBundle.getMessage(this.getClass(), "ExtractUnallocAction.dlgTitle.selectDirToSaveTo.msg"));
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
@ -500,7 +500,7 @@ import org.sleuthkit.datamodel.VolumeSystem;
this.ImageId = img.getId(); this.ImageId = img.getId();
this.ImageName = img.getName(); this.ImageName = img.getName();
this.FileName = this.ImageName + "-Unalloc-" + this.ImageId + "-" + 0 + ".dat"; //NON-NLS 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(); this.SizeInBytes = calcSizeInBytes();
} }
@ -520,7 +520,7 @@ import org.sleuthkit.datamodel.VolumeSystem;
this.ImageId = 0; this.ImageId = 0;
} }
this.FileName = this.ImageName + "-Unalloc-" + this.ImageId + "-" + VolumeId + ".dat"; //NON-NLS 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); this.llf = getUnallocFiles(volu);
Collections.sort(llf, new SortObjId()); Collections.sort(llf, new SortObjId());
this.SizeInBytes = calcSizeInBytes(); this.SizeInBytes = calcSizeInBytes();

View File

@ -84,7 +84,7 @@ public class SampleExecutableDataSourceIngestModule implements DataSourceIngestM
this.context = context; this.context = context;
if (refCounter.incrementAndGet(context.getJobId()) == 1) { if (refCounter.incrementAndGet(context.getJobId()) == 1) {
// Create an output directory for this job. // Create an output directory for this job.
outputDirPath = Case.getCurrentCase().getModulesOutputDirAbsPath() + File.separator + moduleName; //NON-NLS outputDirPath = Case.getCurrentCase().getModulesDirectory() + File.separator + moduleName; //NON-NLS
File outputDir = new File(outputDirPath); File outputDir = new File(outputDirPath);
if (outputDir.exists() == false) { if (outputDir.exists() == false) {
outputDir.mkdirs(); outputDir.mkdirs();

View File

@ -234,7 +234,7 @@ public final class ExternalResultsImporter {
private String getPathRelativeToCaseFolder(String localPath) { private String getPathRelativeToCaseFolder(String localPath) {
String relativePath = ""; String relativePath = "";
String caseDirectoryPath = Case.getCurrentCase().getCaseDirectory(); String caseDirectoryPath = Case.getCurrentCase().getHostDirectory();
Path path = Paths.get(localPath); Path path = Paths.get(localPath);
if (path.isAbsolute()) { if (path.isAbsolute()) {
Path pathBase = Paths.get(caseDirectoryPath); Path pathBase = Paths.get(caseDirectoryPath);

View File

@ -56,7 +56,7 @@ class ContactAnalyzer {
List<AbstractFile> absFiles; List<AbstractFile> absFiles;
try { try {
SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase(); 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()) { if (absFiles.isEmpty()) {
return; return;
} }

View File

@ -142,8 +142,10 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule {
} }
// Check that we have roughly enough disk space left to complete the operation // 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(); 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 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 new Object[]{file.getName(), PhotoRecCarverIngestModuleFactory.getModuleName()}); // NON-NLS
return IngestModule.ProcessResult.ERROR; return IngestModule.ProcessResult.ERROR;
@ -278,7 +280,7 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule {
* @throws org.sleuthkit.autopsy.ingest.IngestModule.IngestModuleException * @throws org.sleuthkit.autopsy.ingest.IngestModule.IngestModuleException
*/ */
synchronized static Path createModuleOutputDirectoryForCase() throws IngestModule.IngestModuleException { synchronized static Path createModuleOutputDirectoryForCase() throws IngestModule.IngestModuleException {
Path path = Paths.get(Case.getCurrentCase().getModulesOutputDirAbsPath(), PhotoRecCarverIngestModuleFactory.getModuleName()); Path path = Paths.get(Case.getCurrentCase().getModulesDirectory(), PhotoRecCarverIngestModuleFactory.getModuleName());
try { try {
Files.createDirectory(path); Files.createDirectory(path);
} }

View File

@ -105,8 +105,8 @@ public final class SevenZipIngestModule implements FileIngestModule {
final Case currentCase = Case.getCurrentCase(); final Case currentCase = Case.getCurrentCase();
moduleDirRelative = Case.getModulesOutputDirRelPath() + File.separator + ArchiveFileExtractorModuleFactory.getModuleName(); moduleDirRelative = currentCase.getModuleOutputDirectoryRelativePath() + File.separator + ArchiveFileExtractorModuleFactory.getModuleName();
moduleDirAbsolute = currentCase.getModulesOutputDirAbsPath() + File.separator + ArchiveFileExtractorModuleFactory.getModuleName(); moduleDirAbsolute = currentCase.getModulesDirectory() + File.separator + ArchiveFileExtractorModuleFactory.getModuleName();
File unpackDirPathFile = new File(moduleDirAbsolute); File unpackDirPathFile = new File(moduleDirAbsolute);

View File

@ -110,7 +110,7 @@ import org.sleuthkit.datamodel.TskData;
DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy-HH-mm-ss"); DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy-HH-mm-ss");
Date date = new Date(); Date date = new Date();
String dateNoTime = dateFormat.format(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>(); this.errorList = new ArrayList<String>();

View File

@ -89,17 +89,6 @@ public final class ReportWizardAction extends CallableSystemAction implements P
if (evt.getPropertyName().equals(Case.Events.CURRENT_CASE.toString())) { if (evt.getPropertyName().equals(Case.Events.CURRENT_CASE.toString())) {
Case newCase = (Case) evt.getNewValue(); Case newCase = (Case) evt.getNewValue();
setEnabled(newCase != null); 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
}
}
}
} }
} }
}); });

View File

@ -69,7 +69,7 @@ public class SaveSnapshot extends Action {
//choose location/name //choose location/name
DirectoryChooser fileChooser = new DirectoryChooser(); DirectoryChooser fileChooser = new DirectoryChooser();
fileChooser.setTitle(NbBundle.getMessage(this.getClass(), "SaveSnapshot.fileChoose.title.text")); 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); File outFolder = fileChooser.showDialog(null);
if (outFolder == null) { if (outFolder == null) {
return; return;

View File

@ -107,7 +107,7 @@ public class EventsRepository {
public EventsRepository(ReadOnlyObjectProperty<ZoomParams> currentStateProperty) { public EventsRepository(ReadOnlyObjectProperty<ZoomParams> currentStateProperty) {
//TODO: we should check that case is open, or get passed a case object/directory -jm //TODO: we should check that case is open, or get passed a case object/directory -jm
this.eventDB = EventDB.getEventDB(Case.getCurrentCase().getCaseDirectory()); this.eventDB = EventDB.getEventDB(Case.getCurrentCase().getHostDirectory());
idToEventCache = CacheBuilder.newBuilder().maximumSize(5000L).expireAfterAccess(10, TimeUnit.MINUTES).removalListener((RemovalNotification<Long, TimeLineEvent> rn) -> { idToEventCache = CacheBuilder.newBuilder().maximumSize(5000L).expireAfterAccess(10, TimeUnit.MINUTES).removalListener((RemovalNotification<Long, TimeLineEvent> rn) -> {
//LOGGER.log(Level.INFO, "evicting event: {0}", rn.toString()); //LOGGER.log(Level.INFO, "evicting event: {0}", rn.toString());

View File

@ -88,7 +88,7 @@ class PerCaseProperties {
* @return true if the config exists, false otherwise. * @return true if the config exists, false otherwise.
*/ */
public synchronized boolean configExists(String moduleName) { public synchronized boolean configExists(String moduleName) {
File f = new File(c.getCaseDirectory() + File.separator + moduleName + ".properties"); File f = new File(c.getHostDirectory() + File.separator + moduleName + ".properties"); // NON-NLS
return f.exists(); return f.exists();
} }
@ -114,7 +114,7 @@ class PerCaseProperties {
* file doesn't exist. * file doesn't exist.
*/ */
private synchronized String getPropertyPath(String moduleName) { private synchronized String getPropertyPath(String moduleName) {
return c.getCaseDirectory() + File.separator + moduleName + ".properties"; //NON-NLS return c.getHostDirectory() + File.separator + moduleName + ".properties"; //NON-NLS
} }
/** /**

View File

@ -639,7 +639,7 @@ public class Server {
logger.log(Level.INFO, "Validating keyword search index location"); //NON-NLS logger.log(Level.INFO, "Validating keyword search index location"); //NON-NLS
String properIndexPath = getIndexDirPath(theCase); String properIndexPath = getIndexDirPath(theCase);
String legacyIndexPath = theCase.getCaseDirectory() String legacyIndexPath = theCase.getHostDirectory()
+ File.separator + "keywordsearch" + File.separator + "data"; //NON-NLS + File.separator + "keywordsearch" + File.separator + "data"; //NON-NLS
@ -680,8 +680,8 @@ public class Server {
* @return absolute path to index dir * @return absolute path to index dir
*/ */
String getIndexDirPath(Case theCase) { String getIndexDirPath(Case theCase) {
String indexDir = theCase.getModulesOutputDirAbsPath() String indexDir = theCase.getModulesDirectory() +
+ File.separator + "keywordsearch" + File.separator + "data"; //NON-NLS File.separator + "keywordsearch" + File.separator + "data"; //NON-NLS
return indexDir; return indexDir;
} }

View File

@ -209,7 +209,7 @@ public final class RAImageIngestModule implements DataSourceIngestModule {
* @return Path to directory * @return Path to directory
*/ */
protected static String getRAOutputPath(Case a_case, String mod) { 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.getModulesDirectory()+ File.separator + "RecentActivity" + File.separator + mod; //NON-NLS
File dir = new File(tmpDir); File dir = new File(tmpDir);
if (dir.exists() == false) { if (dir.exists() == false) {
dir.mkdirs(); dir.mkdirs();

View File

@ -83,7 +83,7 @@ class ScalpelCarverIngestModule implements FileIngestModule {
} }
// make sure module output directory exists; create it if it doesn't // make sure module output directory exists; create it if it doesn't
moduleOutputDirPath = Case.getCurrentCase().getModulesOutputDirAbsPath() moduleOutputDirPath = Case.getCurrentCase().getModulesDirectory()
+ File.separator + MODULE_OUTPUT_DIR_NAME; + File.separator + MODULE_OUTPUT_DIR_NAME;
File moduleOutputDir = new File(moduleOutputDirPath); File moduleOutputDir = new File(moduleOutputDirPath);
if (!moduleOutputDir.exists()) { if (!moduleOutputDir.exists()) {

View File

@ -1,5 +1,5 @@
#Updated by build script #Updated by build script
#Tue, 28 Apr 2015 18:19:58 -0400 #Tue, 12 May 2015 16:43:39 -0400
LBL_splash_window_title=Starting Autopsy LBL_splash_window_title=Starting Autopsy
SPLASH_HEIGHT=314 SPLASH_HEIGHT=314
SPLASH_WIDTH=538 SPLASH_WIDTH=538

View File

@ -1,5 +1,5 @@
#Updated by build script #Updated by build script
#Tue, 28 Apr 2015 18:19:58 -0400 #Tue, 12 May 2015 16:43:39 -0400
CTL_MainWindow_Title=Autopsy 3.1.2 CTL_MainWindow_Title=Autopsy 3.1.2
CTL_MainWindow_Title_No_Project=Autopsy 3.1.2 CTL_MainWindow_Title_No_Project=Autopsy 3.1.2

View File

@ -252,8 +252,8 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule {
} }
public static String getModuleOutputPath() { public static String getModuleOutputPath() {
String outDir = Case.getCurrentCase().getModulesOutputDirAbsPath() + File.separator String outDir = Case.getCurrentCase().getModulesDirectory() +
+ EmailParserModuleFactory.getModuleName(); File.separator + EmailParserModuleFactory.getModuleName();
File dir = new File(outDir); File dir = new File(outDir);
if (dir.exists() == false) { if (dir.exists() == false) {
dir.mkdirs(); dir.mkdirs();
@ -262,8 +262,8 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule {
} }
public static String getRelModuleOutputPath() { public static String getRelModuleOutputPath() {
return Case.getModulesOutputDirRelPath() + File.separator return Case.getCurrentCase().getModuleOutputDirectoryRelativePath() +
+ EmailParserModuleFactory.getModuleName(); File.separator + EmailParserModuleFactory.getModuleName();
} }
/** /**